CombinedRecordMatcher extends AbstractRecordMatcher { @Override public String getLabeledAttributeMatchWeights() { lastPositiveMatcher.setDisplayLabels(displayLabels); return lastPositiveMatcher.getLabeledAttributeMatchWeights(); }  @Override double getMatchingWeight(String[] record1, String[] record2); boolean add(IRecordMatcher matcher); @Override String getLabeledAttributeMatchWeights(); @Override boolean setAttributeMatchers(IAttributeMatcher[] attrMatchers); @Override boolean setAttributeWeights(double[] weights); @Override double getRecordMatchThreshold(); @Override String toString(); @Override MatchResult getMatchingWeight(Record record1, Record record2); IRecordMatcher getLastPositiveMatcher(); List<IRecordMatcher> getMatchers();  }
@Test public void testgetLabeledAttributeMatchWeights() { IAttributeMatcher attMatcher1 = AttributeMatcherFactory.createMatcher("EXACT"); IAttributeMatcher attMatcher2 = AttributeMatcherFactory.createMatcher("EXACT"); IRecordMatcher recordMatcher = RecordMatcherFactory.createMatcher("Simple VSR Matcher"); IAttributeMatcher[] attrMatchers = new IAttributeMatcher[] { attMatcher1, attMatcher2 }; assertFalse("record size is not set. It's not allowed to set the attribute matchers", recordMatcher.setAttributeMatchers(attrMatchers)); recordMatcher.setRecordSize(2); assertTrue("The record size is now set. It's allowed to set the attribute matchers", recordMatcher.setAttributeMatchers(attrMatchers)); String[] record1 = { "toto@free.fr", "Tota" }; double[] emptyAttributeMatchingWeights = recordMatcher.getCurrentAttributeMatchingWeights(); for (double d : emptyAttributeMatchingWeights) { assertEquals(0.0d, d, EPSILON); } assertEquals(1.0d, recordMatcher.getMatchingWeight(record1, record1), EPSILON); assertFalse(recordMatcher.setAttributeWeights(ATTRIBUTEWEIGHTS_1)); assertTrue(recordMatcher.setAttributeWeights(new double[] { 1.0, 1.0 })); assertEquals(1.0d, recordMatcher.getMatchingWeight(record1, record1), EPSILON); double[] currentAttributeMatchingWeights = recordMatcher.getCurrentAttributeMatchingWeights(); for (double d : currentAttributeMatchingWeights) { assertEquals(1.0, d, EPSILON); } assertEquals("1.0 | 1.0", recordMatcher.getLabeledAttributeMatchWeights()); attMatcher1.setAttributeName("EMAIL"); attMatcher2.setAttributeName("NAME"); recordMatcher.setDisplayLabels(true); assertEquals("EMAIL: 1.0 | NAME: 1.0", recordMatcher.getLabeledAttributeMatchWeights()); CombinedRecordMatcher combMatcher = RecordMatcherFactory.createCombinedRecordMatcher(); IRecordMatcher recordMatcher2 = RecordMatcherFactory.createMatcher("Simple VSR Matcher"); recordMatcher2.setRecordSize(2); recordMatcher2.setAttributeMatchers(attrMatchers); combMatcher.add(recordMatcher); combMatcher.add(recordMatcher2); assertEquals(1.0d, combMatcher.getMatchingWeight(record1, record1), EPSILON); combMatcher.setDisplayLabels(Boolean.FALSE); assertEquals("1.0 | 1.0", combMatcher.getLabeledAttributeMatchWeights()); combMatcher.setDisplayLabels(Boolean.TRUE); assertEquals("EMAIL: 1.0 | NAME: 1.0", combMatcher.getLabeledAttributeMatchWeights()); }