1 package net.pterodactylus.sone.core
3 import net.pterodactylus.sone.data.*
4 import net.pterodactylus.sone.test.*
5 import org.hamcrest.MatcherAssert.*
6 import org.hamcrest.Matchers.*
9 class SoneComparsisonTest {
11 private val oldSone = mock<Sone>()
12 private val newSone = mock<Sone>()
14 private val oldPost = mock<Post>()
15 private val removedPost = mock<Post>()
16 private val newPost = mock<Post>()
17 private val oldPostReply = mock<PostReply>()
18 private val removedPostReply = mock<PostReply>()
19 private val newPostReply = mock<PostReply>()
22 whenever(oldSone.posts).thenReturn(listOf(oldPost, removedPost))
23 whenever(newSone.posts).thenReturn(listOf(oldPost, newPost))
24 whenever(oldSone.replies).thenReturn(setOf(oldPostReply, removedPostReply))
25 whenever(newSone.replies).thenReturn(setOf(oldPostReply, newPostReply))
28 private val soneComparison = SoneComparison(oldSone, newSone)
31 fun `new posts are identified correctly`() {
32 assertThat(soneComparison.newPosts, contains(newPost))
36 fun `removed posts are identified correctly`() {
37 assertThat(soneComparison.removedPosts, contains(removedPost))
41 fun `new post replies are identified correctly`() {
42 assertThat(soneComparison.newPostReplies, contains(newPostReply))
46 fun `removed post replies are identified correctly`() {
47 assertThat(soneComparison.removedPostReplies, contains(removedPostReply))