Program: 136789
Project: 136789
Buggy source:
/** 
 * Mock Test method for   {@link org.talend.dq.analysis.explore.PatternExplorer#getInvalidRowsStatement()}. when the test for indicator is user define indicator
 */
@Test public void testGetInvalidRowsStatement_2(){
  Analysis analysis=mock(Analysis.class);
  AnalysisParameters parameters=mock(AnalysisParameters.class);
  when(parameters.getExecutionLanguage()).thenReturn(ExecutionLanguage.SQL);
  when(analysis.getParameters()).thenReturn(parameters);
  AnalysisContext context=mock(AnalysisContext.class);
  when(analysis.getContext()).thenReturn(context);
  DataManager dataManager=mock(DataManager.class);
  when(context.getConnection()).thenReturn(dataManager);
  DbmsLanguage dbmsLanguage=mock(DbmsLanguage.class);
  when(dbmsLanguage.getDbmsName()).thenReturn("String_Node_Str");
  when(dbmsLanguage.getDbVersion()).thenReturn(null);
  TdTable table=org.talend.cwm.relational.RelationalFactory.eINSTANCE.createTdTable();
  table.setName("String_Node_Str");
  TdColumn column=org.talend.cwm.relational.RelationalFactory.eINSTANCE.createTdColumn();
  column.setName("String_Node_Str");
  TdSqlDataType tdsql=org.talend.cwm.relational.RelationalFactory.eINSTANCE.createTdSqlDataType();
  tdsql.setName("String_Node_Str");
  tdsql.setJavaDataType(Types.DATE);
  column.setSqlDataType(tdsql);
  table.getOwnedElement().add(column);
  column.setOwner(table);
  UserDefIndicator userDefIndicator=IndicatorSqlFactory.eINSTANCE.createUserDefIndicator();
  UDIndicatorDefinition indicatorDefinition=UserdefineFactory.eINSTANCE.createUDIndicatorDefinition();
  indicatorDefinition.setName("String_Node_Str");
  userDefIndicator.setName(indicatorDefinition.getName());
  userDefIndicator.setIndicatorDefinition(indicatorDefinition);
  TdExpression newTdExp=BooleanExpressionHelper.createTdExpression("String_Node_Str",ViewInvalidRows,null);
  newTdExp.setModificationDate(DateUtils.getCurrentDate(DateUtils.PATTERN_5));
  indicatorDefinition.getViewInvalidRowsExpression().add(newTdExp);
  ChartDataEntity chartDataEntity=new ChartDataEntity(userDefIndicator,"String_Node_Str","String_Node_Str");
  chartDataEntity.setLabelNull(false);
  chartDataEntity.setKey("String_Node_Str");
  assertFalse(chartDataEntity.isLabelNull());
  userDefIndicator.setAnalyzedElement(column);
  IndicatorParameters indicatorParameters=IndicatorsFactory.eINSTANCE.createIndicatorParameters();
  indicatorParameters.setDateParameters(null);
  userDefIndicator.setParameters(indicatorParameters);
  assertNull(indicatorParameters.getDateParameters());
  PowerMockito.mockStatic(DbmsLanguageFactory.class);
  when(DbmsLanguageFactory.createDbmsLanguage(dataManager)).thenReturn(dbmsLanguage);
  when(DbmsLanguageFactory.compareDbmsLanguage("String_Node_Str","String_Node_Str")).thenReturn(true);
  when(dbmsLanguage.toQualifiedName(null,null,"String_Node_Str")).thenReturn("String_Node_Str");
  when(dbmsLanguage.fillGenericQueryWithColumnsAndTable("String_Node_Str","String_Node_Str","String_Node_Str")).thenReturn("String_Node_Str");
  PatternExplorer freqExp=new PatternExplorer();
  Assert.assertTrue(freqExp.setAnalysis(analysis));
  freqExp.setEnitty(chartDataEntity);
  String clause=freqExp.getInvalidRowsStatement();
  assertEquals("String_Node_Str",clause);
}

