assertTrue
Deprecated (with error)
katachi cannot see which declarations assertTrue rejected. Use must / mustNot / mustBeEmpty.
Replace with
must(function)Konsist's own assertion over a list. Not usable here.
It throws on the first rejection and describes it in prose, so katachi could not say which declarations were rejected — and the first line of a report block is a path a reader can open.
Example 1: what to write instead
classes().assertTrue { it.hasInternalModifier } // compile error
classes().must { it.hasInternalModifier } // okDeprecated (with error)
katachi cannot see which declaration assertTrue rejected. Use must / mustNot / mustBeEmpty.
Replace with
listOfNotNull(this).must(function)Konsist's own assertion over a single declaration. Not usable here — see assertTrue.
Example 1: what to write instead
classes().first().assertTrue { it.hasInternalModifier } // compile error
classes().take(1).must { it.hasInternalModifier } // okDeprecated (with error)
katachi cannot see which declarations assertTrue rejected. Use toList() then must / mustNot.
Replace with
toList().must(function)Konsist's own assertion over a sequence. Not usable here — see assertTrue.
There is no sequence form of must either: a constraint holds every rejection at once so that it can report them in walk order, so end the query with .toList().
Example 1: what to write instead
classes().asSequence().assertTrue { it.hasInternalModifier } // compile error
classes().asSequence().toList().must { it.hasInternalModifier } // ok