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

Filter or assertion criteria for all classes.

Link copied to clipboard

Filter or assertion criteria for annotations.

Link copied to clipboard

Filter or assertion criteria for companion object.

Link copied to clipboard

Filter or assertion criteria for element.

Link copied to clipboard

Filter or assertion criteria for file path.

Link copied to clipboard

Filter or assertion criteria for fq name.

Link copied to clipboard

Filter or assertion criteria for functions.

Link copied to clipboard

Filter or assertion criteria for imports.

Link copied to clipboard

Filter or assertion criteria for is abstract.

Link copied to clipboard

Filter or assertion criteria for is interface.

Link copied to clipboard

Filter or assertion criteria for kdoc text.

Link copied to clipboard

Filter or assertion criteria for modifiers.

Link copied to clipboard

Filter or assertion criteria for name.

Link copied to clipboard

Filter or assertion criteria for package name.

Link copied to clipboard

Filter or assertion criteria for primary constructor.

Link copied to clipboard

Filter or assertion criteria for properties.

Link copied to clipboard

Filter or assertion criteria for referenced types.

Link copied to clipboard

Filter or assertion criteria for secondary constructors.

Link copied to clipboard

Filter or assertion criteria for supertypes.

Link copied to clipboard

Filter or assertion criteria for violations.

Link copied to clipboard

Filter or assertion criteria for visibility.

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)

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)

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.