DynamicDAO.save(root);
Controller.getDefault().reload(testBm, null, null);
SyncService service = new SyncService();
assertTrue(service.getStatus() == null);
INews testNews = testFeed.getNews().get(0);
assertEquals(1, testNews.getLabels().size());
assertEquals("TestFeed", testNews.getLabels().iterator().next().getName());
SyncItem item = SyncItem.toSyncItem(testNews);
item.addLabel("Foo");
item.addLabel("Bar");
item.addLabel("Hello World");
item.addLabel("World Hello");
service.testSync(Collections.singleton(item));
assertNotNull(service.getStatus());
SyncStatus status = service.getStatus();
assertEquals(1, status.getItemCount());
assertEquals(1, status.getTotalItemCount());
Controller.getDefault().reload(testBm, null, null);
assertEquals(5, testNews.getLabels().size());
testNews.removeLabel(testNews.getLabels().iterator().next());
DynamicDAO.save(testFeed);
assertEquals(4, testNews.getLabels().size());
Controller.getDefault().reload(testBm, null, null);
assertEquals(5, testNews.getLabels().size());
item = SyncItem.toSyncItem(testNews);
item.removeLabel("Foo");
item.removeLabel("Bar");
item.addLabel("Bababu");
service.testSync(Collections.singleton(item));
Controller.getDefault().reload(testBm, null, null);
assertEquals(4, testNews.getLabels().size());
item = SyncItem.toSyncItem(testNews);
item.removeLabel("Hello World");
item.removeLabel("World Hello");
item.removeLabel("Bababu");
service.testSync(Collections.singleton(item));
Controller.getDefault().reload(testBm, null, null);
assertEquals(1, testNews.getLabels().size());
}