igor.wojda
09/07/2023, 6:08 AM@SampleAnnotation("some_text", 1)
...and Konsist that parses it and exposes to the developer.
...
.annotations
.arguments
.map { it.value }
How the first argument be represented in the list of arguments?
• 🅰️ ""some_text"", "1"
• 🅱️ "some_text", "1"
Please vote with emojisEran Boudjnah
09/07/2023, 10:57 AMigor.wojda
09/07/2023, 10:59 AMEran Boudjnah
09/07/2023, 11:00 AMigor.wojda
09/07/2023, 11:01 AMEric
09/08/2023, 7:16 PMList<Any>
? then you can do arguments[1] as? Integer
checks etcEric
09/08/2023, 7:17 PMinline fun <reified A : Any> KoAnnotationProvider.hasAnnotation(predicate: (KoAnnotationDeclaration) -> Boolean) =
hasAnnotationsOf(A::class) && predicate(annotations.first { it.fullyQualifiedName == A::class.java.name })
then I can use it like this:
@Test
fun `classes annotated with @RestController should produce application json`() {
classesAnnotatedWith<RestController>()
.assert { controller ->
controller.hasAnnotation<RequestMapping> { requestMapping ->
requestMapping.text.contains("APPLICATION_JSON_VALUE")
}
}
}