Program: 118288
Project: 118288
Buggy source:
@Test public void generateNewQuery() throws NoSuchMethodException, SecurityException, IllegalAccessException, IllegalArgumentException, InvocationTargetException {
  String schema="String_Node_Str";
  String dbType=EDatabaseTypeName.PSQL.getDisplayName();
  QueryGuessCommand command=new QueryGuessCommand(node,metadataTable,schema,dbType,connection);
  Method method=command.getClass().getDeclaredMethod("String_Node_Str");
  method.setAccessible(true);
  String queryString=(String)method.invoke(command);
  Assert.assertNotNull(queryString);
  Assert.assertTrue(queryString.contains(schema));
  Assert.assertTrue(queryString.contains(metadataTable.getTableName()));
  Assert.assertTrue(queryString.contains("String_Node_Str"));
  Assert.assertTrue(queryString.contains("String_Node_Str"));
  dbType=EDatabaseTypeName.MYSQL.getDisplayName();
  command=new QueryGuessCommand(node,metadataTable,schema,dbType,connection);
  method=command.getClass().getDeclaredMethod("String_Node_Str");
  method.setAccessible(true);
  queryString=(String)method.invoke(command);
  Assert.assertNotNull(queryString);
  Assert.assertFalse(queryString.contains(schema));
  Assert.assertTrue(queryString.contains(metadataTable.getTableName()));
  Assert.assertTrue(queryString.contains("String_Node_Str"));
  Assert.assertTrue(queryString.contains("String_Node_Str"));
}

Fixed version (ground truth):
@Test public void generateNewQuery() throws NoSuchMethodException, SecurityException, IllegalAccessException, IllegalArgumentException, InvocationTargetException {
  connection=ConnectionFactory.eINSTANCE.createConnection();
  node=Mockito.mock(INode.class);
  connection.setContextMode(true);
  TdTable table=RelationalFactory.eINSTANCE.createTdTable();
  table.setName("String_Node_Str");
  table.setLabel("String_Node_Str");
  TdColumn column1=RelationalFactory.eINSTANCE.createTdColumn();
  column1.setId("String_Node_Str");
  column1.setName("String_Node_Str");
  TdColumn column2=RelationalFactory.eINSTANCE.createTdColumn();
  column2.setId("String_Node_Str");
  column2.setName("String_Node_Str");
  table.getColumns().add(column1);
  table.getColumns().add(column2);
  metadataTable=ConvertionHelper.convert(table);
  ElementParameter parameter=new ElementParameter(node);
  parameter.setName("String_Node_Str");
  parameter.setValue(table.getName());
  Mockito.when(node.getPropertyValue(EParameterName.PROPERTY_TYPE.getName())).thenReturn("String_Node_Str");
  Mockito.when(node.getElementParameterFromField(EParameterFieldType.DBTABLE)).thenReturn(parameter);
  String schema="String_Node_Str";
  String dbType=EDatabaseTypeName.PSQL.getDisplayName();
  QueryGuessCommand command=new QueryGuessCommand(node,metadataTable,schema,dbType,connection);
  Method method=command.getClass().getDeclaredMethod("String_Node_Str");
  method.setAccessible(true);
  String queryString=(String)method.invoke(command);
  Assert.assertNotNull(queryString);
  Assert.assertTrue(queryString.contains(schema));
  Assert.assertTrue(queryString.contains(metadataTable.getTableName()));
  Assert.assertTrue(queryString.contains("String_Node_Str"));
  Assert.assertTrue(queryString.contains("String_Node_Str"));
  dbType=EDatabaseTypeName.MYSQL.getDisplayName();
  command=new QueryGuessCommand(node,metadataTable,schema,dbType,connection);
  method=command.getClass().getDeclaredMethod("String_Node_Str");
  method.setAccessible(true);
  queryString=(String)method.invoke(command);
  Assert.assertNotNull(queryString);
  Assert.assertFalse(queryString.contains(schema));
  Assert.assertTrue(queryString.contains(metadataTable.getTableName()));
  Assert.assertTrue(queryString.contains("String_Node_Str"));
  Assert.assertTrue(queryString.contains("String_Node_Str"));
}