Search in sources :

Example 1 with BaseClass

use of com.tngtech.archunit.core.importer.testexamples.classhierarchyimport.BaseClass in project ArchUnit by TNG.

the class ClassFileImporterTest method imports_base_class_in_class_hierarchy_correctly.

@Test
public void imports_base_class_in_class_hierarchy_correctly() {
    JavaClass baseClass = new ClassFileImporter().importUrl(getClass().getResource("testexamples/classhierarchyimport")).get(BaseClass.class);
    assertThat(baseClass.getConstructors()).as("Constructors of " + BaseClass.class.getSimpleName()).hasSize(2);
    assertThat(baseClass.getFields()).as("Fields of " + BaseClass.class.getSimpleName()).hasSize(1);
    assertThat(baseClass.getMethods()).as("Methods of " + BaseClass.class.getSimpleName()).hasSize(2);
    assertThat(baseClass.getStaticInitializer().get().getMethodCallsFromSelf()).as("Calls from %s.<clinit>()", BaseClass.class.getSimpleName()).isNotEmpty();
}
Also used : JavaClass(com.tngtech.archunit.core.domain.JavaClass) BaseClass(com.tngtech.archunit.core.importer.testexamples.classhierarchyimport.BaseClass) Test(org.junit.Test)

Aggregations

JavaClass (com.tngtech.archunit.core.domain.JavaClass)1 BaseClass (com.tngtech.archunit.core.importer.testexamples.classhierarchyimport.BaseClass)1 Test (org.junit.Test)1