import net.pterodactylus.util.template.Template
import net.pterodactylus.util.template.TemplateContext
import java.net.URI
+import javax.inject.Inject
/**
* This page lets the user view a post and all its replies.
*/
-class ViewPostPage(template: Template, webInterface: WebInterface):
+class ViewPostPage @Inject constructor(template: Template, webInterface: WebInterface):
SoneTemplatePage("viewPost.html", webInterface, template, "Page.ViewPost.Title") {
override fun handleRequest(freenetRequest: FreenetRequest, templateContext: TemplateContext) {
import net.pterodactylus.sone.data.Post
import net.pterodactylus.sone.data.Profile
+import net.pterodactylus.sone.test.getInstance
import net.pterodactylus.sone.test.mock
import net.pterodactylus.sone.test.whenever
+import net.pterodactylus.sone.web.baseInjector
import org.hamcrest.MatcherAssert.assertThat
import org.hamcrest.Matchers.equalTo
+import org.hamcrest.Matchers.notNullValue
import org.hamcrest.Matchers.nullValue
import org.junit.Test
assertThat(page.getPageTitle(freenetRequest), equalTo("This is a text that … - First M. Last - view post title"))
}
+ @Test
+ fun `page can be created by dependency injection`() {
+ assertThat(baseInjector.getInstance<ViewPostPage>(), notNullValue())
+ }
+
}