From: David ‘Bombe’ Roden Date: Sun, 21 Jan 2018 09:28:16 +0000 (+0100) Subject: Add test for DI constructability of LockSonePage X-Git-Tag: v79^2~205 X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=78c2c870a24d5f3d002de3765873a6913649ed62;p=Sone.git Add test for DI constructability of LockSonePage --- diff --git a/src/main/kotlin/net/pterodactylus/sone/web/pages/LockSonePage.kt b/src/main/kotlin/net/pterodactylus/sone/web/pages/LockSonePage.kt index bb4c98a..be70548 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/pages/LockSonePage.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/pages/LockSonePage.kt @@ -5,11 +5,12 @@ import net.pterodactylus.sone.web.WebInterface import net.pterodactylus.sone.web.page.FreenetRequest import net.pterodactylus.util.template.Template import net.pterodactylus.util.template.TemplateContext +import javax.inject.Inject /** * This page lets the user lock a [net.pterodactylus.sone.data.Sone] to prevent it from being inserted. */ -class LockSonePage(template: Template, webInterface: WebInterface): +class LockSonePage @Inject constructor(template: Template, webInterface: WebInterface): SoneTemplatePage("lockSone.html", webInterface, template, "Page.LockSone.Title") { override fun handleRequest(freenetRequest: FreenetRequest, templateContext: TemplateContext) { diff --git a/src/test/kotlin/net/pterodactylus/sone/web/pages/LockSonePageTest.kt b/src/test/kotlin/net/pterodactylus/sone/web/pages/LockSonePageTest.kt index 2a9b4ed..f8ad87a 100644 --- a/src/test/kotlin/net/pterodactylus/sone/web/pages/LockSonePageTest.kt +++ b/src/test/kotlin/net/pterodactylus/sone/web/pages/LockSonePageTest.kt @@ -1,10 +1,13 @@ package net.pterodactylus.sone.web.pages import net.pterodactylus.sone.data.Sone +import net.pterodactylus.sone.test.getInstance import net.pterodactylus.sone.test.mock +import net.pterodactylus.sone.web.baseInjector import net.pterodactylus.util.web.Method.POST import org.hamcrest.MatcherAssert.assertThat import org.hamcrest.Matchers.equalTo +import org.hamcrest.Matchers.notNullValue import org.junit.Test import org.mockito.ArgumentMatchers.any import org.mockito.Mockito.never @@ -52,4 +55,9 @@ class LockSonePageTest: WebPageTest(::LockSonePage) { } } + @Test + fun `page can be created by dependency injection`() { + assertThat(baseInjector.getInstance(), notNullValue()) + } + }