GroupingCallBack implements MatchMergeAlgorithm.Callback { @Override public void onRemoveMerge(Record record) { RichRecord richRecord = (RichRecord) record; if (richRecord.isMerged()) { richRecord.setOriginRow(null); richRecord.setGroupQuality(0); } richRecord.setMerged(false); richRecord.setMaster(false); } 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 testOnRemoveMerge() { GroupingCallBack<Object> groupingCallBack = new GroupingCallBack<>(oldGID2New, recordGrouping); RichRecord record1 = new RichRecord("id1", new Date().getTime(), "source1"); record1.setOriginRow(new ArrayList<DQAttribute<?>>()); record1.setGroupQuality(1.0); record1.setMerged(true); record1.setMaster(true); groupingCallBack.onRemoveMerge(record1); Assert.assertNull("The OriginRow of record1 should be null", record1.getOriginRow()); Assert.assertEquals("The GroupQuality of record1 should be 0.0", "0.0", "" + record1.getGroupQuality()); Assert.assertEquals("The GroupQuality of record1 should be false", false, record1.isMaster()); Assert.assertEquals("The GroupQuality of record1 should be false", false, record1.isMerged()); record1 = new RichRecord("id1", new Date().getTime(), "source1"); record1.setOriginRow(new ArrayList<DQAttribute<?>>()); record1.setGroupQuality(1.0); record1.setMerged(false); record1.setMaster(true); groupingCallBack.onRemoveMerge(record1); Assert.assertNotNull("The OriginRow of record1 should not be null", record1.getOriginRow()); Assert.assertEquals("The GroupQuality of record1 should be 0.0", "1.0", "" + record1.getGroupQuality()); Assert.assertEquals("The GroupQuality of record1 should be false", false, record1.isMaster()); Assert.assertEquals("The GroupQuality of record1 should be false", false, record1.isMerged()); }