items.add(item);
service.testSync(items);
assertNotNull(service.getStatus());
SyncStatus status = service.getStatus();
assertEquals(6, status.getItemCount());
assertEquals(6, status.getTotalItemCount());
Controller.getDefault().reload(sternBm, null, null);
Controller.getDefault().reload(heiseBm, null, null);
Controller.getDefault().reload(golemBm, null, null);
int counter = 0;
for (INews news : sternFeed.getNews()) {
if (news.getGuid().getValue().equals(sternNews1.getGuid().getValue())) {
if (news.isFlagged())
counter++;
} else if (news.getGuid().getValue().equals(sternNews2.getGuid().getValue())) {
if (news.isFlagged())
counter++;
Set<ILabel> labels = news.getLabels();
for (ILabel label : labels) {
if (label.getName().equals("Foo Bar"))
counter++;
}
}
}
for (INews news : heiseFeed.getNews()) {
if (news.getGuid().getValue().equals(heiseNews1.getGuid().getValue())) {
if (news.isFlagged())
counter++;
} else if (news.getGuid().getValue().equals(heiseNews2.getGuid().getValue())) {
if (news.isFlagged())
counter++;
Set<ILabel> labels = news.getLabels();
for (ILabel label : labels) {
if (label.getName().equals("Foo Bar"))
counter++;
}
}
}
for (INews news : golemFeed.getNews()) {
if (news.getGuid().getValue().equals(golemNews1.getGuid().getValue())) {
if (news.isFlagged())
counter++;
} else if (news.getGuid().getValue().equals(golemNews2.getGuid().getValue())) {
if (news.isFlagged())
counter++;
Set<ILabel> labels = news.getLabels();
for (ILabel label : labels) {
if (label.getName().equals("Foo Bar"))
counter++;
if (label.getName().equals("Hello World"))
counter++;
}
}
}
assertEquals(7, counter);
/* Now remove again and check */
item = SyncItem.toSyncItem(sternNews1);
item.setUnStarred();
items.add(item);
item = SyncItem.toSyncItem(heiseNews1);
item.setUnStarred();
items.add(item);
item = SyncItem.toSyncItem(golemNews1);
item.setUnStarred();
items.add(item);
item = SyncItem.toSyncItem(sternNews2);
item.removeLabel("Foo Bar");
items.add(item);
item = SyncItem.toSyncItem(heiseNews2);
item.removeLabel("Foo Bar");
items.add(item);
item = SyncItem.toSyncItem(golemNews2);
item.removeLabel("Foo Bar");
item.removeLabel("Hello World");
items.add(item);
service.testSync(items);
assertNotNull(service.getStatus());
status = service.getStatus();
assertEquals(6, status.getItemCount());
assertEquals(12, status.getTotalItemCount());
Controller.getDefault().reload(sternBm, null, null);
Controller.getDefault().reload(heiseBm, null, null);
Controller.getDefault().reload(golemBm, null, null);