From: David ‘Bombe’ Roden Date: Sun, 21 Jan 2018 08:03:18 +0000 (+0100) Subject: Add test for DI constructability of GetImagePage X-Git-Tag: v79^2~210 X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=3641024b1ace540fcd76f8cf5153d7fc28a7fb22;p=Sone.git Add test for DI constructability of GetImagePage --- diff --git a/src/main/kotlin/net/pterodactylus/sone/web/pages/GetImagePage.kt b/src/main/kotlin/net/pterodactylus/sone/web/pages/GetImagePage.kt index 932827e..196b0b4 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/pages/GetImagePage.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/pages/GetImagePage.kt @@ -5,11 +5,12 @@ import net.pterodactylus.sone.web.page.FreenetPage import net.pterodactylus.sone.web.page.FreenetRequest import net.pterodactylus.util.web.Response import java.net.URI +import javax.inject.Inject /** * Page that delivers a {@link TemporaryImage} to the browser. */ -class GetImagePage(webInterface: WebInterface): FreenetPage { +class GetImagePage @Inject constructor(webInterface: WebInterface): FreenetPage { private val core = webInterface.core diff --git a/src/test/kotlin/net/pterodactylus/sone/web/pages/GetImagePageTest.kt b/src/test/kotlin/net/pterodactylus/sone/web/pages/GetImagePageTest.kt index b5efeac..ec0cd99 100644 --- a/src/test/kotlin/net/pterodactylus/sone/web/pages/GetImagePageTest.kt +++ b/src/test/kotlin/net/pterodactylus/sone/web/pages/GetImagePageTest.kt @@ -1,9 +1,12 @@ package net.pterodactylus.sone.web.pages import net.pterodactylus.sone.data.TemporaryImage +import net.pterodactylus.sone.test.getInstance +import net.pterodactylus.sone.web.baseInjector import org.hamcrest.MatcherAssert.assertThat import org.hamcrest.Matchers.contains import org.hamcrest.Matchers.equalTo +import org.hamcrest.Matchers.notNullValue import org.junit.Test /** @@ -59,4 +62,9 @@ class GetImagePageTest { )) } + @Test + fun `page can be created by dependency injection`() { + assertThat(baseInjector.getInstance(), notNullValue()) + } + }