X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Ftest%2Fkotlin%2Fnet%2Fpterodactylus%2Fsone%2Fweb%2Fpage%2FSoneRequestTest.kt;h=0ec86db770e37f2596c124c2c37901753367bf62;hb=5c5bee980f9cab5792e34d1c9840f73b8b191830;hp=dc2b4a5b2ce6fcd13a7a93a62d3e74cfbf849082;hpb=dc47bafb2d0c4a2a440389158039993d10cbfd08;p=Sone.git diff --git a/src/test/kotlin/net/pterodactylus/sone/web/page/SoneRequestTest.kt b/src/test/kotlin/net/pterodactylus/sone/web/page/SoneRequestTest.kt index dc2b4a5..0ec86db 100644 --- a/src/test/kotlin/net/pterodactylus/sone/web/page/SoneRequestTest.kt +++ b/src/test/kotlin/net/pterodactylus/sone/web/page/SoneRequestTest.kt @@ -4,6 +4,7 @@ import freenet.clients.http.* import freenet.support.api.* import net.pterodactylus.sone.core.* import net.pterodactylus.sone.test.* +import net.pterodactylus.sone.web.* import net.pterodactylus.util.web.* import org.hamcrest.MatcherAssert.* import org.hamcrest.Matchers.* @@ -18,7 +19,8 @@ class SoneRequestTest { private val httpRequest = Mockito.mock(HTTPRequest::class.java) private val toadletContext = Mockito.mock(ToadletContext::class.java) private val core = mock() - private val soneRequest = SoneRequest(uri, method, httpRequest, toadletContext, core) + private val webInterface = mock() + private val soneRequest = SoneRequest(uri, method, httpRequest, toadletContext, core, webInterface) @Test fun `freenet request properties are retained correctly`() { @@ -34,14 +36,20 @@ class SoneRequestTest { } @Test + fun `web interface is retained correctly`() { + assertThat(soneRequest.webInterface, sameInstance(webInterface)) + } + + @Test fun `freenet request is wrapped correctly`() { val freenetRequest = FreenetRequest(uri, method, httpRequest, toadletContext) - val wrappedSoneRequest = freenetRequest.toSoneRequest(core) + val wrappedSoneRequest = freenetRequest.toSoneRequest(core, webInterface) assertThat(wrappedSoneRequest.uri, equalTo(uri)) assertThat(wrappedSoneRequest.method, equalTo(method)) assertThat(wrappedSoneRequest.httpRequest, equalTo(httpRequest)) assertThat(wrappedSoneRequest.toadletContext, equalTo(toadletContext)) assertThat(wrappedSoneRequest.core, sameInstance(core)) + assertThat(wrappedSoneRequest.webInterface, sameInstance(webInterface)) } }