🔥 Remove unnecessary imports
[Sone.git] / src / test / kotlin / net / pterodactylus / sone / web / page / SoneRequestTest.kt
index dc2b4a5..0ec86db 100644 (file)
@@ -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<Core>()
-       private val soneRequest = SoneRequest(uri, method, httpRequest, toadletContext, core)
+       private val webInterface = mock<WebInterface>()
+       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))
        }
 
 }