From fe880bd95f2f1bb155e890a9ffd2dc2abc86cb37 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Wed, 1 Jul 2020 22:13:57 +0200 Subject: [PATCH] =?utf8?q?=F0=9F=9A=9A=20Move=20new=20elements=20mock=20to?= =?utf8?q?=20test=20objects?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../kotlin/net/pterodactylus/sone/web/ajax/GetStatusAjaxPageTest.kt | 4 ---- src/test/kotlin/net/pterodactylus/sone/web/ajax/TestObjects.kt | 5 +++++ 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/test/kotlin/net/pterodactylus/sone/web/ajax/GetStatusAjaxPageTest.kt b/src/test/kotlin/net/pterodactylus/sone/web/ajax/GetStatusAjaxPageTest.kt index fb06e19..651d839 100644 --- a/src/test/kotlin/net/pterodactylus/sone/web/ajax/GetStatusAjaxPageTest.kt +++ b/src/test/kotlin/net/pterodactylus/sone/web/ajax/GetStatusAjaxPageTest.kt @@ -38,10 +38,6 @@ class GetStatusAjaxPageTest: JsonPageTest("getStatus.ajax", requiresLogin = fals private val timeTextConverter = mock() private val l10nFilter = mock() - private val newElements = mock().apply { - whenever(newPosts).then { this@GetStatusAjaxPageTest.newPosts.values } - whenever(newReplies).then { this@GetStatusAjaxPageTest.newReplies.values } - } override var page: JsonPage = GetStatusAjaxPage(webInterface, elementLoader, newElements, timeTextConverter, l10nFilter, TimeZone.getTimeZone("UTC")) @Before diff --git a/src/test/kotlin/net/pterodactylus/sone/web/ajax/TestObjects.kt b/src/test/kotlin/net/pterodactylus/sone/web/ajax/TestObjects.kt index e125c13..e8e660d 100644 --- a/src/test/kotlin/net/pterodactylus/sone/web/ajax/TestObjects.kt +++ b/src/test/kotlin/net/pterodactylus/sone/web/ajax/TestObjects.kt @@ -25,6 +25,7 @@ import net.pterodactylus.sone.test.get import net.pterodactylus.sone.test.mock import net.pterodactylus.sone.test.whenever import net.pterodactylus.sone.utils.asOptional +import net.pterodactylus.sone.web.NewElements import net.pterodactylus.sone.web.WebInterface import net.pterodactylus.sone.web.page.FreenetRequest import net.pterodactylus.util.notify.Notification @@ -49,6 +50,7 @@ open class TestObjects { val preferences = Preferences(eventBus) val updateChecker = mock() val elementLoader = mock() + val newElements = mock() val toadletContext = mock() val freenetRequest = mock() @@ -103,6 +105,9 @@ open class TestObjects { linkedElements[it.getArgument(0)] ?: LinkedElement(it.getArgument(0), loading = true) } + whenever(newElements.newPosts).then { newPosts.values } + whenever(newElements.newReplies).then { newReplies.values } + whenever(currentSone.options).thenReturn(DefaultSoneOptions()) currentSone.mock("soneId", "Sone_Id", true, 1000, idle) -- 2.7.4