FileDeclarationShouldContext

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

Properties

Link copied to clipboard

The complete list of file declaration contexts in this test run scope.

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.

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 this file does not use any wildcard star imports.

Link copied to clipboard

Asserts that this file contains at most one class declaration.

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

Checks if this file contains any classes matching the given predicate.

Link copied to clipboard
fun hasImport(predicate: (String) -> Boolean): Boolean

Checks if this file contains an import matching the given predicate.

Link copied to clipboard
fun hasImportContaining(vararg segments: String): Boolean

Checks if this file contains any import with matching package path segment strings.