@Test
public void shouldGetParents() throws Exception {

    TypeElement twiceNested = compilation.getElements()
            .getTypeElement(Outer.Nested.TwiceNested.class.getCanonicalName());
    List<? extends Element> members = compilation.getElements().getAllMembers(twiceNested);
    Element field = members.stream().filter(ofKind(ElementKind.FIELD)).findFirst()
            .orElseThrow(IllegalStateException::new);
    List<String> parents = stream(field)
            .map(element -> element.getSimpleName().toString())
            .collect(Collectors.toList());
    assertThat(parents, hasItems("field", "TwiceNested", "Nested", "Outer"));
}