Program: 137239
Project: 137239
Buggy source:
/** 
 * Test method for  {@link org.talend.dq.analysis.ExecuteMatchRuleHandler#execute(java.util.Map,org.talend.dataquality.indicators.columnset.RecordMatchingIndicator,java.util.List,org.talend.dataquality.indicators.columnset.BlockKeyIndicator)}. one block key one match key
 */
@Test public void testExecute2(){
  Map<MetadataColumn,String> columnMap=new HashMap<MetadataColumn,String>();
  MetadataColumn col0=ConnectionFactory.eINSTANCE.createMetadataColumn();
  col0.setName(columnName0);
  columnMap.put(col0,"String_Node_Str");
  MetadataColumn col1=ConnectionFactory.eINSTANCE.createMetadataColumn();
  col1.setName(columnName1);
  columnMap.put(col1,"String_Node_Str");
  MetadataColumn col2=ConnectionFactory.eINSTANCE.createMetadataColumn();
  col2.setName(columnName2);
  columnMap.put(col2,"String_Node_Str");
  MetadataColumn col3=ConnectionFactory.eINSTANCE.createMetadataColumn();
  col3.setName(columnName3);
  columnMap.put(col3,"String_Node_Str");
  RecordMatchingIndicator recordMatchingIndicator=ColumnsetFactory.eINSTANCE.createRecordMatchingIndicator();
  MatchRuleDefinition matchRuleDef=RulesPackage.eINSTANCE.getRulesFactory().createMatchRuleDefinition();
  recordMatchingIndicator.setBuiltInMatchRuleDefinition(matchRuleDef);
  MatchRule createMatchRule1=RulesFactory.eINSTANCE.createMatchRule();
  MatchKeyDefinition createMatchKeyDefinition1=RulesFactory.eINSTANCE.createMatchKeyDefinition();
  createMatchRule1.getMatchKeys().add(createMatchKeyDefinition1);
  createMatchKeyDefinition1.setColumn(columnName2);
  createMatchKeyDefinition1.setConfidenceWeight(1);
  createMatchKeyDefinition1.setName("String_Node_Str");
  createMatchKeyDefinition1.setHandleNull(HandleNullEnum.NULL_MATCH_NULL.getValue());
  AlgorithmDefinition createAlgorithmDefinition1=RulesFactory.eINSTANCE.createAlgorithmDefinition();
  createAlgorithmDefinition1.setAlgorithmType(AttributeMatcherType.EXACT.name());
  createMatchKeyDefinition1.setAlgorithm(createAlgorithmDefinition1);
  matchRuleDef.getMatchRules().add(createMatchRule1);
  BlockKeyDefinition createBlockKeyDefinition=RulesFactory.eINSTANCE.createBlockKeyDefinition();
  createBlockKeyDefinition.setColumn(columnName1);
  createBlockKeyDefinition.setName("String_Node_Str");
  AlgorithmDefinition blockPreAlgorithm=RulesFactory.eINSTANCE.createAlgorithmDefinition();
  blockPreAlgorithm.setAlgorithmType(BlockingKeyPreAlgorithmEnum.NON_ALGO.getValue());
  createBlockKeyDefinition.setPreAlgorithm(blockPreAlgorithm);
  AlgorithmDefinition blockAlgorithm=RulesFactory.eINSTANCE.createAlgorithmDefinition();
  blockAlgorithm.setAlgorithmType(BlockingKeyAlgorithmEnum.EXACT.getValue());
  createBlockKeyDefinition.setAlgorithm(blockAlgorithm);
  AlgorithmDefinition blockPostAlgorithm=RulesFactory.eINSTANCE.createAlgorithmDefinition();
  blockPostAlgorithm.setAlgorithmType(BlockingKeyPostAlgorithmEnum.NON_ALGO.getValue());
  createBlockKeyDefinition.setPostAlgorithm(blockPostAlgorithm);
  matchRuleDef.getBlockKeys().add(createBlockKeyDefinition);
  List<Object[]> matchRows=new ArrayList<Object[]>();
  matchRows.add(new String[]{"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"});
  matchRows.add(new String[]{"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"});
  matchRows.add(new String[]{"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"});
  matchRows.add(new String[]{"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"});
  BlockKeyIndicator blockKeyIndicator=ColumnsetFactory.eINSTANCE.createBlockKeyIndicator();
  ExecuteMatchRuleHandler execHandler=new ExecuteMatchRuleHandler();
  MatchGroupResultConsumer matchResultConsumer=createMatchGroupResultConsumer(columnMap,recordMatchingIndicator);
  TypedReturnCode<MatchGroupResultConsumer> executeResult=execHandler.execute(columnMap,recordMatchingIndicator,matchRows,blockKeyIndicator,matchResultConsumer);
  Assert.assertTrue(executeResult.isOk());
  Assert.assertTrue(executeResult.getMessage() == null);
  Assert.assertTrue(executeResult.getObject() != null);
  MatchGroupResultConsumer ResultConsumer=executeResult.getObject();
  List<Object[]> fullMatchResult=ResultConsumer.getFullMatchResult();
  Assert.assertTrue(fullMatchResult.size() == 4);
  for (int i=0; i < fullMatchResult.size(); i++) {
    Object[] objectArray=fullMatchResult.get(i);
    Object masterValue=objectArray[7];
    Object idValue=objectArray[0];
    if ("String_Node_Str".equals(idValue)) {
      Assert.assertFalse(Boolean.parseBoolean(masterValue.toString()));
    }
 else {
      Assert.assertTrue(Boolean.parseBoolean(masterValue.toString()));
    }
  }
}

