Search in sources :

Example 21 with ArchRule

use of com.tngtech.archunit.lang.ArchRule in project sirius-components by eclipse-sirius.

the class AbstractCodingRulesTests method noClassesShouldUseGuava.

@Test
public void noClassesShouldUseGuava() {
    // @formatter:off
    ArchRule rule = ArchRuleDefinition.noClasses().that().resideInAPackage(this.getProjectRootPackage()).should().dependOnClassesThat().resideInAnyPackage(GUAVA_ANNOTATIONS, GUAVA_BASE, GUAVA_COLLECT, GUAVA_ESCAPE, GUAVA_EVENTBUS, GUAVA_HASH, GUAVA_HTML, GUAVA_IO, GUAVA_MATH, GUAVA_NET, GUAVA_PRIMITIVES, GUAVA_REFLECT, GUAVA_UTIL, GUAVA_XML, GUAVA_THIRDPARTY);
    // @formatter:on
    rule.check(this.getClasses());
}
Also used : ArchRule(com.tngtech.archunit.lang.ArchRule) Test(org.junit.jupiter.api.Test)

Example 22 with ArchRule

use of com.tngtech.archunit.lang.ArchRule in project sirius-components by eclipse-sirius.

the class AbstractCodingRulesTests method noClassesShouldUseJavaLogging.

@Test
public void noClassesShouldUseJavaLogging() {
    // @formatter:off
    ArchRule rule = ArchRuleDefinition.noClasses().that().resideInAPackage(this.getProjectRootPackage()).should(GeneralCodingRules.USE_JAVA_UTIL_LOGGING);
    // @formatter:on
    rule.check(this.getClasses());
}
Also used : ArchRule(com.tngtech.archunit.lang.ArchRule) Test(org.junit.jupiter.api.Test)

Example 23 with ArchRule

use of com.tngtech.archunit.lang.ArchRule in project sirius-components by eclipse-sirius.

the class AbstractCodingRulesTests method noClassesShouldUseSpringStringUtils.

@Test
public void noClassesShouldUseSpringStringUtils() {
    // @formatter:off
    ArchRule rule = ArchRuleDefinition.noClasses().that().resideInAPackage(this.getProjectRootPackage()).should().dependOnClassesThat().areAssignableTo(SPRING_STRINGUTILS);
    // @formatter:on
    rule.check(this.getClasses());
}
Also used : ArchRule(com.tngtech.archunit.lang.ArchRule) Test(org.junit.jupiter.api.Test)

Example 24 with ArchRule

use of com.tngtech.archunit.lang.ArchRule in project sirius-components by eclipse-sirius.

the class AbstractImmutableTests method immutableClassesShouldHaveABuilderMethod.

@Test
public void immutableClassesShouldHaveABuilderMethod() {
    // @formatter:off
    ArchRule rule = ArchRuleDefinition.classes().that().resideInAPackage(this.getProjectRootPackage()).and().areAnnotatedWith(Immutable.class).should(this.haveABuilderMethod());
    // @formatter:on
    rule.check(this.getClasses());
}
Also used : Immutable(org.eclipse.sirius.components.annotations.Immutable) ArchRule(com.tngtech.archunit.lang.ArchRule) Test(org.junit.jupiter.api.Test)

Example 25 with ArchRule

use of com.tngtech.archunit.lang.ArchRule in project sirius-components by eclipse-sirius.

the class AbstractImmutableTests method immutableClassesShouldHaveANestedBuilder.

@Test
public void immutableClassesShouldHaveANestedBuilder() {
    // @formatter:off
    ArchRule rule = ArchRuleDefinition.classes().that().resideInAPackage(this.getProjectRootPackage()).and().areAnnotatedWith(Immutable.class).should(new HaveAValidBuilderCondition(this.getClasses()));
    // @formatter:on
    rule.check(this.getClasses());
}
Also used : Immutable(org.eclipse.sirius.components.annotations.Immutable) ArchRule(com.tngtech.archunit.lang.ArchRule) Test(org.junit.jupiter.api.Test)

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