From: David ‘Bombe’ Roden Date: Tue, 3 Dec 2019 17:45:05 +0000 (+0100) Subject: ♻️ Extract page implementation for tests X-Git-Tag: v81^2~5^2~84 X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=15e809aef485b28236147ccb9067e0187e9b06c0;p=Sone.git ♻️ Extract page implementation for tests --- 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 - } - }