Add test for DI constructability of DismissNotificationAjaxPage
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Mon, 22 Jan 2018 06:12:52 +0000 (07:12 +0100)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Mon, 22 Jan 2018 06:12:52 +0000 (07:12 +0100)
src/main/kotlin/net/pterodactylus/sone/web/ajax/DismissNotificationAjaxPage.kt
src/test/kotlin/net/pterodactylus/sone/web/ajax/DismissNotificationAjaxPageTest.kt

index 539d57b..d755060 100644 (file)
@@ -5,11 +5,13 @@ import net.pterodactylus.sone.utils.let
 import net.pterodactylus.sone.utils.parameters
 import net.pterodactylus.sone.web.WebInterface
 import net.pterodactylus.sone.web.page.FreenetRequest
+import javax.inject.Inject
 
 /**
  * AJAX page that lets the user dismiss a notification.
  */
-class DismissNotificationAjaxPage(webInterface: WebInterface) : JsonPage("dismissNotification.ajax", webInterface) {
+class DismissNotificationAjaxPage @Inject constructor(webInterface: WebInterface) :
+               JsonPage("dismissNotification.ajax", webInterface) {
 
        override val requiresLogin = false
 
index ff603d2..72e048e 100644 (file)
@@ -1,10 +1,13 @@
 package net.pterodactylus.sone.web.ajax
 
+import net.pterodactylus.sone.test.getInstance
 import net.pterodactylus.sone.test.mock
 import net.pterodactylus.sone.test.whenever
+import net.pterodactylus.sone.web.baseInjector
 import net.pterodactylus.util.notify.Notification
 import org.hamcrest.MatcherAssert.assertThat
 import org.hamcrest.Matchers.equalTo
+import org.hamcrest.Matchers.notNullValue
 import org.junit.Test
 import org.mockito.Mockito.verify
 
@@ -35,4 +38,9 @@ class DismissNotificationAjaxPageTest : JsonPageTest("dismissNotification.ajax",
                verify(notification).dismiss()
        }
 
+       @Test
+       fun `page can be created by dependency injection`() {
+           assertThat(baseInjector.getInstance<DismissNotificationAjaxPage>(), notNullValue())
+       }
+
 }