From ce75a1d1a837cd33046c0da5098240c3629f7df7 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Sun, 18 Jun 2017 23:45:17 +0200 Subject: [PATCH] Convert sone template page test to use new web page test base --- .../sone/web/pages/SoneTemplatePageTest.kt | 5 +--- .../pterodactylus/sone/web/pages/WebPageTest2.kt | 29 ++++++++++++++++++---- 2 files changed, 25 insertions(+), 9 deletions(-) diff --git a/src/test/kotlin/net/pterodactylus/sone/web/pages/SoneTemplatePageTest.kt b/src/test/kotlin/net/pterodactylus/sone/web/pages/SoneTemplatePageTest.kt index 4cef5b0..c872b08 100644 --- a/src/test/kotlin/net/pterodactylus/sone/web/pages/SoneTemplatePageTest.kt +++ b/src/test/kotlin/net/pterodactylus/sone/web/pages/SoneTemplatePageTest.kt @@ -21,10 +21,7 @@ import org.mockito.Mockito.verify /** * Unit test for [SoneTemplatePage]. */ -class SoneTemplatePageTest : WebPageTest() { - - private val preferences by lazy { core.preferences!! } - private val page = object : SoneTemplatePage("path.html", template, webInterface, true) {} +class SoneTemplatePageTest: WebPageTest2({ template, webInterface -> object : SoneTemplatePage("path.html", template, webInterface, true) {}}) { @Test fun `current sone is retrieved from web interface`() { diff --git a/src/test/kotlin/net/pterodactylus/sone/web/pages/WebPageTest2.kt b/src/test/kotlin/net/pterodactylus/sone/web/pages/WebPageTest2.kt index b04fc4b..6c4372d 100644 --- a/src/test/kotlin/net/pterodactylus/sone/web/pages/WebPageTest2.kt +++ b/src/test/kotlin/net/pterodactylus/sone/web/pages/WebPageTest2.kt @@ -25,6 +25,7 @@ import org.mockito.ArgumentMatchers.anyInt import org.mockito.ArgumentMatchers.anyLong import org.mockito.ArgumentMatchers.anyString import org.mockito.ArgumentMatchers.eq +import java.net.URI import java.nio.charset.Charset import kotlin.text.Charsets.UTF_8 @@ -34,19 +35,20 @@ import kotlin.text.Charsets.UTF_8 abstract class WebPageTest2(pageSupplier: (Template, WebInterface) -> SoneTemplatePage) { protected val currentSone = mock() - private val template = mock