From 15e809aef485b28236147ccb9067e0187e9b06c0 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Tue, 3 Dec 2019 18:45:05 +0100 Subject: [PATCH] =?utf8?q?=E2=99=BB=EF=B8=8F=20Extract=20page=20implementa?= =?utf8?q?tion=20for=20tests?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- src/test/kotlin/net/pterodactylus/sone/test/TestPage.kt | 14 ++++++++++++++ .../net/pterodactylus/sone/web/PageToadletRegistryTest.kt | 9 +-------- 2 files changed, 15 insertions(+), 8 deletions(-) create mode 100644 src/test/kotlin/net/pterodactylus/sone/test/TestPage.kt diff --git a/src/test/kotlin/net/pterodactylus/sone/test/TestPage.kt b/src/test/kotlin/net/pterodactylus/sone/test/TestPage.kt new file mode 100644 index 0000000..762f789 --- /dev/null +++ b/src/test/kotlin/net/pterodactylus/sone/test/TestPage.kt @@ -0,0 +1,14 @@ +package net.pterodactylus.sone.test + +import net.pterodactylus.util.web.* + +/** + * Dummy implementation of a [Page]. + */ +class TestPage : Page { + + override fun getPath() = "" + override fun isPrefixPage() = false + override fun handleRequest(freenetRequest: REQ, response: Response) = response + +} diff --git a/src/test/kotlin/net/pterodactylus/sone/web/PageToadletRegistryTest.kt b/src/test/kotlin/net/pterodactylus/sone/web/PageToadletRegistryTest.kt index 739a0dd..2134661 100644 --- a/src/test/kotlin/net/pterodactylus/sone/web/PageToadletRegistryTest.kt +++ b/src/test/kotlin/net/pterodactylus/sone/web/PageToadletRegistryTest.kt @@ -5,7 +5,6 @@ import freenet.clients.http.* import net.pterodactylus.sone.main.* import net.pterodactylus.sone.test.* import net.pterodactylus.sone.web.page.* -import net.pterodactylus.util.web.* import org.junit.* import org.junit.rules.* import org.mockito.Mockito.* @@ -36,7 +35,7 @@ class PageToadletRegistryTest { verify(pageMaker).addNavigationCategory("/Sone/index.html", "Navigation.Menu.Sone.Name", "Navigation.Menu.Sone.Tooltip", sonePlugin) } - private val page = TestPage() + private val page = TestPage() @Test fun `adding a page without menuname will add it correctly`() { @@ -147,10 +146,4 @@ class PageToadletRegistryTest { whenever(this.menuName).thenReturn(menuName) } - private class TestPage : Page { - override fun getPath() = "" - override fun isPrefixPage() = false - override fun handleRequest(freenetRequest: FreenetRequest, response: Response) = response - } - } -- 2.7.4