use of com.tngtech.archunit.core.importer.testexamples.syntheticimport.ClassWithSynthetics in project ArchUnit by TNG.
the class ClassFileImporterTest method handles_synthetic_modifiers.
@Test
public void handles_synthetic_modifiers() {
JavaClasses classes = new ClassFileImporter().importUrl(getClass().getResource("testexamples/syntheticimport"));
JavaField syntheticField = getOnlyElement(classes.get(ClassWithSynthetics.ClassWithSyntheticField.class).getFields());
assertThat(syntheticField.getModifiers()).as("modifiers of field in ClassWithSynthetics.ClassWithSyntheticField").contains(SYNTHETIC);
JavaMethod syntheticMethod = getMethodWithReturnType(classes.get(ClassWithSynthetics.ClassWithSyntheticMethod.class), Object.class);
assertThat(syntheticMethod.getModifiers()).as("modifiers of method in ClassWithSynthetics.ClassWithSyntheticMethod").contains(SYNTHETIC);
JavaMethod compareMethod = classes.get(ClassWithSynthetics.class).getMethod("compare", Object.class, Object.class);
assertThat(compareMethod.getModifiers()).as("modifiers of bridge method in ClassWithSynthetics").contains(BRIDGE, SYNTHETIC);
}
Aggregations