Search in sources :

Example 16 with JavaClasses

use of com.tngtech.archunit.core.domain.JavaClasses in project hazelcast by hazelcast.

the class CsvSerializableTest method serializable_classes_should_have_valid_serialVersionUID.

@Test
public void serializable_classes_should_have_valid_serialVersionUID() {
    String basePackage = CsvReadFileFnProvider.class.getPackage().getName();
    JavaClasses classes = new ClassFileImporter().withImportOption(onlyCurrentModule()).importPackages(basePackage);
    ArchUnitRules.SERIALIZABLE_SHOULD_HAVE_VALID_SERIAL_VERSION_UID.check(classes);
}
Also used : JavaClasses(com.tngtech.archunit.core.domain.JavaClasses) CsvReadFileFnProvider(com.hazelcast.jet.csv.impl.CsvReadFileFnProvider) ClassFileImporter(com.tngtech.archunit.core.importer.ClassFileImporter) ParallelJVMTest(com.hazelcast.test.annotation.ParallelJVMTest) Test(org.junit.Test)

Example 17 with JavaClasses

use of com.tngtech.archunit.core.domain.JavaClasses in project hazelcast by hazelcast.

the class CdcDebeziumSerializableTest method serializable_classes_should_have_valid_serialVersionUID.

@Test
public void serializable_classes_should_have_valid_serialVersionUID() {
    String basePackage = DebeziumCdcSources.class.getPackage().getName();
    JavaClasses classes = new ClassFileImporter().withImportOption(onlyCurrentModule()).importPackages(basePackage);
    ArchUnitRules.SERIALIZABLE_SHOULD_HAVE_VALID_SERIAL_VERSION_UID.check(classes);
}
Also used : JavaClasses(com.tngtech.archunit.core.domain.JavaClasses) ClassFileImporter(com.tngtech.archunit.core.importer.ClassFileImporter) ParallelJVMTest(com.hazelcast.test.annotation.ParallelJVMTest) Test(org.junit.Test)

Example 18 with JavaClasses

use of com.tngtech.archunit.core.domain.JavaClasses in project ArchUnit by TNG.

the class ArchUnitRunner method runChild.

@Override
protected void runChild(ArchTestExecution child, RunNotifier notifier) {
    if (child.ignore()) {
        notifier.fireTestIgnored(describeChild(child));
    } else {
        notifier.fireTestStarted(describeChild(child));
        Class<?> testClass = getTestClass().getJavaClass();
        JavaClasses classes = cache.get().getClassesToAnalyzeFor(testClass, new JUnit4ClassAnalysisRequest(testClass));
        child.evaluateOn(classes).notify(notifier);
        notifier.fireTestFinished(describeChild(child));
    }
}
Also used : JavaClasses(com.tngtech.archunit.core.domain.JavaClasses)

Example 19 with JavaClasses

use of com.tngtech.archunit.core.domain.JavaClasses in project ArchUnit by TNG.

the class ClassCacheTest method get_all_classes_by_LocationProvider.

@Test
public void get_all_classes_by_LocationProvider() {
    JavaClasses classes = cache.getClassesToAnalyzeFor(TestClass.class, new TestAnalysisRequest().withPackagesRoots(ClassCacheTest.class).withLocationProviders(TestLocationProviderOfClass_String.class, TestLocationProviderOfClass_Rule.class));
    assertThatTypes(classes).contain(String.class, Rule.class, getClass());
    classes = cache.getClassesToAnalyzeFor(TestClassWithLocationProviderUsingTestClass.class, analyzeLocation(LocationOfClass.Provider.class));
    assertThatTypes(classes).contain(String.class);
    assertThatTypes(classes).doNotContain(getClass());
}
Also used : JavaClasses(com.tngtech.archunit.core.domain.JavaClasses) Test(org.junit.Test)

Example 20 with JavaClasses

use of com.tngtech.archunit.core.domain.JavaClasses in project ArchUnit by TNG.

the class ClassCacheTest method filters_urls.

@Test
public void filters_urls() {
    JavaClasses classes = cache.getClassesToAnalyzeFor(TestClass.class, new TestAnalysisRequest().withImportOptions(TestFilterForJUnitJars.class));
    assertThat(classes).isNotEmpty();
    for (JavaClass clazz : classes) {
        assertThat(clazz.getPackageName()).doesNotContain("tngtech");
        assertThat(clazz.getPackageName()).contains("junit");
    }
}
Also used : JavaClasses(com.tngtech.archunit.core.domain.JavaClasses) JavaClass(com.tngtech.archunit.core.domain.JavaClass) Test(org.junit.Test)

Aggregations

JavaClasses (com.tngtech.archunit.core.domain.JavaClasses)248 Test (org.junit.Test)184 ClassFileImporter (com.tngtech.archunit.core.importer.ClassFileImporter)98 JavaClass (com.tngtech.archunit.core.domain.JavaClass)72 Test (org.junit.jupiter.api.Test)54 JavaMethodCall (com.tngtech.archunit.core.domain.JavaMethodCall)19 ArchRule (com.tngtech.archunit.lang.ArchRule)19 UseDataProvider (com.tngtech.java.junit.dataprovider.UseDataProvider)19 JavaFieldAccess (com.tngtech.archunit.core.domain.JavaFieldAccess)16 ParallelJVMTest (com.hazelcast.test.annotation.ParallelJVMTest)15 JavaMethod (com.tngtech.archunit.core.domain.JavaMethod)15 MethodCallTarget (com.tngtech.archunit.core.domain.AccessTarget.MethodCallTarget)14 EvaluationResult (com.tngtech.archunit.lang.EvaluationResult)13 Workspace (com.structurizr.Workspace)12 JavaConstructorCall (com.tngtech.archunit.core.domain.JavaConstructorCall)12 Set (java.util.Set)12 Application (org.archifacts.core.model.Application)12 Component (com.structurizr.model.Component)10 Container (com.structurizr.model.Container)10 ArtifactContainer (org.archifacts.core.model.ArtifactContainer)10