Example #1
0
 @Test
 public void shouldGetRecentFeedForCategory() throws Exception {
   generateData(5, "Cat-0");
   generateData(5, "Cat-1");
   generateData(1, "Cat-0");
   generateData(3, "Cat-1");
   Assert.assertEquals(1, feedGenerator.getRecentFeed("Cat-0").getEvents().size());
   Assert.assertEquals(3, feedGenerator.getRecentFeed("Cat-1").getEvents().size());
 }
Example #2
0
 @Test
 public void shouldGetFeedWithMultipleChunkingHistoriesWithoutMarkers() throws Exception {
   generateData(48, "Cat-1");
   Assert.assertEquals(5, feedGenerator.getFeedForId(1, "Cat-1").getEvents().size());
   Assert.assertEquals(5, feedGenerator.getFeedForId(9, "Cat-1").getEvents().size());
   Assert.assertEquals(3, feedGenerator.getRecentFeed("Cat-1").getEvents().size());
   addChunkingHistory(9, 49);
   FeedGenerator newFeedGenerator =
       new NumberFeedGenerator(allEventRecords, allEventRecordsOffsetMarkers, chunkingEntries);
   Assert.assertEquals(3, newFeedGenerator.getRecentFeed("Cat-1").getEvents().size());
   Assert.assertEquals(3, newFeedGenerator.getFeedForId(10, "Cat-1").getEvents().size());
   generateData(49, "Cat-1");
   Assert.assertEquals(3, newFeedGenerator.getFeedForId(10, "Cat-1").getEvents().size());
   Assert.assertEquals(9, newFeedGenerator.getFeedForId(11, "Cat-1").getEvents().size());
   Assert.assertEquals(4, newFeedGenerator.getFeedForId(16, "Cat-1").getEvents().size());
 }