Search in sources :

Example 31 with ArchRule

use of com.tngtech.archunit.lang.ArchRule in project taskana by Taskana.

the class SpringArchitectureTest method should_AnnotateAllFieldsWithJsonProperty_When_ImplementingQueryParameter.

@Test
void should_AnnotateAllFieldsWithJsonProperty_When_ImplementingQueryParameter() {
    ArchRule myRule = classes().that().implement(QueryParameter.class).should(shouldOnlyHaveAnnotatedFields());
    myRule.check(importedClasses);
}
Also used : ArchRule(com.tngtech.archunit.lang.ArchRule) QueryParameter(pro.taskana.common.rest.QueryParameter) Test(org.junit.jupiter.api.Test)

Example 32 with ArchRule

use of com.tngtech.archunit.lang.ArchRule in project taskana by Taskana.

the class ArchitectureTest method onlyExceptionsShouldResideInExceptionPackage.

@Test
void onlyExceptionsShouldResideInExceptionPackage() {
    ArchRule myRule = classes().that().resideInAPackage("..exceptions").and().doNotBelongToAnyOf(ErrorCode.class).should().beAssignableTo(Predicates.assignableTo(TaskanaException.class).or(Predicates.assignableTo(TaskanaRuntimeException.class))).andShould().bePublic().andShould().haveSimpleNameEndingWith("Exception");
    myRule.check(importedClasses);
}
Also used : ArchRule(com.tngtech.archunit.lang.ArchRule) TaskanaIntegrationTest(testapi.TaskanaIntegrationTest) Test(org.junit.jupiter.api.Test) DynamicTest(org.junit.jupiter.api.DynamicTest)

Example 33 with ArchRule

use of com.tngtech.archunit.lang.ArchRule in project taskana by Taskana.

the class ArchitectureTest method exceptionsShouldBePlacedInExceptionPackage.

@Test
void exceptionsShouldBePlacedInExceptionPackage() {
    ArchRule myRule = classes().that().haveSimpleNameEndingWith("Exception").should().resideInAPackage("..exceptions..");
    myRule.check(importedClasses);
}
Also used : ArchRule(com.tngtech.archunit.lang.ArchRule) TaskanaIntegrationTest(testapi.TaskanaIntegrationTest) Test(org.junit.jupiter.api.Test) DynamicTest(org.junit.jupiter.api.DynamicTest)

Example 34 with ArchRule

use of com.tngtech.archunit.lang.ArchRule in project taskana by Taskana.

the class ArchitectureTest method mapperClassesShouldNotUseCurrentTimestampSqlFunction.

@Test
void mapperClassesShouldNotUseCurrentTimestampSqlFunction() {
    ArchRule rule = classes().that().haveSimpleNameEndingWith("Mapper").should(notUseCurrentTimestampSqlFunction());
    rule.check(importedClasses);
}
Also used : ArchRule(com.tngtech.archunit.lang.ArchRule) TaskanaIntegrationTest(testapi.TaskanaIntegrationTest) Test(org.junit.jupiter.api.Test) DynamicTest(org.junit.jupiter.api.DynamicTest)

Example 35 with ArchRule

use of com.tngtech.archunit.lang.ArchRule in project taskana by Taskana.

the class ArchitectureTest method apiClassesShouldNotDependOnInternalClasses.

@Test
void apiClassesShouldNotDependOnInternalClasses() {
    ArchRule myRule = classes().that().resideInAPackage("..api..").should().onlyDependOnClassesThat(Predicates.resideOutsideOfPackage("..pro.taskana..internal..").or(Predicates.assignableTo(LoggingAspect.class).or(Predicates.assignableTo(MapCreator.class))));
    myRule.check(importedClasses);
}
Also used : ArchRule(com.tngtech.archunit.lang.ArchRule) LoggingAspect(pro.taskana.common.internal.logging.LoggingAspect) MapCreator(pro.taskana.common.internal.util.MapCreator) TaskanaIntegrationTest(testapi.TaskanaIntegrationTest) Test(org.junit.jupiter.api.Test) DynamicTest(org.junit.jupiter.api.DynamicTest)

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