Set<EntityPropertyPageWrapper> pages = Controller.getDefault().getEntityPropertyPagesFor(entities);
assertNotNull(pages);
assertEquals(3, pages.size());
EntityPropertyPageWrapper page1Wrapper = null;
EntityPropertyPageWrapper page2Wrapper = null;
EntityPropertyPageWrapper page3Wrapper = null;
for (EntityPropertyPageWrapper page : pages) {
if (page.getName().equals("TestPage1"))
page1Wrapper = page;
else if (page.getName().equals("TestPage2"))
page2Wrapper = page;
else if (page.getName().equals("TestPage3"))
page3Wrapper = page;
}
assertNotNull(page1Wrapper);
assertNotNull(page2Wrapper);
assertNotNull(page3Wrapper);
assertEquals(true, page1Wrapper.compareTo(page2Wrapper) == -1);
assertEquals(true, page1Wrapper.getTargetEntities().contains(ILabel.class));
assertEquals(true, page2Wrapper.getTargetEntities().contains(ILabel.class));
}
/* Case 2: Multi Selection */
{
List<IEntity> entities = new ArrayList<IEntity>();
entities.add(entity1);
entities.add(entity2);
Set<EntityPropertyPageWrapper> pages = Controller.getDefault().getEntityPropertyPagesFor(entities);
assertNotNull(pages);
assertEquals(2, pages.size());
EntityPropertyPageWrapper page1Wrapper = null;
EntityPropertyPageWrapper page3Wrapper = null;
for (EntityPropertyPageWrapper page : pages) {
if (page.getName().equals("TestPage1"))
page1Wrapper = page;
else if (page.getName().equals("TestPage3"))
page3Wrapper = page;
}
assertNotNull(page1Wrapper);
assertNotNull(page3Wrapper);
assertEquals(true, page1Wrapper.getTargetEntities().contains(ILabel.class));
}
/* Case 3 : Mixed Multi Selection */
{
List<IEntity> entities = new ArrayList<IEntity>();
entities.add(entity1);
entities.add(entity2);
entities.add(entity3);
Set<EntityPropertyPageWrapper> pages = Controller.getDefault().getEntityPropertyPagesFor(entities);
assertNotNull(pages);
assertEquals(1, pages.size());
EntityPropertyPageWrapper page3Wrapper = null;
for (EntityPropertyPageWrapper page : pages) {
if (page.getName().equals("TestPage3"))
page3Wrapper = page;
}
assertNotNull(page3Wrapper);
assertEquals(true, page3Wrapper.getTargetEntities().contains(ILabel.class));
assertEquals(true, page3Wrapper.getTargetEntities().contains(IFeed.class));
}
}