import net.pterodactylus.util.web.Request
import net.pterodactylus.util.web.Response
import java.io.File
+import javax.inject.Inject
/**
* [Page] implementation that delivers static files from the filesystem.
*/
-class ReloadingPage<R: Request>(private val prefix: String, private val path: String, private val mimeType: String): Page<R> {
+class ReloadingPage<R: Request> @Inject constructor(private val prefix: String, private val path: String, private val mimeType: String): Page<R> {
override fun isPrefixPage() = true
package net.pterodactylus.sone.web.pages
+import net.pterodactylus.sone.test.getInstance
+import net.pterodactylus.sone.web.baseInjector
import net.pterodactylus.sone.web.page.FreenetRequest
import org.hamcrest.MatcherAssert.assertThat
import org.hamcrest.Matchers.equalTo
+import org.hamcrest.Matchers.notNullValue
import org.junit.Rule
import org.junit.Test
import org.junit.rules.TemporaryFolder
assertThat(responseBytes.toByteArray(), equalTo("Hello\nWorld\n".toByteArray()))
}
+ @Test
+ fun `page can be created by dependency injection`() {
+ assertThat(baseInjector.getInstance<ReloadingPage<*>>(), notNullValue())
+ }
+
}