ClassesShould

Fluent API for defining assertion rules on Kotlin classes.

Functions

Link copied to clipboard

Asserts that all member functions in selected classes satisfy the assertions specified in the block.

Link copied to clipboard
fun allOf(vararg blocks: ClassesShould.() -> Unit): ClassesRuleBuilder

Asserts that all of the nested assertion blocks are satisfied.

Link copied to clipboard

Asserts that all member properties in selected classes satisfy the assertions specified in the block.

Link copied to clipboard
fun anyOf(vararg blocks: ClassesShould.() -> Unit): ClassesRuleBuilder

Asserts that at least one of the nested assertion blocks is satisfied.

Link copied to clipboard

Asserts that selected classes are abstract classes.

Link copied to clipboard

Asserts that selected classes extend or implement specified supertype.

Link copied to clipboard

Asserts that selected classes are assignable to all of the specified supertypes.

Asserts that selected classes are assignable to specified supertype.

Link copied to clipboard

Asserts that selected classes are assignable to any of the specified supertypes.

Asserts that selected classes are assignable to specified supertype.

Link copied to clipboard

Asserts that selected classes are data classes.

Link copied to clipboard

Asserts that selected classes have KDoc documentation.

Link copied to clipboard

Asserts that selected classes are enum classes.

Link copied to clipboard

Asserts that selected classes are inline/value classes.

Link copied to clipboard

Asserts that selected classes are interface definitions.

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

Asserts that selected classes are sealed.

Link copied to clipboard

Asserts that selected classes are annotated with all of the specified annotations.

Asserts that selected classes are annotated with the specified annotation. Matches either simple names or FQNs.

Link copied to clipboard

Asserts that selected classes have the specified modifier.

Asserts that selected classes have all of the specified modifiers.

Link copied to clipboard
infix fun haveAnnotationOf(annotationFqName: String): ClassesRuleBuilder

Asserts that selected classes are annotated with the specified annotation. Matches either the annotation's simple name or its FQN.

Link copied to clipboard
fun haveAnnotationWithArgument(annotationName: String, argName: String?, argValue: String): ClassesRuleBuilder

Asserts that selected classes have the specified annotation with a matching argument name and value.

Link copied to clipboard

Asserts that selected classes are annotated with any of the specified annotations.

Asserts that selected classes are annotated with the specified annotation. Matches either simple names or FQNs.

Link copied to clipboard

Asserts that selected classes have the specified modifier.

Asserts that selected classes have at least one of the specified modifiers.

Link copied to clipboard

Asserts that selected classes have specified visibility.

Asserts that selected classes have any of the specified visibilities.

Link copied to clipboard

Asserts that selected classes have specified modifier.

Link copied to clipboard
infix fun haveName(predicate: (String) -> Boolean): ClassesRuleBuilder
fun haveName(description: String, predicate: (String) -> Boolean): ClassesRuleBuilder

Asserts that selected classes have simple names matching the specified predicate.

Link copied to clipboard

Asserts that selected classes have simple names ending with any of the specified suffixes.

Asserts that selected classes have simple names ending with the specified suffix.

Link copied to clipboard

Asserts that selected classes have simple names matching any of the specified glob patterns. Supports '*' wildcards.

Asserts that selected classes have simple names matching the specified glob pattern. Supports '*' wildcards.

Link copied to clipboard

Asserts that selected classes have simple names starting with any of the specified prefixes.

Asserts that selected classes have simple names starting with the specified prefix.

Link copied to clipboard

Asserts that selected classes have specified visibility.

Link copied to clipboard
fun noneOf(vararg blocks: ClassesShould.() -> Unit): ClassesRuleBuilder

Asserts that none of the nested assertion blocks are satisfied.

Link copied to clipboard

Asserts that selected classes do not depend on classes residing in packages matching the specified patterns.

Asserts that selected classes do not depend on classes residing in packages matching the specified pattern.

Link copied to clipboard

Asserts that selected classes do not expose types annotated with the specified annotations in their property, function return, or parameter signatures.

Asserts that selected classes do not expose types annotated with the specified annotation in their property, function return, or parameter signatures.

Asserts that selected classes do not expose types annotated with any of the specified annotations in their property, function return, or parameter signatures.

Link copied to clipboard

Asserts that selected classes are accessed only by classes residing in packages matching the specified patterns.

Asserts that selected classes are accessed only by classes residing in packages matching the specified pattern.

Link copied to clipboard

Asserts that selected classes depend only on classes residing in packages matching the specified patterns.

Asserts that selected classes depend only on classes residing in packages matching the specified pattern.

Link copied to clipboard
fun resideInAPackage(vararg packagePatterns: String): ClassesRuleBuilder
infix fun resideInAPackage(packagePatterns: List<String>): ClassesRuleBuilder

Asserts that selected classes reside in packages matching any of the specified patterns. Supports .. segment wildcards.

fun resideInAPackage(description: String, predicate: (String) -> Boolean): ClassesRuleBuilder

Asserts that selected classes reside in packages matching the specified predicate.

infix fun resideInAPackage(packagePattern: String): ClassesRuleBuilder

Asserts that selected classes reside in packages matching the specified pattern. Supports .. segment wildcards.

Link copied to clipboard
infix fun satisfy(description: String): ClassesRuleBuilder

Asserts that selected classes satisfy a custom condition.

Satisfies an arbitrary custom assertion logic with custom violations builder.