use of com.tngtech.archunit.lang.ArchRule in project sirius-web by eclipse-sirius.
the class CodingRulesTests method classesImplementingInputShouldBeFinal.
@Test
public void classesImplementingInputShouldBeFinal() {
// @formatter:off
ArchRule rule = ArchRuleDefinition.classes().that().areAssignableTo(IInput.class).and().areNotInterfaces().should().haveModifier(JavaModifier.FINAL);
// @formatter:on
rule.check(this.getClasses());
}
use of com.tngtech.archunit.lang.ArchRule in project sirius-web by eclipse-sirius.
the class RepositoryTests method repositoriesShouldBeNamedRepository.
@Test
public void repositoriesShouldBeNamedRepository() {
// @formatter:off
ArchRule rule = ArchRuleDefinition.classes().that().resideInAPackage(ArchitectureConstants.SIRIUS_WEB_PERSISTENCE_ROOT_PACKAGE).and().areAssignableTo(Repository.class).should().haveSimpleNameEndingWith(REPOSITORY_SUFFIX);
// @formatter:on
rule.check(ArchitectureConstants.CLASSES);
}
use of com.tngtech.archunit.lang.ArchRule in project sirius-web by eclipse-sirius.
the class RepositoryTests method repositoriesShouldBeAnnotatedWithRepository.
@Test
public void repositoriesShouldBeAnnotatedWithRepository() {
// @formatter:off
ArchRule rule = ArchRuleDefinition.classes().that().resideInAPackage(ArchitectureConstants.SIRIUS_WEB_PERSISTENCE_ROOT_PACKAGE).and().areAssignableTo(Repository.class).should().beAnnotatedWith(org.springframework.stereotype.Repository.class);
// @formatter:on
rule.check(ArchitectureConstants.CLASSES);
}
use of com.tngtech.archunit.lang.ArchRule in project sirius-web by eclipse-sirius.
the class RepositoryTests method onlyRepositoriesShouldBeInARepositoryPackage.
@Test
public void onlyRepositoriesShouldBeInARepositoryPackage() {
// @formatter:off
ArchRule rule = ArchRuleDefinition.classes().that().resideInAPackage(ArchitectureConstants.SIRIUS_WEB_PERSISTENCE_ROOT_PACKAGE).and().resideInAPackage(REPOSITORIES_PACKAGE).and().haveSimpleNameNotContaining(TEST).should().beAssignableTo(Repository.class);
// @formatter:on
rule.check(ArchitectureConstants.CLASSES);
}
use of com.tngtech.archunit.lang.ArchRule in project micrometer by micrometer-metrics.
the class JvmGcMetricsTest method noJvmImplementationSpecificApiSignatures.
@Test
void noJvmImplementationSpecificApiSignatures() {
JavaClasses importedClasses = new ClassFileImporter().importPackages("io.micrometer.core.instrument.binder.jvm");
ArchRule noSunManagementInMethodSignatures = methods().should().notHaveRawReturnType(resideInAPackage("com.sun.management..")).andShould().notHaveRawParameterTypes(DescribedPredicate.anyElementThat(resideInAPackage("com.sun.management..")));
noSunManagementInMethodSignatures.check(importedClasses);
}
Aggregations