assertEquals(0, outOfRangeInterval.size());
}
@Test
public void testGetRequestDateToRequestCountBetweenByMonth() {
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-12-16T01:11:00"));
searchRequest4 = _requestRepo.save(searchRequest4);
final List<Pair<DateInterval.Month, Integer>> fullInterval = _requestRepo.getRequestDateToRequestCountBetween
(new DateInterval.Month(), searchRequest1.getRequestDate(), searchRequest4.getRequestDate());
assertEquals(3, fullInterval.size());
assertTrue(fullInterval.contains(Pair.read(new DateInterval.Month(searchRequest1.getRequestDate()), 2)));
assertTrue(fullInterval.contains(Pair.read(new DateInterval.Month(searchRequest3.getRequestDate()), 1)));
assertTrue(fullInterval.contains(Pair.read(new DateInterval.Month(searchRequest4.getRequestDate()), 1)));
final List<Pair<DateInterval.Month, Integer>> shortInterval = _requestRepo.getRequestDateToRequestCountBetween
(new DateInterval.Month(), searchRequest3.getRequestDate(), searchRequest4.getRequestDate());
assertEquals(2, shortInterval.size());
assertTrue(fullInterval.contains(Pair.read(new DateInterval.Month(searchRequest3.getRequestDate()), 1)));
assertTrue(fullInterval.contains(Pair.read(new DateInterval.Month(searchRequest4.getRequestDate()), 1)));
final List<Pair<DateInterval.Month, Integer>> outOfRangeInterval = _requestRepo.getRequestDateToRequestCountBetween
(new DateInterval.Month(), new ISODate("1990-01-01"), new ISODate("1990-01-02"));
assertEquals(0, outOfRangeInterval.size());
}