use of com.tngtech.archunit.lang.ArchRule in project AngularAndSpring by Angular2Guy.
the class MyArchitectureTests method ruleExceptionsType.
@Test
public void ruleExceptionsType() {
ArchRule exceptionType = ArchRuleDefinition.classes().that().resideInAPackage("..domain.exceptions..").should().beAssignableTo(RuntimeException.class).orShould().beAssignableTo(DefaultErrorAttributes.class);
exceptionType.check(this.importedClasses);
}
use of com.tngtech.archunit.lang.ArchRule in project lnd-manageJ by C-Otto.
the class ArchUnitIT method daos_are_transactional.
@Test
void daos_are_transactional() {
ArchRule rule = ArchRuleDefinition.classes().that().haveSimpleNameEndingWith("DaoImpl").should().beAnnotatedWith("javax.transaction.Transactional").orShould().beAnnotatedWith("org.springframework.transaction.annotation.Transactional");
// https://stackoverflow.com/q/26387399/947526
rule.check(importedClasses);
}
use of com.tngtech.archunit.lang.ArchRule in project lnd-manageJ by C-Otto.
the class ArchUnitIT method services_must_not_access_spring_data_repositories_directly.
@Test
void services_must_not_access_spring_data_repositories_directly() {
ArchRule rule = ArchRuleDefinition.noClasses().that().areAssignableTo("org.springframework.data.repository.Repository").should().dependOnClassesThat().haveSimpleNameEndingWith("Service");
rule.check(importedClasses);
}
use of com.tngtech.archunit.lang.ArchRule in project lnd-manageJ by C-Otto.
the class ArchUnitIT method public_controller_methods_are_timed.
@Test
void public_controller_methods_are_timed() {
ArchRule rule = ArchRuleDefinition.methods().that().areDeclaredInClassesThat().areAnnotatedWith(RequestMapping.class).and().arePublic().should().beAnnotatedWith(Timed.class);
assertThat(importedClasses).isNotEmpty();
rule.check(importedClasses);
}
use of com.tngtech.archunit.lang.ArchRule in project waltz by finos.
the class EndpointArchitectureComplianceTest method extractorsNeedServiceAnnotation.
@Test
public void extractorsNeedServiceAnnotation() {
ArchRule rule = classes().that().areAssignableTo(DataExtractor.class).and().doNotHaveModifier(ABSTRACT).and().doNotHaveSimpleName("DataExtractor").should().haveNameMatching(".*Extractor").andShould().beAnnotatedWith(Service.class);
rule.check(waltzOnlyClasses);
}
Aggregations