ClassDeclarationShouldContext

Context receiver for writing declarative assertions on a ClassDeclaration element. Provides easy access to all element properties and custom helper assertions.

Properties

Link copied to clipboard

The complete list of class declarations in this test run scope.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

The target ClassDeclaration being verified.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Mutable collection where assertion failure messages are appended.

Link copied to clipboard

Functions

Link copied to clipboard
fun addViolation(message: String)

Appends a custom violation failure message to the assertion run.

Link copied to clipboard
fun assertAllAnnotationsOf(vararg names: String): <Error class: unknown class>

Asserts that this class is decorated with all of the specified annotations.

Link copied to clipboard
fun assertAnnotationOf(annotationName: String)

Asserts that this class is decorated with the specified annotation.

Link copied to clipboard
fun assertAnyAnnotationOf(vararg names: String): <Error class: unknown class>

Asserts that this class is decorated with at least one of the specified annotations.

Link copied to clipboard
fun check(condition: Boolean, message: String? = null)

Asserts condition is true, recording a violation with message when false. When message is omitted, a default message referencing element is used.

Link copied to clipboard
fun hasAllAnnotations(vararg names: String): Boolean

Checks if this class is annotated with all of the given annotation names.

Link copied to clipboard

Checks if this class is annotated with the given annotation name or fully qualified name.

Link copied to clipboard
fun hasAnyAnnotation(vararg names: String): Boolean

Checks if this class is annotated with any of the given annotation names.