Fixed version (ground truth):
/** 
 * Test method for  {@link org.talend.dq.analysis.match.org.talend.dq.analysis.match.ExecuteMatchRuleHandler#execute(java.util.Map,org.talend.dataquality.indicators.columnset.RecordMatchingIndicator,java.util.List,org.talend.dataquality.indicators.columnset.BlockKeyIndicator)}. one block key one match key
 */
@Test public void testExecute2(){
  Map<MetadataColumn,String> columnMap=new HashMap<MetadataColumn,String>();
  MetadataColumn col0=ConnectionFactory.eINSTANCE.createMetadataColumn();
  col0.setName(columnName0);
  columnMap.put(col0,"String_Node_Str");
  MetadataColumn col1=ConnectionFactory.eINSTANCE.createMetadataColumn();
  col1.setName(columnName1);
  columnMap.put(col1,"String_Node_Str");
  MetadataColumn col2=ConnectionFactory.eINSTANCE.createMetadataColumn();
  col2.setName(columnName2);
  columnMap.put(col2,"String_Node_Str");
  MetadataColumn col3=ConnectionFactory.eINSTANCE.createMetadataColumn();
  col3.setName(columnName3);
  columnMap.put(col3,"String_Node_Str");
  RecordMatchingIndicator recordMatchingIndicator=ColumnsetFactory.eINSTANCE.createRecordMatchingIndicator();
  MatchRuleDefinition matchRuleDef=RulesPackage.eINSTANCE.getRulesFactory().createMatchRuleDefinition();
  recordMatchingIndicator.setBuiltInMatchRuleDefinition(matchRuleDef);
  MatchRule createMatchRule1=RulesFactory.eINSTANCE.createMatchRule();
  MatchKeyDefinition createMatchKeyDefinition1=RulesFactory.eINSTANCE.createMatchKeyDefinition();
  createMatchRule1.getMatchKeys().add(createMatchKeyDefinition1);
  createMatchKeyDefinition1.setColumn(columnName2);
  createMatchKeyDefinition1.setConfidenceWeight(1);
  createMatchKeyDefinition1.setName("String_Node_Str");
  createMatchKeyDefinition1.setHandleNull(HandleNullEnum.NULL_MATCH_NULL.getValue());
  AlgorithmDefinition createAlgorithmDefinition1=RulesFactory.eINSTANCE.createAlgorithmDefinition();
  createAlgorithmDefinition1.setAlgorithmType(AttributeMatcherType.EXACT.name());
  createMatchKeyDefinition1.setAlgorithm(createAlgorithmDefinition1);
  matchRuleDef.getMatchRules().add(createMatchRule1);
  BlockKeyDefinition createBlockKeyDefinition=RulesFactory.eINSTANCE.createBlockKeyDefinition();
  createBlockKeyDefinition.setColumn(columnName1);
  createBlockKeyDefinition.setName("String_Node_Str");
  AlgorithmDefinition blockPreAlgorithm=RulesFactory.eINSTANCE.createAlgorithmDefinition();
  blockPreAlgorithm.setAlgorithmType(BlockingKeyPreAlgorithmEnum.NON_ALGO.getValue());
  createBlockKeyDefinition.setPreAlgorithm(blockPreAlgorithm);
  AlgorithmDefinition blockAlgorithm=RulesFactory.eINSTANCE.createAlgorithmDefinition();
  blockAlgorithm.setAlgorithmType(BlockingKeyAlgorithmEnum.EXACT.getValue());
  createBlockKeyDefinition.setAlgorithm(blockAlgorithm);
  AlgorithmDefinition blockPostAlgorithm=RulesFactory.eINSTANCE.createAlgorithmDefinition();
  blockPostAlgorithm.setAlgorithmType(BlockingKeyPostAlgorithmEnum.NON_ALGO.getValue());
  createBlockKeyDefinition.setPostAlgorithm(blockPostAlgorithm);
  matchRuleDef.getBlockKeys().add(createBlockKeyDefinition);
  List<Object[]> matchRows=new ArrayList<Object[]>();
  matchRows.add(new String[]{"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"});
  matchRows.add(new String[]{"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"});
  matchRows.add(new String[]{"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"});
  matchRows.add(new String[]{"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"});
  BlockKeyIndicator blockKeyIndicator=ColumnsetFactory.eINSTANCE.createBlockKeyIndicator();
  ExecuteMatchRuleHandler execHandler=new ExecuteMatchRuleHandler();
  MatchGroupResultConsumer matchResultConsumer=createMatchGroupResultConsumer(columnMap,recordMatchingIndicator);
  TypedReturnCode<MatchGroupResultConsumer> executeResult=execHandler.execute(columnMap,recordMatchingIndicator,matchRows,blockKeyIndicator,matchResultConsumer);
  Assert.assertTrue(executeResult.isOk());
  Assert.assertTrue(executeResult.getMessage() == null);
  Assert.assertTrue(executeResult.getObject() != null);
  MatchGroupResultConsumer ResultConsumer=executeResult.getObject();
  List<Object[]> fullMatchResult=ResultConsumer.getFullMatchResult();
  Assert.assertTrue(fullMatchResult.size() == 4);
  for (int i=0; i < fullMatchResult.size(); i++) {
    Object[] objectArray=fullMatchResult.get(i);
    Object masterValue=objectArray[7];
    Object idValue=objectArray[0];
    if ("String_Node_Str".equals(idValue)) {
      Assert.assertFalse(Boolean.parseBoolean(masterValue.toString()));
    }
 else {
      Assert.assertTrue(Boolean.parseBoolean(masterValue.toString()));
    }
  }
}