use of com.tngtech.archunit.core.importer.ClassFileImporter in project ArchUnit by TNG.
the class JavaWildcardTypeTest method importWildcardTypeOf.
private JavaWildcardType importWildcardTypeOf(Class<?> clazz, int typeParameterIndex) {
JavaType listType = new ClassFileImporter().importClass(clazz).getTypeParameters().get(typeParameterIndex).getUpperBounds().get(0);
JavaType wildcardType = ((JavaParameterizedType) listType).getActualTypeArguments().get(0);
return (JavaWildcardType) wildcardType;
}
use of com.tngtech.archunit.core.importer.ClassFileImporter in project jhipster-lite by jhipster.
the class AnnotationArchTest method shouldHaveIntegrationTestAnnotation.
@Test
void shouldHaveIntegrationTestAnnotation() {
JavaClasses importedClasses = new ClassFileImporter().importPackages("tech.jhipster.lite");
ArchRule rule = classes().that().resideInAnyPackage("tech.jhipster.lite..").and().haveSimpleNameEndingWith("IT").should().beAnnotatedWith(IntegrationTest.class).orShould().beAnnotatedWith(Nested.class);
rule.check(importedClasses);
}
use of com.tngtech.archunit.core.importer.ClassFileImporter in project jhipster-lite by jhipster.
the class HexagonalArchTest method primaryShouldNotInteractWithSecondary.
@Test
void primaryShouldNotInteractWithSecondary() {
JavaClasses importedClasses = new ClassFileImporter().withImportOption(ImportOption.Predefined.DO_NOT_INCLUDE_TESTS).importPackages("tech.jhipster.lite");
noClasses().that().resideInAnyPackage("..primary..").should().dependOnClassesThat().resideInAnyPackage("..secondary..").because("Primary should not interact with secondary").check(importedClasses);
}
use of com.tngtech.archunit.core.importer.ClassFileImporter in project jhipster-lite by jhipster.
the class HexagonalArchTest method domainShouldNotInteractWithOutside.
@Test
void domainShouldNotInteractWithOutside() {
JavaClasses importedClasses = new ClassFileImporter().withImportOption(ImportOption.Predefined.DO_NOT_INCLUDE_TESTS).importPackages("tech.jhipster.lite");
noClasses().that().resideInAnyPackage("..domain..").should().dependOnClassesThat().resideInAnyPackage("..application..", "..infrastructure..", "..primary..", "..secondary..").because("Domain should not interact with application, infrastructure, primary or secondary").check(importedClasses);
}
use of com.tngtech.archunit.core.importer.ClassFileImporter in project jhipster-registry by jhipster.
the class ArchTest method servicesAndRepositoriesShouldNotDependOnWebLayer.
@Test
void servicesAndRepositoriesShouldNotDependOnWebLayer() {
JavaClasses importedClasses = new ClassFileImporter().withImportOption(ImportOption.Predefined.DO_NOT_INCLUDE_TESTS).importPackages("io.github.jhipster.registry");
noClasses().that().resideInAnyPackage("io.github.jhipster.registry.service..").or().resideInAnyPackage("io.github.jhipster.registry.repository..").should().dependOnClassesThat().resideInAnyPackage("..io.github.jhipster.registry.web..").because("Services and repositories should not depend on web layer").check(importedClasses);
}
Aggregations