use of com.tngtech.archunit.lang.ArchRule in project AngularPortfolioMgr by Angular2Guy.
the class MyArchitectureTests method ruleCronJobMethodsAnnotations.
@Test
public void ruleCronJobMethodsAnnotations() {
ArchRule exceptionType = ArchRuleDefinition.methods().that().arePublic().and().areDeclaredInClassesThat().resideInAPackage("..adapter.cron..").should().beAnnotatedWith(Scheduled.class).andShould().beAnnotatedWith(SchedulerLock.class).orShould().beAnnotatedWith(PostConstruct.class);
exceptionType.check(this.importedClasses);
}
use of com.tngtech.archunit.lang.ArchRule in project AngularPortfolioMgr 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 AngularPortfolioMgr by Angular2Guy.
the class MyArchitectureTests method ruleGeneralCodingRules.
@Test
public void ruleGeneralCodingRules() {
ArchRule archRule = CompositeArchRule.of(GeneralCodingRules.NO_CLASSES_SHOULD_ACCESS_STANDARD_STREAMS).and(NO_CLASSES_SHOULD_USE_FIELD_INJECTION).because("Good practice");
JavaClasses classesToCheck = this.importedClasses.that(JavaClass.Predicates.resideOutsideOfPackages("..adapter.clients.test.."));
archRule.check(classesToCheck);
}
use of com.tngtech.archunit.lang.ArchRule in project AngularPortfolioMgr by Angular2Guy.
the class MyArchitectureTests method ruleControllerAnnotations.
@Test
public void ruleControllerAnnotations() {
List.of("..adapter.controller..", "..dev.adapter.controller..", "..prod.adapter.controller..").forEach(myPackage -> {
ArchRule beAnnotatedWith = ArchRuleDefinition.classes().that().resideInAPackage("..adapter.controller..").should().beAnnotatedWith(RestController.class).orShould().beAnnotatedWith(Configuration.class);
beAnnotatedWith.check(this.importedClasses);
});
}
use of com.tngtech.archunit.lang.ArchRule in project AngularAndSpring by Angular2Guy.
the class MyArchitectureTests method ruleGeneralCodingRules.
@Test
public void ruleGeneralCodingRules() {
ArchRule archRule = CompositeArchRule.of(GeneralCodingRules.NO_CLASSES_SHOULD_ACCESS_STANDARD_STREAMS).and(NO_CLASSES_SHOULD_USE_FIELD_INJECTION).because("Good practice");
JavaClasses classesToCheck = this.importedClasses.that(JavaClass.Predicates.resideOutsideOfPackages("..adapter.clients.test.."));
archRule.check(classesToCheck);
}
Aggregations