public void applyPaging() {
HolidayDocument m1h1 = holidayDocWithId("m1", "1");
HolidayDocument m1h2 = holidayDocWithId("m1", "2");
HolidayDocument m1h3 = holidayDocWithId("m1", "3");
HolidayDocument m1h4 = holidayDocWithId("m1", "4");
HolidaySearchResult sr;
sr = new HolidaySearchResult(ImmutableList.of(m1h1, m1h2, m1h3, m1h4));
PagingRequest ofIndex ;
ofIndex = PagingRequest.ofIndex(1, 3);
cMaster.applyPaging(sr, ofIndex);
assertEquals(Paging.of(ofIndex, 4), sr.getPaging());
assertEquals(ImmutableList.of(m1h2, m1h3, m1h4), sr.getDocuments());
sr = new HolidaySearchResult(ImmutableList.of(m1h1, m1h2, m1h3, m1h4));
ofIndex = PagingRequest.ofIndex(100, 103);
cMaster.applyPaging(sr, ofIndex);
assertEquals(Paging.of(ofIndex, 4), sr.getPaging());
assertEquals(ImmutableList.of(), sr.getDocuments());
}