}catch (StorageException e) {
//
}
feed.setId(FEEDID);
BaseFeed result = storage.getFeed(feed);
assertNotNull(result);
assertEquals(0, result.getEntries().size());
List<String> idlist = new ArrayList<String>(30);
ServerBaseEntry e1 = null;
for (int i = 0; i < 30; i++) {
e1 = createServerBaseEntry();
storage.storeEntry(e1);
idlist.add(0, e1.getId());
}
String firstId = e1.getId();
storage = this.controller.getStorage();
result = storage.getFeed(feed);
assertNotNull(result);
assertEquals(25, result.getEntries().size());
for (int i = 0; i < 25; i++) {
assertEquals(idlist.get(i),
((BaseEntry) result.getEntries().get(i)).getId());
}
storage = this.controller.getStorage();
feed.setItemsPerPage(5);
result = storage.getFeed(feed);
assertNotNull(result);
assertEquals(5, result.getEntries().size());
for (int i = 0; i < 5; i++) {
assertEquals(idlist.get(i),
((BaseEntry) result.getEntries().get(i)).getId());
}
storage = this.controller.getStorage();
feed.setItemsPerPage(1);
feed.setStartIndex(1);
result = storage.getFeed(feed);
assertNotNull(result);
assertEquals(1, result.getEntries().size());
assertEquals(idlist.get(0), ((BaseEntry) result.getEntries().get(0))
.getId());
storage = this.controller.getStorage();
feed.setItemsPerPage(50);
feed.setStartIndex(28);
result = storage.getFeed(feed);
assertNotNull(result);
assertEquals(3, result.getEntries().size());
assertEquals(idlist.get(27), ((BaseEntry) result.getEntries().get(0))
.getId());
assertEquals(idlist.get(28), ((BaseEntry) result.getEntries().get(1))
.getId());
assertEquals(idlist.get(29), ((BaseEntry) result.getEntries().get(2))
.getId());
storage = this.controller.getStorage();
feed.setItemsPerPage(50);
feed.setStartIndex(30);
result = storage.getFeed(feed);
assertNotNull(result);
assertEquals(1, result.getEntries().size());
assertEquals(idlist.get(29), ((BaseEntry) result.getEntries().get(0))
.getId());
// assertNotSame(firstId,((BaseEntry)result.getEntries().get(0)).getId());
}