public void testNested() {
JPAPlugin pl = new JPAPlugin();
Annotation[] annotations = NestedQueryTestEntity.class.getAnnotations();
for (Annotation a : annotations) {
if (a instanceof NamedQueries) {
AnnotationModel res = pl.parse(a);
assertNotNull(res);
assertEquals(1, res.getAttributes().size());
assertNull(res.getChildren());
AttributeModel nq = res.getAttributes().get(0);
assertEquals("value", nq.getName());
assertTrue(nq.getValue() instanceof AnnotationModel);
AnnotationModel am = (AnnotationModel) nq.getValue();
assertEquals(0, am.getAttributes().size());
List<AnnotationModel> children = am.getChildren();
assertEquals(1, children.size());
AnnotationModel firstNq = children.get(0);
assertEquals(4, firstNq.getAttributes().size());
AnnotationModel amHA = (AnnotationModel) firstNq
.getAttributes().get(2).getValue();
assertEquals(QueryHint.class.getName() + "[]",
amHA.getQualifiedName());
List<AnnotationModel> amHACh = amHA.getChildren();
assertEquals(2, amHACh.get(0).getAttributes().size());
}
}
}