use of com.tngtech.archunit.lang.EvaluationResult in project ArchUnit by TNG.
the class ViolationHandlingTest method constructor_calls_are_handled.
@Test
public void constructor_calls_are_handled() {
EvaluationResult result = noClasses().should().accessClassesThat().haveFullyQualifiedName(Target.class.getName()).evaluate(importClasses(Origin.class, Target.class));
ConstructorCallRecorder constructorCallRecorder = new ConstructorCallRecorder();
result.handleViolations(constructorCallRecorder);
assertThatAccesses(constructorCallRecorder.getAccesses()).containOnly(expectedAccess().from(Origin.class, "callConstructor").toConstructor(Target.class), expectedAccess().from(Origin.class, "callConstructor").toConstructor(Target.class, String.class));
}
use of com.tngtech.archunit.lang.EvaluationResult 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.lang.EvaluationResult 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));
}
use of com.tngtech.archunit.lang.EvaluationResult 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));
}
use of com.tngtech.archunit.lang.EvaluationResult 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));
}
Aggregations