🎨 Replace FUTURE_POSTS_FILTER with Kotlin version
[Sone.git] / src / test / kotlin / net / pterodactylus / sone / data / PostTest.kt
diff --git a/src/test/kotlin/net/pterodactylus/sone/data/PostTest.kt b/src/test/kotlin/net/pterodactylus/sone/data/PostTest.kt
new file mode 100644 (file)
index 0000000..e5d9e97
--- /dev/null
@@ -0,0 +1,26 @@
+package net.pterodactylus.sone.data
+
+import net.pterodactylus.sone.test.createPost
+import org.hamcrest.MatcherAssert.assertThat
+import org.hamcrest.Matchers.equalTo
+import java.util.concurrent.TimeUnit.DAYS
+import kotlin.test.Test
+
+/**
+ * Unit test for the utilities in `Post.kt`.
+ */
+class PostTest {
+
+       @Test
+       fun `noFuturePost filter recognizes post from future`() {
+               val post = createPost(time = System.currentTimeMillis() + DAYS.toMillis(1))
+               assertThat(noFuturePost(post), equalTo(false))
+       }
+
+       @Test
+       fun `noFuturePost filter recognizes post not from future`() {
+               val post = createPost(time = System.currentTimeMillis())
+               assertThat(noFuturePost(post), equalTo(true))
+       }
+
+}