🚚 Rename test to match name of tested class
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Sun, 28 Jun 2020 22:11:37 +0000 (00:11 +0200)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Sun, 28 Jun 2020 22:22:35 +0000 (00:22 +0200)
src/test/kotlin/net/pterodactylus/sone/notify/DefaultReplyVisibilityFilterTest.kt [new file with mode: 0644]
src/test/kotlin/net/pterodactylus/sone/notify/ReplyVisibilityFilterTest.kt [deleted file]

diff --git a/src/test/kotlin/net/pterodactylus/sone/notify/DefaultReplyVisibilityFilterTest.kt b/src/test/kotlin/net/pterodactylus/sone/notify/DefaultReplyVisibilityFilterTest.kt
new file mode 100644 (file)
index 0000000..a34f522
--- /dev/null
@@ -0,0 +1,64 @@
+package net.pterodactylus.sone.notify
+
+import com.google.inject.Guice
+import net.pterodactylus.sone.test.createLocalSone
+import net.pterodactylus.sone.test.createPost
+import net.pterodactylus.sone.test.createPostReply
+import net.pterodactylus.sone.test.verifySingletonInstance
+import org.hamcrest.MatcherAssert.assertThat
+import org.hamcrest.Matchers.equalTo
+import org.junit.Test
+
+/**
+ * Unit test for [DefaultReplyVisibilityFilterTest].
+ */
+class DefaultReplyVisibilityFilterTest {
+
+       private val replyVisibilityFilter = DefaultReplyVisibilityFilter(showAllPosts)
+       private val localSone = createLocalSone()
+       private val post = createPost()
+
+       @Test
+       fun `reply visibility filter is only created once`() {
+               val injector = Guice.createInjector()
+               injector.verifySingletonInstance<DefaultReplyVisibilityFilter>()
+       }
+
+       @Test
+       fun `reply is not visible if post is not visible`() {
+               val postReply = createPostReply(post = post)
+               val replyVisibilityFilter = DefaultReplyVisibilityFilter(showNoPosts)
+               assertThat(replyVisibilityFilter.isReplyVisible(null, postReply), equalTo(false))
+       }
+
+       @Test
+       fun `reply is not visible if post is not present`() {
+               val postReply = createPostReply(post = null)
+               assertThat(replyVisibilityFilter.isReplyVisible(null, postReply), equalTo(false))
+       }
+
+       @Test
+       fun `reply is not visible if it is from the future`() {
+               val postReply = createPostReply(post = post, time = System.currentTimeMillis() + 100000)
+               assertThat(replyVisibilityFilter.isReplyVisible(null, postReply), equalTo(false))
+       }
+
+       @Test
+       fun `reply is visible if it is not from the future`() {
+               val postReply = createPostReply(post = post)
+               assertThat(replyVisibilityFilter.isReplyVisible(null, postReply), equalTo(true))
+       }
+
+       @Test
+       fun `predicate correctly recognizes visible reply`() {
+               val postReply = createPostReply(post = post)
+               assertThat(replyVisibilityFilter.isVisible(localSone).invoke(postReply), equalTo(true))
+       }
+
+       @Test
+       fun `predicate correctly recognizes not visible reply`() {
+               val postReply = createPostReply(post = post, time = System.currentTimeMillis() + 100000)
+               assertThat(replyVisibilityFilter.isVisible(localSone).invoke(postReply), equalTo(false))
+       }
+
+}
diff --git a/src/test/kotlin/net/pterodactylus/sone/notify/ReplyVisibilityFilterTest.kt b/src/test/kotlin/net/pterodactylus/sone/notify/ReplyVisibilityFilterTest.kt
deleted file mode 100644 (file)
index b9f3595..0000000
+++ /dev/null
@@ -1,64 +0,0 @@
-package net.pterodactylus.sone.notify
-
-import com.google.inject.Guice
-import net.pterodactylus.sone.test.createLocalSone
-import net.pterodactylus.sone.test.createPost
-import net.pterodactylus.sone.test.createPostReply
-import net.pterodactylus.sone.test.verifySingletonInstance
-import org.hamcrest.MatcherAssert.assertThat
-import org.hamcrest.Matchers.equalTo
-import org.junit.Test
-
-/**
- * Unit test for [ReplyVisibilityFilterTest].
- */
-class ReplyVisibilityFilterTest {
-
-       private val replyVisibilityFilter = DefaultReplyVisibilityFilter(showAllPosts)
-       private val localSone = createLocalSone()
-       private val post = createPost()
-
-       @Test
-       fun `reply visibility filter is only created once`() {
-               val injector = Guice.createInjector()
-               injector.verifySingletonInstance<DefaultReplyVisibilityFilter>()
-       }
-
-       @Test
-       fun `reply is not visible if post is not visible`() {
-               val postReply = createPostReply(post = post)
-               val replyVisibilityFilter = DefaultReplyVisibilityFilter(showNoPosts)
-               assertThat(replyVisibilityFilter.isReplyVisible(null, postReply), equalTo(false))
-       }
-
-       @Test
-       fun `reply is not visible if post is not present`() {
-               val postReply = createPostReply(post = null)
-               assertThat(replyVisibilityFilter.isReplyVisible(null, postReply), equalTo(false))
-       }
-
-       @Test
-       fun `reply is not visible if it is from the future`() {
-               val postReply = createPostReply(post = post, time = System.currentTimeMillis() + 100000)
-               assertThat(replyVisibilityFilter.isReplyVisible(null, postReply), equalTo(false))
-       }
-
-       @Test
-       fun `reply is visible if it is not from the future`() {
-               val postReply = createPostReply(post = post)
-               assertThat(replyVisibilityFilter.isReplyVisible(null, postReply), equalTo(true))
-       }
-
-       @Test
-       fun `predicate correctly recognizes visible reply`() {
-               val postReply = createPostReply(post = post)
-               assertThat(replyVisibilityFilter.isVisible(localSone).invoke(postReply), equalTo(true))
-       }
-
-       @Test
-       fun `predicate correctly recognizes not visible reply`() {
-               val postReply = createPostReply(post = post, time = System.currentTimeMillis() + 100000)
-               assertThat(replyVisibilityFilter.isVisible(localSone).invoke(postReply), equalTo(false))
-       }
-
-}