KatachiKonsistNoExpectationException

A konsist { } block that asked for nothing.

A block that queries Konsist and never ends the query with KonsistScope.must, KonsistScope.mustNot or KonsistScope.mustBeEmpty rejects nothing, which is indistinguishable from a rule everything satisfies. Since this backend can count its own expectations, it says so instead of returning a green answer nobody asked for.

Example 1: catch a block that forgot to say what it wants

val failure = shouldThrow<KatachiArchitectureAssertionError> {
projectArchitecture.assert(FileConstraintCheck())
}
failure.violations.filterIsInstance<UncheckedFileConstraint>()
.single().cause.shouldBeInstanceOf<KatachiKonsistNoExpectationException>()

Properties

Link copied to clipboard
open val cause: Throwable?
Link copied to clipboard

What the constraint was called, or null when it was declared without a name.

Link copied to clipboard

Where the constraint was written.

Link copied to clipboard
open val message: String?
Link copied to clipboard

The qualified name of the role whose layout the constraint was written in.