use of com.tngtech.archunit.lang.ArchRule in project zeebe by camunda-cloud.
the class ImmutableProtocolTest method shouldNotAnnotateExcludedClasses.
@ArchTest
void shouldNotAnnotateExcludedClasses(final JavaClasses importedClasses) {
// given
final ArchRule rule = ArchRuleDefinition.classes().that(getExcludedClasses()).should().notBeAnnotatedWith(ImmutableProtocol.class).orShould().notBeAnnotatedWith(Value.Immutable.class);
// then
rule.check(importedClasses);
}
use of com.tngtech.archunit.lang.ArchRule in project jhipster-lite by jhipster.
the class AnnotationArchTest method shouldHaveUnitTestAnnotation.
@Test
void shouldHaveUnitTestAnnotation() {
JavaClasses importedClasses = new ClassFileImporter().importPackages("tech.jhipster.lite").that(are(not(equivalentTo(UnitTest.class)).and(not(equivalentTo(IntegrationTest.class)))));
ArchRule rule = classes().that().resideInAnyPackage("tech.jhipster.lite..").and().haveSimpleNameEndingWith("Test").should().beAnnotatedWith(UnitTest.class).orShould().beAnnotatedWith(ComponentTest.class).orShould().beAnnotatedWith(Nested.class).orShould().beInterfaces();
rule.check(importedClasses);
}
use of com.tngtech.archunit.lang.ArchRule in project jhipster-lite by jhipster.
the class AnnotationArchTest method shouldHaveGeneratorStepAnnotationInResources.
@Test
void shouldHaveGeneratorStepAnnotationInResources() {
JavaClasses importedClasses = new ClassFileImporter().importPackages("tech.jhipster.lite");
ArchRule rule = methods().that().areDeclaredInClassesThat().resideInAnyPackage("tech.jhipster.lite.generator..").and().areDeclaredInClassesThat().areAnnotatedWith(RestController.class).and().areAnnotatedWith(PostMapping.class).should().beAnnotatedWith(GeneratorStep.class);
rule.check(importedClasses);
}
use of com.tngtech.archunit.lang.ArchRule in project ArchUnit by TNG.
the class SecurityTest method only_security_infrastructure_should_use_java_security_on_whole_classpath.
@Test
public void only_security_infrastructure_should_use_java_security_on_whole_classpath() {
ArchRule rule = classes().that().resideInAPackage("java.security.cert..").should().onlyBeAccessed().byAnyPackage("..example.layers.security..", "java..", "..sun..", "javax..", "apple.security..", "org.jcp..");
JavaClasses classes = new ClassFileImporter().importClasspath(onlyAppAndRuntime());
rule.check(classes);
}
use of com.tngtech.archunit.lang.ArchRule in project ArchUnit by TNG.
the class SecurityTest method only_security_infrastructure_should_use_java_security.
@Test
public void only_security_infrastructure_should_use_java_security() {
ArchRule rule = classes().that().resideInAPackage("java.security..").should().onlyBeAccessed().byAnyPackage("..example.layers.security..", "java.security..").because("we want to have one isolated cross-cutting concern 'security'");
JavaClasses classes = new ClassFileImporter().importPackages("com.tngtech.archunit.example.layers", "java.security");
rule.check(classes);
}
Aggregations