use of com.tngtech.archunit.junit.ArchTest in project jmolecules-integrations by xmolecules.
the class JMoleculesOnionSimpleArchitectureRulesTest method ensureOnionSimple.
@ArchTest
void ensureOnionSimple(JavaClasses types) {
EvaluationResult result = JMoleculesArchitectureRules.ensureOnionSimple().evaluate(types);
//
assertThat(result.getFailureReport().getDetails()).satisfiesExactlyInAnyOrder(//
violation(AppType.class, InfraType.class), //
violation(AppType.class, InfraByAnnotation.class), //
violation(DomainType.class, AppType.class), //
violation(DomainType.class, AppByAnnotation.class), //
violation(DomainType.class, InfraType.class), //
violation(DomainType.class, InfraByAnnotation.class));
}
use of com.tngtech.archunit.junit.ArchTest in project zeebe by zeebe-io.
the class ImmutableProtocolTest method shouldAnnotateImmutableProtocol.
@ArchTest
void shouldAnnotateImmutableProtocol(final JavaClasses importedClasses) {
// given
final ArchRule rule = ArchRuleDefinition.classes().that().areInterfaces().and().resideInAnyPackage("io.camunda.zeebe.protocol.record.value..").or(Predicates.equivalentTo(Record.class)).and(DescribedPredicate.not(getExcludedClasses())).should().beAnnotatedWith(Value.Immutable.class).andShould().beAnnotatedWith(ImmutableProtocol.class).andShould(new BuilderCondition());
// then
rule.check(importedClasses);
}
use of com.tngtech.archunit.junit.ArchTest in project zeebe by zeebe-io.
the class ImmutableProtocolTest method shouldNotAnnotateExcludedClasses.
@ArchTest
void shouldNotAnnotateExcludedClasses(final JavaClasses importedClasses) {
// given
final ArchRule rule = ArchRuleDefinition.classes().that(getExcludedClasses()).should().notBeAnnotatedWith(ImmutableProtocol.class).orShould().notBeAnnotatedWith(Value.Immutable.class);
// then
rule.check(importedClasses);
}
use of com.tngtech.archunit.junit.ArchTest in project jmolecules-integrations by xmolecules.
the class JMoleculesDddRulesUnitTest method detectsViolations.
@ArchTest
void detectsViolations(JavaClasses classes) {
EvaluationResult result = JMoleculesDddRules.all().evaluate(classes);
assertThat(result.getFailureReport().getDetails()).satisfiesExactlyInAnyOrder(violation(SampleAggregate.class, "invalid", OtherEntity.class, OtherAggregate.class), //
violation(SampleAggregate.class, "invalidAggregate", OtherAggregate.class, Association.class), //
violation(SampleAggregate.class, "invalidAggregateInCollection", Collection.class, Association.class), //
violation(SampleAggregate.class, "invalidAggregateInMap", Map.class, Association.class), //
violation(SampleAggregate.class, "invalidAnnotatedAggregate", AnnotatedAggregate.class, Association.class), //
violation(SampleAggregate.class, "invalidInCollection", Collection.class, OtherAggregate.class), //
violation(SampleAggregate.class, "invalidInMap", Map.class, OtherAggregate.class), violation("Type.*%s.*%s.*", AnnotatedAggregate.class.getSimpleName(), Identity.class.getName()));
}
use of com.tngtech.archunit.junit.ArchTest in project jmolecules-integrations by xmolecules.
the class JMoleculesLayeredRulesTest method ensureStrictLayering.
@ArchTest
void ensureStrictLayering(JavaClasses types) {
EvaluationResult result = JMoleculesArchitectureRules.ensureLayeringStrict().evaluate(types);
assertThat(result.getFailureReport().getDetails()).satisfiesExactlyInAnyOrder(//
violation(AppType.class, InfraType.class), //
violation(AppType.class, InfraByAnnotation.class), //
violation(AppType.class, UiType.class), //
violation(AppType.class, UiByAnnotation.class), //
violation(DomainType.class, AppType.class), //
violation(DomainType.class, AppByAnnotation.class), //
violation(DomainType.class, UiType.class), //
violation(DomainType.class, UiByAnnotation.class), //
violation(InfraType.class, DomainType.class), //
violation(InfraType.class, DomainByAnnotation.class), //
violation(InfraType.class, AppType.class), //
violation(InfraType.class, AppByAnnotation.class), //
violation(InfraType.class, UiType.class), //
violation(InfraType.class, UiByAnnotation.class), //
violation(UiType.class, DomainType.class), //
violation(UiType.class, DomainByAnnotation.class), //
violation(UiType.class, InfraType.class), //
violation(UiType.class, InfraByAnnotation.class));
}
Aggregations