use of com.tngtech.archunit.core.importer.testexamples.innerclassimport.CalledClass in project ArchUnit by TNG.
the class ClassFileImporterTest method reflect_works.
@Test
public void reflect_works() {
JavaClasses classes = new ClassFileImporter().importUrl(getClass().getResource("testexamples/innerclassimport"));
JavaClass calledClass = classes.get(CalledClass.class);
assertThat(calledClass.reflect()).isEqualTo(CalledClass.class);
assertThat(calledClass.getField("someString").reflect()).isEqualTo(field(CalledClass.class, "someString"));
assertThat(calledClass.getConstructor().reflect()).isEqualTo(constructor(CalledClass.class));
assertThat(calledClass.getConstructor(String.class).reflect()).isEqualTo(constructor(CalledClass.class, String.class));
assertThat(calledClass.getCodeUnitWithParameterTypes(CONSTRUCTOR_NAME, String.class).reflect()).isEqualTo(constructor(CalledClass.class, String.class));
JavaClass innerClass = classes.get(ClassWithInnerClass.Inner.class);
assertThat(innerClass.reflect()).isEqualTo(ClassWithInnerClass.Inner.class);
assertThat(innerClass.getMethod("call").reflect()).isEqualTo(method(ClassWithInnerClass.Inner.class, "call"));
}
Aggregations