}
@Test
public void search() {
HolidayDocument m1h1 = holidayDocWithId("m1", "1");
HolidayDocument m1h2 = holidayDocWithId("m1", "2");
HolidayDocument m1h3 = holidayDocWithId("m1", "3");
HolidayDocument m1h4 = holidayDocWithId("m1", "4");
HolidayDocument m2h3 = holidayDocWithId("m2", "3");
HolidayDocument m2h4 = holidayDocWithId("m2", "4");
HolidayDocument m2h5 = holidayDocWithId("m2", "5");
HolidayDocument m2h6 = holidayDocWithId("m2", "6");
final HolidayDocument m2h7 = holidayDocWithId("m2", "7");
HolidaySearchResult m1Result = new HolidaySearchResult(Lists.newArrayList(m1h1, m1h2, m1h2, m1h3, m1h4, m1h4));
HolidaySearchResult m2Result = new HolidaySearchResult(Lists.newArrayList(m2h3, m2h4, m2h5, m2h6, m2h7));
final List<HolidayDocument> resultList = Lists.newArrayList();
@SuppressWarnings("unchecked")
final SearchCallback<HolidayDocument, HolidayMaster> cbDelegate = mock(SearchCallback.class);
cMaster.search(Lists.newArrayList(m1Result, m2Result, null), new SearchCallback<HolidayDocument, HolidayMaster>() {
@Override
public int compare(HolidayDocument arg0, HolidayDocument arg1) {
return arg0.getUniqueId().getValue().compareTo(arg1.getUniqueId().getValue());
}
@Override
public boolean include(HolidayDocument document) {
return !m2h7.equals(document);
}
@Override
public void accept(HolidayDocument document, HolidayMaster master, boolean masterUnique, boolean clientUnique) {
cbDelegate.accept(document, master, masterUnique, clientUnique);