Fixed version (ground truth):
/** 
 * Mock Test method for   {@link org.talend.dq.analysis.explore.PatternExplorer#getInvalidRowsStatement()}. when the test for indicator is user define indicator
 */
@Test public void testGetInvalidRowsStatement_2(){
  Analysis analysis=mock(Analysis.class);
  AnalysisParameters parameters=mock(AnalysisParameters.class);
  when(parameters.getExecutionLanguage()).thenReturn(ExecutionLanguage.SQL);
  when(analysis.getParameters()).thenReturn(parameters);
  AnalysisContext context=mock(AnalysisContext.class);
  when(analysis.getContext()).thenReturn(context);
  DataManager dataManager=mock(DataManager.class);
  when(context.getConnection()).thenReturn(dataManager);
  DbmsLanguage dbmsLanguage=mock(DbmsLanguage.class);
  when(dbmsLanguage.getDbmsName()).thenReturn("String_Node_Str");
  when(dbmsLanguage.getDbVersion()).thenReturn(null);
  TdTable table=org.talend.cwm.relational.RelationalFactory.eINSTANCE.createTdTable();
  table.setName("String_Node_Str");
  TdColumn column=org.talend.cwm.relational.RelationalFactory.eINSTANCE.createTdColumn();
  column.setName("String_Node_Str");
  TdSqlDataType tdsql=org.talend.cwm.relational.RelationalFactory.eINSTANCE.createTdSqlDataType();
  tdsql.setName("String_Node_Str");
  tdsql.setJavaDataType(Types.DATE);
  column.setSqlDataType(tdsql);
  table.getOwnedElement().add(column);
  column.setOwner(table);
  UserDefIndicator userDefIndicator=IndicatorSqlFactory.eINSTANCE.createUserDefIndicator();
  UDIndicatorDefinition indicatorDefinition=UserdefineFactory.eINSTANCE.createUDIndicatorDefinition();
  indicatorDefinition.setName("String_Node_Str");
  userDefIndicator.setName(indicatorDefinition.getName());
  userDefIndicator.setIndicatorDefinition(indicatorDefinition);
  TdExpression newTdExp=BooleanExpressionHelper.createTdExpression("String_Node_Str",ViewInvalidRows,null);
  newTdExp.setModificationDate(DateUtils.getCurrentDate(DateUtils.PATTERN_5));
  indicatorDefinition.getViewInvalidRowsExpression().add(newTdExp);
  ChartDataEntity chartDataEntity=new ChartDataEntity(userDefIndicator,"String_Node_Str","String_Node_Str");
  chartDataEntity.setLabelNull(false);
  chartDataEntity.setKey("String_Node_Str");
  assertFalse(chartDataEntity.isLabelNull());
  userDefIndicator.setAnalyzedElement(column);
  IndicatorParameters indicatorParameters=IndicatorsFactory.eINSTANCE.createIndicatorParameters();
  indicatorParameters.setDateParameters(null);
  userDefIndicator.setParameters(indicatorParameters);
  assertNull(indicatorParameters.getDateParameters());
  PowerMockito.mockStatic(DbmsLanguageFactory.class);
  when(DbmsLanguageFactory.createDbmsLanguage(dataManager)).thenReturn(dbmsLanguage);
  when(DbmsLanguageFactory.compareDbmsLanguage("String_Node_Str","String_Node_Str")).thenReturn(true);
  when(dbmsLanguage.toQualifiedName(null,null,"String_Node_Str")).thenReturn("String_Node_Str");
  when(dbmsLanguage.fillGenericQueryWithColumnsAndTable("String_Node_Str","String_Node_Str","String_Node_Str")).thenReturn("String_Node_Str");
  RegexPatternExplorer freqExp=new RegexPatternExplorer();
  Assert.assertTrue(freqExp.setAnalysis(analysis));
  freqExp.setEnitty(chartDataEntity);
  String clause=freqExp.getInvalidRowsStatement();
  assertEquals("String_Node_Str",clause);
}