X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Ftest%2Fkotlin%2Fnet%2Fpterodactylus%2Fsone%2Fdata%2FPostTest.kt;fp=src%2Ftest%2Fkotlin%2Fnet%2Fpterodactylus%2Fsone%2Fdata%2FPostTest.kt;h=e5d9e972dadf03c96f6acfd8bcbef8b5ac9c32c1;hb=ee39c03a6a811300728183552afcede1d9f8e79a;hp=0000000000000000000000000000000000000000;hpb=c00c2dea5bbe698a46c443d3610855720baa69a4;p=Sone.git 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 index 0000000..e5d9e97 --- /dev/null +++ b/src/test/kotlin/net/pterodactylus/sone/data/PostTest.kt @@ -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)) + } + +}