Search in sources :

Example 81 with ArchRule

use of com.tngtech.archunit.lang.ArchRule in project waltz by khartec.

the class EndpointArchitectureComplianceTest method extractorsImplementDataExtractor.

@Test
public void extractorsImplementDataExtractor() {
    ArchRule rule = classes().that().haveNameMatching(".*Extractor").and().areNotInterfaces().should().implement(DataExtractor.class);
    rule.check(waltzOnlyClasses);
}
Also used : ArchRule(com.tngtech.archunit.lang.ArchRule) Test(org.junit.jupiter.api.Test)

Example 82 with ArchRule

use of com.tngtech.archunit.lang.ArchRule in project waltz by khartec.

the class EndpointArchitectureComplianceTest method endpointsNeedMarkerInterface.

@Test
public void endpointsNeedMarkerInterface() {
    ArchRule rule = classes().that().areNotInterfaces().and().haveNameMatching(".*Endpoint").should().implement(Endpoint.class);
    rule.check(waltzOnlyClasses);
}
Also used : ArchRule(com.tngtech.archunit.lang.ArchRule) Test(org.junit.jupiter.api.Test)

Example 83 with ArchRule

use of com.tngtech.archunit.lang.ArchRule in project waltz by khartec.

the class ServicesArchitectureComplianceTest method servicesNeedServiceAnnotation.

@Test
public void servicesNeedServiceAnnotation() {
    ArchRule rule = classes().that().areNotInterfaces().and().haveNameMatching(".*Service").should().beAnnotatedWith(Service.class);
    rule.check(waltzOnlyClasses);
}
Also used : ArchRule(com.tngtech.archunit.lang.ArchRule) Test(org.junit.jupiter.api.Test)

Example 84 with ArchRule

use of com.tngtech.archunit.lang.ArchRule in project waltz by khartec.

the class ServicesArchitectureComplianceTest method methodsPrefixedFindShouldReturnCollections.

@Test
public void methodsPrefixedFindShouldReturnCollections() {
    ArchRule rule = classes().that().areNotInterfaces().and().haveNameMatching(".*Service").should(haveFindMethodsThatReturnCollectionsOrMapsOrOptionals);
    rule.check(waltzAndJavaUtilClasses);
}
Also used : ArchRule(com.tngtech.archunit.lang.ArchRule) Test(org.junit.jupiter.api.Test)

Example 85 with ArchRule

use of com.tngtech.archunit.lang.ArchRule 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)

Aggregations

ArchRule (com.tngtech.archunit.lang.ArchRule)141 Test (org.junit.jupiter.api.Test)90 Test (org.junit.Test)37 ArchTest (com.tngtech.archunit.junit.ArchTest)19 CompositeArchRule (com.tngtech.archunit.lang.CompositeArchRule)19 JavaClasses (com.tngtech.archunit.core.domain.JavaClasses)18 UseDataProvider (com.tngtech.java.junit.dataprovider.UseDataProvider)13 ClassFileImporter (com.tngtech.archunit.core.importer.ClassFileImporter)12 DynamicTest (org.junit.jupiter.api.DynamicTest)12 TaskanaIntegrationTest (testapi.TaskanaIntegrationTest)12 EvaluationResult (com.tngtech.archunit.lang.EvaluationResult)6 JavaClass (com.tngtech.archunit.core.domain.JavaClass)5 Immutable (org.eclipse.sirius.components.annotations.Immutable)5 ArchConfiguration (com.tngtech.archunit.ArchConfiguration)4 JavaField (com.tngtech.archunit.core.domain.JavaField)4 CanBeAnnotatedTest (com.tngtech.archunit.core.domain.properties.CanBeAnnotatedTest)4 ArchCondition (com.tngtech.archunit.lang.ArchCondition)3 ClassViolatingCodingRules (com.tngtech.archunit.example.layers.ClassViolatingCodingRules)2 ImmutableProtocol (io.camunda.zeebe.protocol.record.ImmutableProtocol)2 Record (io.camunda.zeebe.protocol.record.Record)2