@Test
public void getClassHierarchyNodeForType() throws Exception {
TypesModel.ClassHierarchyNode classHierarchyNodeForType = typesModel.getClassHierarchyNodeForType(A.class);
assertNotNull(classHierarchyNodeForType);
assertTrue(classHierarchyNodeForType.isPolymorphic());
assertEquals(classHierarchyNodeForType.getAllConcreteChildren().size(), 6); // all
classHierarchyNodeForType = typesModel.getClassHierarchyNodeForType(AB.class);
assertNotNull(classHierarchyNodeForType);
assertFalse(classHierarchyNodeForType.isPolymorphic());
assertEquals(classHierarchyNodeForType.getAllConcreteChildren().size(), 1); // AB
classHierarchyNodeForType = typesModel.getClassHierarchyNodeForType(AA.class);
assertNotNull(classHierarchyNodeForType);
assertTrue(classHierarchyNodeForType.isPolymorphic());
assertEquals(classHierarchyNodeForType.getAllConcreteChildren().size(), 4); // AA, AAA, AAB, AAAA
classHierarchyNodeForType = typesModel.getClassHierarchyNodeForType(X.class);
assertNotNull(classHierarchyNodeForType);
assertTrue(classHierarchyNodeForType.isPolymorphic());
assertThat(classHierarchyNodeForType.getAllConcreteChildren(),
IsIterableContainingInAnyOrder.containsInAnyOrder(A.class, AA.class, AB.class, AAA.class, AAB.class, AAAA.class, AAX.class, AX.class, ABX.class));
}
TypesModelTest.java 文件源码
java
阅读 27
收藏 0
点赞 0
评论 0
项目:polymorphia
作者:
评论列表
文章目录