import net.pterodactylus.sone.test.mock
import net.pterodactylus.sone.test.whenever
import net.pterodactylus.sone.utils.Pagination
import net.pterodactylus.sone.test.mock
import net.pterodactylus.sone.test.whenever
import net.pterodactylus.sone.utils.Pagination
import org.hamcrest.MatcherAssert.assertThat
import org.hamcrest.Matchers.contains
import org.hamcrest.Matchers.containsInAnyOrder
import org.hamcrest.Matchers.equalTo
import org.hamcrest.MatcherAssert.assertThat
import org.hamcrest.Matchers.contains
import org.hamcrest.Matchers.containsInAnyOrder
import org.hamcrest.Matchers.equalTo
-class NewPageTest: WebPageTest() {
-
- private val page = NewPage(template, webInterface)
-
- override fun getPage() = page
+class NewPageTest: WebPageTest(::NewPage) {
fun `posts are not duplicated when they come from both new posts and new replies notifications`() {
val extraPost = mock<Post>().withTime(2000)
val posts = asList(mock<Post>().withTime(1000), mock<Post>().withTime(3000))
fun `posts are not duplicated when they come from both new posts and new replies notifications`() {
val extraPost = mock<Post>().withTime(2000)
val posts = asList(mock<Post>().withTime(1000), mock<Post>().withTime(3000))
whenever(postReplies[0].post).thenReturn(posts[0].asOptional())
whenever(postReplies[1].post).thenReturn(extraPost.asOptional())
whenever(webInterface.getNewPosts(currentSone)).thenReturn(posts)
whenever(postReplies[0].post).thenReturn(posts[0].asOptional())
whenever(postReplies[1].post).thenReturn(extraPost.asOptional())
whenever(webInterface.getNewPosts(currentSone)).thenReturn(posts)