use of com.tngtech.archunit.library.metrics.testobjects.lakos.pkg2.SomeTestClass2 in project ArchUnit by TNG.
the class MetricsComponentsTest method creates_components_from_Java_classes.
@Test
public void creates_components_from_Java_classes() {
JavaClasses classes = new ClassFileImporter().importPackagesOf(SomeTestClass1.class, SomeTestClass2.class);
MetricsComponents<JavaClass> components = MetricsComponents.fromClasses(classes);
assertThat(components).as("components").hasSize(3);
MetricsComponent<JavaClass> component = components.tryGetComponent(SomeTestClass1.class.getName()).get();
assertThatTypes(component).as("elements of component " + component.getIdentifier()).matchInAnyOrder(SomeTestClass1.class);
component = components.tryGetComponent(SomeSubTestClass.class.getName()).get();
assertThatTypes(component).as("elements of component " + component.getIdentifier()).matchInAnyOrder(SomeSubTestClass.class);
component = components.tryGetComponent(SomeTestClass2.class.getName()).get();
assertThatTypes(component).as("elements of component " + component.getIdentifier()).matchInAnyOrder(SomeTestClass2.class);
}
Aggregations