assertEquals(1, bins.getChildren().size());
IFolderChild next = bins.getChildren().iterator().next();
assertEquals("Bin A", next.getName());
assertTrue(next instanceof INewsBin);
INewsBin binA = (INewsBin) next;
children = secondSet.getChildren();
assertEquals(4, children.size());
IFolder folderB = null;
IBookMark macOsHints = null;
INewsBin binC = null;
ISearchMark searchA = null;
for (IFolderChild foo : children) {
if (foo instanceof IFolder && "Folder B".equals(foo.getName()))
folderB = (IFolder) foo;
else if (foo instanceof IBookMark && "MacOSXHints.com".equals(foo.getName()))
macOsHints = (IBookMark) foo;
else if (foo instanceof INewsBin && "Bin C".equals(foo.getName()))
binC = (INewsBin) foo;
else if (foo instanceof ISearchMark && "Search A".equals(foo.getName()))
searchA = (ISearchMark) foo;
}
assertEquals(2, searchA.getSearchConditions().size());
List<ISearchCondition> conditions = searchA.getSearchConditions();
for (ISearchCondition condition : conditions) {
if (condition.getField().getId() == INews.LOCATION) {
List<IFolderChild> entities = CoreUtils.toEntities((Long[][]) condition.getValue());
assertEquals(1, entities.size());
assertTrue(entities.contains(folderA));
}
}
assertNotNull(folderB);
assertNotNull(macOsHints);
assertNotNull(binC);
assertNotNull(searchA);
children = folderB.getChildren();
IBookMark golemMark = null;
IFolder bins2 = null;
for (IFolderChild foo : children) {
if (foo instanceof IBookMark && "Golem.de".equals(foo.getName()))
golemMark = (IBookMark) foo;
else if (foo instanceof IFolder && "Bins".equals(foo.getName()))
bins2 = (IFolder) foo;
else
fail();
}
assertNotNull(golemMark);
assertNotNull(bins2);
assertEquals(1, bins2.getChildren().size());
next = bins2.getChildren().iterator().next();
assertEquals("Bin B", next.getName());
assertTrue(next instanceof INewsBin);
INewsBin binB = (INewsBin) next;
assertEquals(6, count(Label.class.getName(), elements));
assertEquals(1, count(SearchFilter.class.getName(), elements));
assertTrue(count(Preference.class.getName(), elements) > 0);
ISearchFilter filter = null;
for (IEntity element : elements) {
if (element instanceof ISearchFilter) {
filter = (ISearchFilter) element;
}
}
assertNotNull(filter);
ILabel label = null;
for (IEntity element : elements) {
if (element instanceof ILabel && "RSSOwl".equals(((ILabel) element).getName())) {
label = (ILabel) element;
}
}
assertNotNull(label);
List<IFilterAction> actions = filter.getActions();
assertEquals(2, actions.size());
for (IFilterAction action : actions) {
if (MoveNewsAction.ID.equals(action.getActionId())) {
Object data = action.getData();
assertTrue(data instanceof Long[]);
assertEquals(binB.getId().longValue(), ((Long[]) data)[0].longValue());
} else if (LabelNewsAction.ID.equals(action.getActionId())) {
Object data = action.getData();
assertEquals(label.getId().longValue(), ((Long) data).longValue());
} else
fail();