GroupingCallBack implements MatchMergeAlgorithm.Callback { @Override public void onDifferent(Record record1, Record record2, MatchResult matchResult) { RichRecord currentRecord = (RichRecord) record2; currentRecord.setMaster(true); } GroupingCallBack(BidiMultiMap<String, String> oldGID2New, AbstractRecordGrouping<T> recordGrouping); @Override void onBeginRecord(Record record); @Override void onMatch(Record record1, Record record2, MatchResult matchResult); @Override void onNewMerge(Record record); @Override void onRemoveMerge(Record record); @Override void onDifferent(Record record1, Record record2, MatchResult matchResult); @Override void onEndRecord(Record record); @Override boolean isInterrupted(); @Override void onBeginProcessing(); @Override void onEndProcessing(); @Override void onSynResult(Record newRecord, Record originalRecord, MatchResult matchResult);  }
@Test public void testOnDifferent() { GroupingCallBack<Object> groupingCallBack = new GroupingCallBack<>(oldGID2New, recordGrouping); RichRecord record1 = new RichRecord("id1", new Date().getTime(), "source1"); RichRecord record2 = new RichRecord("id2", new Date().getTime(), "source2"); record1.setScore(0.1); record2.setScore(0.2); record2.setMaster(false); MatchResult matchResult = new MatchResult(1); record1.setGroupId(null); record2.setGroupId(null); groupingCallBack.onDifferent(record1, record2, matchResult); Assert.assertEquals("The master of record2 should be true", true, record2.isMaster()); }