import net.pterodactylus.util.template.TemplateParser
import java.io.StringReader
import java.io.StringWriter
+import javax.inject.Inject
/**
* Renders all kinds of [LinkedElement]s.
*/
-class LinkedElementRenderFilter(private val templateContextFactory: TemplateContextFactory) : Filter {
+class LinkedElementRenderFilter @Inject constructor(private val templateContextFactory: TemplateContextFactory): Filter {
companion object {
private val loadedImageTemplate = """<%include linked/image.html>""".parse()
package net.pterodactylus.sone.template
+import com.google.inject.Guice
import net.pterodactylus.sone.core.LinkedElement
+import net.pterodactylus.sone.test.getInstance
+import net.pterodactylus.sone.test.isProvidedByMock
import net.pterodactylus.util.template.ClassPathTemplateProvider
import net.pterodactylus.util.template.HtmlFilter
import net.pterodactylus.util.template.TemplateContextFactory
import org.hamcrest.MatcherAssert.assertThat
import org.hamcrest.Matchers.`is`
+import org.hamcrest.Matchers.notNullValue
import org.hamcrest.Matchers.nullValue
import org.jsoup.Jsoup
import org.junit.Test
assertThat(spanNode.attr("style"), `is`("background-image: url('/KSK@gpl.png')"))
}
+ @Test
+ fun `render filter can be created by guice`() {
+ val injector = Guice.createInjector(TemplateContextFactory::class.isProvidedByMock())
+ assertThat(injector.getInstance<LinkedElementRenderFilter>(), notNullValue())
+ }
+
}