Because of a recent discussion, I extract my suggestion from this comment into a separate issue.
It would be great to have onlyClasses() as entry point. Rules created with onlyClasses() should fail
if classes that match the that condition, don't match the should condition, and
if classes that don't match the that condition, match the should condition.
Same goes for onlyMethods(), onlyFields(), only(ClassesTransformer) etc.
The current alternative is to write rules "twice":
CompositeArchRule.of(
classes().that().areAnnotatedWith(RestController.class).should().haveSimpleNameEndingWith("RestController")
).and(
classes().that().haveSimpleNameEndingWith("RestController").should().beAnnotatedWith(RestController.class)
).as("only classes that are annotated with @RestController should have simple name ending with 'RestController'")
// vs.
onlyClasses().that().areAnnotatedWith(RestController.class).should().haveSimpleNameEndingWith("RestController")
Because of a recent discussion, I extract my suggestion from this comment into a separate issue.
It would be great to have
onlyClasses()
as entry point. Rules created withonlyClasses()
should failthat
condition, don't match theshould
condition, andthat
condition, match theshould
condition.Same goes for
onlyMethods()
,onlyFields()
,only(ClassesTransformer)
etc.The current alternative is to write rules "twice":