use of com.github.javaparser.resolution.declarations.ResolvedDeclaration in project javaparser by javaparser.
the class FindingAllFields method findAllInheritedFields.
@Test
public void findAllInheritedFields() {
CompilationUnit cu = parseSample("AClassWithFields");
ClassOrInterfaceDeclaration classC = Navigator.demandClass(cu, "C");
ResolvedReferenceTypeDeclaration typeDeclaration = JavaParserFacade.get(new ReflectionTypeSolver()).getTypeDeclaration(classC);
assertEquals(3, typeDeclaration.getAllFields().size());
assertEquals(ImmutableSet.of("a", "b", "c"), typeDeclaration.getAllFields().stream().map(ResolvedDeclaration::getName).collect(Collectors.toSet()));
}
use of com.github.javaparser.resolution.declarations.ResolvedDeclaration in project javaparser by javaparser.
the class FindingAllFields method findAllInheritedFieldsAndGenerics.
@Test
public void findAllInheritedFieldsAndGenerics() {
CompilationUnit cu = parseSample("AClassWithFieldsAndGenerics");
ClassOrInterfaceDeclaration classC = Navigator.demandClass(cu, "C");
ResolvedReferenceTypeDeclaration typeDeclaration = JavaParserFacade.get(new ReflectionTypeSolver()).getTypeDeclaration(classC);
assertEquals(3, typeDeclaration.getAllFields().size());
assertEquals(ImmutableSet.of("a", "b", "c"), typeDeclaration.getAllFields().stream().map(ResolvedDeclaration::getName).collect(Collectors.toSet()));
assertEquals("java.util.List<java.lang.String>", typeDeclaration.getField("b").getType().describe());
}
Aggregations