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.*
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`() {
}
@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))
}
}