Add test for DI constructability of DeleteProfileFieldPage
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Sat, 20 Jan 2018 23:41:00 +0000 (00:41 +0100)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Sat, 20 Jan 2018 23:41:00 +0000 (00:41 +0100)
src/main/kotlin/net/pterodactylus/sone/web/pages/DeleteProfileFieldPage.kt
src/test/kotlin/net/pterodactylus/sone/web/pages/DeleteProfileFieldPageTest.kt

index f25299f..845ec7f 100644 (file)
@@ -6,11 +6,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
 
 /**
  * Page that lets the user confirm the deletion of a profile field.
  */
-class DeleteProfileFieldPage(template: Template, webInterface: WebInterface):
+class DeleteProfileFieldPage @Inject constructor(template: Template, webInterface: WebInterface):
                LoggedInPage("deleteProfileField.html", template, "Page.DeleteProfileField.Title", webInterface) {
 
        override fun handleRequest(freenetRequest: FreenetRequest, currentSone: Sone, templateContext: TemplateContext) {
index 8f344eb..0baaffe 100644 (file)
@@ -1,10 +1,13 @@
 package net.pterodactylus.sone.web.pages
 
 import net.pterodactylus.sone.data.Profile
+import net.pterodactylus.sone.test.getInstance
 import net.pterodactylus.sone.test.whenever
+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.hamcrest.Matchers.nullValue
 import org.junit.Before
 import org.junit.Test
@@ -75,4 +78,9 @@ class DeleteProfileFieldPageTest: WebPageTest(::DeleteProfileFieldPage) {
                }
        }
 
+       @Test
+       fun `page can be created by dependency injection`() {
+               assertThat(baseInjector.getInstance<DeleteProfileFieldPage>(), notNullValue())
+       }
+
 }