Coming back to strikt after a while... how can you...
# strikt
e
Coming back to strikt after a while... how can you do an or condition? doing some convention checks and want to check if my controller methods have the
@PreAuthorize
annotation or have it as a meta-annotation.
Copy code
that(methods).all {
                get { annotations.toList() }.any {
                    get { annotationClass }.isEqualTo(PreAuthorize::class)
                    // or...
                    get { annotationClass.annotations }.any { get { annotationClass }.isEqualTo(PreAuthorize::class) }
                }
            }
of course I just have to ask to figure it out.
Copy code
that(methods).all {
                get { annotations.toList() }.any {
                    assertThat("has the @PreAuthorize annotation or meta-annotation ") { annotation ->
                        annotation.annotationClass == PreAuthorize::class ||
                                annotation.annotationClass.annotations
                                    .any { meta -> meta.annotationClass == PreAuthorize::class }
                    }
                }
            }