assertTrue(fullInterval.contains(Pair.read(new DateInterval.Day(searchRequest1.getRequestDate()), 1)));
}
@Test
public void testGetRequestDateToRequestCountBetweenByDay() {
SearchRequest searchRequest1 = newSearchRequest();
searchRequest1.setRequestDate(new ISODate("1980-10-10"));
searchRequest1 = _requestRepo.save(searchRequest1);
SearchRequest searchRequest2 = newSearchRequest();
searchRequest2.setRequestDate(new ISODate("1980-10-10T01:11:00"));
_requestRepo.save(searchRequest2);
SearchRequest searchRequest3 = newSearchRequest();
searchRequest3.setRequestDate(new ISODate("1980-11-13T01:11:00"));
searchRequest3 = _requestRepo.save(searchRequest3);
SearchRequest searchRequest4 = newSearchRequest();
searchRequest4.setRequestDate(new ISODate("1980-11-16T01:11:00"));
searchRequest4 = _requestRepo.save(searchRequest4);
final List<Pair<DateInterval.Day, Integer>> fullInterval = _requestRepo.getRequestDateToRequestCountBetween
(new DateInterval.Day(), searchRequest1.getRequestDate(), searchRequest4.getRequestDate());
assertEquals(3, fullInterval.size());
assertTrue(fullInterval.contains(Pair.read(new DateInterval.Day(searchRequest1.getRequestDate()), 2)));
assertTrue(fullInterval.contains(Pair.read(new DateInterval.Day(searchRequest3.getRequestDate()), 1)));
assertTrue(fullInterval.contains(Pair.read(new DateInterval.Day(searchRequest4.getRequestDate()), 1)));
final List<Pair<DateInterval.Day, Integer>> shortInterval = _requestRepo.getRequestDateToRequestCountBetween
(new DateInterval.Day(), searchRequest3.getRequestDate(), searchRequest4.getRequestDate());
assertEquals(2, shortInterval.size());
assertTrue(fullInterval.contains(Pair.read(new DateInterval.Day(searchRequest3.getRequestDate()), 1)));
assertTrue(fullInterval.contains(Pair.read(new DateInterval.Day(searchRequest4.getRequestDate()), 1)));
final List<Pair<DateInterval.Day, Integer>> outOfRangeInterval = _requestRepo.getRequestDateToRequestCountBetween
(new DateInterval.Day(), new ISODate("1990-01-01"), new ISODate("1990-01-02"));
assertEquals(0, outOfRangeInterval.size());
}