From: David ‘Bombe’ Roden Date: Mon, 22 Jan 2018 06:12:52 +0000 (+0100) Subject: Add test for DI constructability of DismissNotificationAjaxPage X-Git-Tag: v79^2~181 X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=2d1e85188f7855fa508b9d5664b749965f1ce172;p=Sone.git Add test for DI constructability of DismissNotificationAjaxPage --- diff --git a/src/main/kotlin/net/pterodactylus/sone/web/ajax/DismissNotificationAjaxPage.kt b/src/main/kotlin/net/pterodactylus/sone/web/ajax/DismissNotificationAjaxPage.kt index 539d57b..d755060 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/ajax/DismissNotificationAjaxPage.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/ajax/DismissNotificationAjaxPage.kt @@ -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 diff --git a/src/test/kotlin/net/pterodactylus/sone/web/ajax/DismissNotificationAjaxPageTest.kt b/src/test/kotlin/net/pterodactylus/sone/web/ajax/DismissNotificationAjaxPageTest.kt index ff603d2..72e048e 100644 --- a/src/test/kotlin/net/pterodactylus/sone/web/ajax/DismissNotificationAjaxPageTest.kt +++ b/src/test/kotlin/net/pterodactylus/sone/web/ajax/DismissNotificationAjaxPageTest.kt @@ -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(), notNullValue()) + } + }