import net.pterodactylus.sone.main.*
import net.pterodactylus.util.template.*
import net.pterodactylus.util.web.*
-import java.lang.String.*
import java.net.*
import java.util.logging.*
import java.util.logging.Logger.*
processTemplate(request, templateContext)
}.also {
val finish = System.nanoTime()
- logger.log(Level.FINEST, format("Template was rendered in %.2fms.", (finish - start) / 1000000.0))
+ logger.log(Level.FINEST, "Template was rendered in %.2fms.".format((finish - start) / 1000000.0))
}
} catch (re1: RedirectException) {
return RedirectResponse(re1.target ?: "")
throw RedirectException(target)
class RedirectException(val target: String?) : Exception() {
- override fun toString(): String = format("RedirectException{target='%s'}", target)
+ override fun toString(): String = "RedirectException{target='%s'}".format(target)
}
}
mutableMapOf<Pair<TypeLiteral<*>, Annotation?>, Any>()
private val injector = mock<Injector>().apply {
- fun mockValue(clazz: Class<*>) = false.takeIf { clazz.name == java.lang.Boolean::class.java.name } ?: mock(clazz)
+ fun mockValue(clazz: Class<*>) = false.takeIf { clazz.name == Boolean::class.javaObjectType.name } ?: mock(clazz)
whenever(getInstance(any<Key<*>>())).then {
injected.getOrPut((it.getArgument(0) as Key<*>).let { it.typeLiteral to it.annotation }) {
it.getArgument<Key<*>>(0).typeLiteral.type.typeName.toClass().let(::mockValue)
fun `request with title and description returns correct values`() {
val sone = mock<Sone>().apply { whenever(isLocal).thenReturn(true) }
val image = ImageImpl("image-id").modify().setSone(sone).update()
- val parsed = Object()
- val shortened = Object()
+ val parsed = Any()
+ val shortened = Any()
val rendered = "rendered description"
whenever(parserFilter.format(any(), eq("some KSK@foo link"), any())).thenReturn(parsed)
whenever(shortenFilter.format(any(), eq(parsed), any())).thenReturn(shortened)