FunctionDeclarationShouldContext

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

Properties

Link copied to clipboard

Filter or assertion criteria for all functions.

Link copied to clipboard

Filter or assertion criteria for annotations.

Link copied to clipboard

Filter or assertion criteria for class name.

Link copied to clipboard

Filter or assertion criteria for declaration.

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 is extension.

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 module path.

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 parameters.

Link copied to clipboard

Filter or assertion criteria for return type.

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

Asserts that at least one of the function's parameters matches the given predicate block. Appends the message suffix to the violation report on failure.

Link copied to clipboard
fun assertAllAnnotationsOf(vararg names: String)

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

Link copied to clipboard
fun assertAnnotationOf(annotationName: String)

Asserts that this function is decorated with the specified annotation.

Link copied to clipboard
fun assertAnyAnnotationOf(vararg names: String)

Asserts that this function 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 function is decorated with all of the specified annotations.

Link copied to clipboard

Checks if this function is decorated with the specified annotation.

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

Checks if this function is decorated with any of the specified annotations.

Link copied to clipboard

Asserts that none of the function's parameters match the given predicate block. Appends the message suffix to the violation report on failure.