import net.pterodactylus.sone.web.WebInterface
import net.pterodactylus.sone.web.page.FreenetRequest
import net.pterodactylus.util.template.TemplateContext
+import javax.inject.Inject
/**
* Page that stores a user’s image modifications.
*/
-class EditImageAjaxPage(webInterface: WebInterface,
+class EditImageAjaxPage @Inject constructor(webInterface: WebInterface,
private val parserFilter: ParserFilter,
private val shortenFilter: ShortenFilter,
private val renderFilter: RenderFilter) : JsonPage("editImage.ajax", webInterface) {
import net.pterodactylus.sone.template.RenderFilter
import net.pterodactylus.sone.template.ShortenFilter
import net.pterodactylus.sone.test.argumentCaptor
+import net.pterodactylus.sone.test.getInstance
+import net.pterodactylus.sone.test.isProvidedByMock
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.junit.Test
import org.mockito.ArgumentMatchers.any
import org.mockito.ArgumentMatchers.eq
assertThat(parameterCaptor.value["sone"], equalTo<Any>(sone))
}
+ @Test
+ fun `page can be created by dependency injection`() {
+ assertThat(baseInjector.createChildInjector(
+ ParserFilter::class.isProvidedByMock(),
+ ShortenFilter::class.isProvidedByMock(),
+ RenderFilter::class.isProvidedByMock()
+ ).getInstance<EditImageAjaxPage>(), notNullValue())
+ }
+
}