Search in sources :

Example 6 with ArchTest

use of com.tngtech.archunit.junit.ArchTest in project jmolecules-integrations by xmolecules.

the class JMoleculesLayeredRulesTest method ensureLayering.

@ArchTest
void ensureLayering(JavaClasses types) {
    EvaluationResult result = JMoleculesArchitectureRules.ensureLayering().evaluate(types);
    // 
    assertThat(result.getFailureReport().getDetails()).satisfiesExactlyInAnyOrder(// 
    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));
}
Also used : AppByAnnotation(org.jmolecules.archunit.layered.AppByAnnotation) UiByAnnotation(org.jmolecules.archunit.layered.UiByAnnotation) DomainType(org.jmolecules.archunit.layered.domain.DomainType) UiType(org.jmolecules.archunit.layered.ui.UiType) DomainByAnnotation(org.jmolecules.archunit.layered.DomainByAnnotation) AppType(org.jmolecules.archunit.layered.app.AppType) InfraType(org.jmolecules.archunit.layered.infra.InfraType) EvaluationResult(com.tngtech.archunit.lang.EvaluationResult) ArchTest(com.tngtech.archunit.junit.ArchTest)

Example 7 with ArchTest

use of com.tngtech.archunit.junit.ArchTest in project jmolecules-integrations by xmolecules.

the class JMoleculesOnionClassicalArchitectureRulesTest method ensureOnionClasical.

@ArchTest
void ensureOnionClasical(JavaClasses types) {
    EvaluationResult result = JMoleculesArchitectureRules.ensureOnionClassical().evaluate(types);
    // 
    assertThat(result.getFailureReport().getDetails()).satisfiesExactlyInAnyOrder(// 
    violation(AppType.class, InfraType.class), // 
    violation(AppType.class, InfraByAnnotation.class), // 
    violation(DomainServiceType.class, AppType.class), // 
    violation(DomainServiceType.class, AppServiceByAnnotation.class), // 
    violation(DomainServiceType.class, InfraType.class), // 
    violation(DomainServiceType.class, InfraByAnnotation.class), // 
    violation(DomainModelType.class, AppType.class), // 
    violation(DomainModelType.class, AppServiceByAnnotation.class), // 
    violation(DomainModelType.class, InfraType.class), // 
    violation(DomainModelType.class, InfraByAnnotation.class), // 
    violation(DomainModelType.class, DomainServiceType.class), // 
    violation(DomainModelType.class, DomainServiceByAnnotation.class));
}
Also used : DomainServiceType(org.jmolecules.archunit.onion.classical.domainservice.DomainServiceType) InfraByAnnotation(org.jmolecules.archunit.onion.classical.InfraByAnnotation) AppServiceByAnnotation(org.jmolecules.archunit.onion.classical.AppServiceByAnnotation) DomainServiceByAnnotation(org.jmolecules.archunit.onion.classical.DomainServiceByAnnotation) AppType(org.jmolecules.archunit.onion.classical.app.AppType) InfraType(org.jmolecules.archunit.onion.classical.infra.InfraType) DomainModelType(org.jmolecules.archunit.onion.classical.domainmodel.DomainModelType) EvaluationResult(com.tngtech.archunit.lang.EvaluationResult) ArchTest(com.tngtech.archunit.junit.ArchTest)

Example 8 with ArchTest

use of com.tngtech.archunit.junit.ArchTest in project zeebe by camunda-cloud.

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);
}
Also used : ArchRule(com.tngtech.archunit.lang.ArchRule) Record(io.camunda.zeebe.protocol.record.Record) ImmutableProtocol(io.camunda.zeebe.protocol.record.ImmutableProtocol) ArchTest(com.tngtech.archunit.junit.ArchTest)

Example 9 with ArchTest

use of com.tngtech.archunit.junit.ArchTest in project zeebe by camunda-cloud.

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);
}
Also used : ArchRule(com.tngtech.archunit.lang.ArchRule) Value(org.immutables.value.Value) ArchTest(com.tngtech.archunit.junit.ArchTest)

Aggregations

ArchTest (com.tngtech.archunit.junit.ArchTest)9 EvaluationResult (com.tngtech.archunit.lang.EvaluationResult)5 ArchRule (com.tngtech.archunit.lang.ArchRule)4 ImmutableProtocol (io.camunda.zeebe.protocol.record.ImmutableProtocol)2 Record (io.camunda.zeebe.protocol.record.Record)2 Value (org.immutables.value.Value)2 AppByAnnotation (org.jmolecules.archunit.layered.AppByAnnotation)2 DomainByAnnotation (org.jmolecules.archunit.layered.DomainByAnnotation)2 UiByAnnotation (org.jmolecules.archunit.layered.UiByAnnotation)2 AppType (org.jmolecules.archunit.layered.app.AppType)2 DomainType (org.jmolecules.archunit.layered.domain.DomainType)2 InfraType (org.jmolecules.archunit.layered.infra.InfraType)2 UiType (org.jmolecules.archunit.layered.ui.UiType)2 Collection (java.util.Collection)1 Map (java.util.Map)1 InfraByAnnotation (org.jmolecules.archunit.layered.InfraByAnnotation)1 AppServiceByAnnotation (org.jmolecules.archunit.onion.classical.AppServiceByAnnotation)1 DomainServiceByAnnotation (org.jmolecules.archunit.onion.classical.DomainServiceByAnnotation)1 InfraByAnnotation (org.jmolecules.archunit.onion.classical.InfraByAnnotation)1 AppType (org.jmolecules.archunit.onion.classical.app.AppType)1