Search in sources :

Example 76 with ArchRule

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

the class ArchitectureTest method classesShouldNotUseJunit5Assertions.

@Test
void classesShouldNotUseJunit5Assertions() {
    ArchRule rule = noClasses().that().haveSimpleNameNotEndingWith("ArchitectureTest").should().dependOnClassesThat().haveFullyQualifiedName(org.junit.jupiter.api.Assertions.class.getName()).because("we consistently want to use assertj in our tests");
    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 77 with ArchRule

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

the class ArchitectureTest method exceptionsThatShouldNotHaveToStringMethod.

@Test
void exceptionsThatShouldNotHaveToStringMethod() {
    ArchRule myRule = classes().that().areAssignableTo(TaskanaException.class).or().areAssignableTo(TaskanaRuntimeException.class).and().doNotBelongToAnyOf(TaskanaRuntimeException.class, TaskanaException.class).should(notImplementToString());
    myRule.check(importedClasses);
}
Also used : ArchRule(com.tngtech.archunit.lang.ArchRule) TaskanaRuntimeException(pro.taskana.common.api.exceptions.TaskanaRuntimeException) TaskanaException(pro.taskana.common.api.exceptions.TaskanaException) TaskanaIntegrationTest(testapi.TaskanaIntegrationTest) Test(org.junit.jupiter.api.Test) DynamicTest(org.junit.jupiter.api.DynamicTest)

Example 78 with ArchRule

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

the class ArchitectureTest method taskanaIntegrationTestsShouldOnlyHavePackagePrivateFields.

@Test
void taskanaIntegrationTestsShouldOnlyHavePackagePrivateFields() {
    ArchRule rule = classes().that().areAnnotatedWith(TaskanaIntegrationTest.class).or(areNestedTaskanaIntegrationTestClasses()).should(onlyHaveFieldsWithNoModifierAndPrivateConstants());
    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 79 with ArchRule

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

the class ArchitectureTest method nestedTaskanaIntegrationTestsShouldBeAnnotatedWithTestInstance.

@Test
void nestedTaskanaIntegrationTestsShouldBeAnnotatedWithTestInstance() {
    ArchRule rule = classes().that(areNestedTaskanaIntegrationTestClasses()).should(beAnnotatedWithTestInstancePerClass());
    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 80 with ArchRule

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

the class EndpointArchitectureComplianceTest method endpointsNeedServiceAnnotation.

@Test
public void endpointsNeedServiceAnnotation() {
    ArchRule rule = classes().that().areNotInterfaces().and().doNotHaveSimpleName("StaticResourcesEndpoint").and().haveNameMatching(".*Endpoint").should().beAnnotatedWith(Service.class);
    rule.check(waltzOnlyClasses);
}
Also used : 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