Program: 11976
Project: 11976
Buggy source:
/** 
 * Checks the different results of a previous query
 * @param expectedResults: A DataTable Object with all data needed for check the results. The DataTable must contains at least 2 columns:a) A field column from the result b) Occurrences column (Integer type) Example: |latitude| longitude|place     |occurrences| |12.5    |12.7      |Valencia  |1           | |2.5     | 2.6      |Stratio   |0           | |12.5    |13.7      |Sevilla   |1           | IMPORTANT: There no should be no existing columns 
 * @throws Exception
 */
@Then("String_Node_Str") public void resultsMustBe(DataTable expectedResults) throws Exception {
  String type=commonspec.getResultsType();
  assertThat(type).isNotEqualTo("String_Node_Str").overridingErrorMessage("String_Node_Str");
switch (type) {
case "String_Node_Str":
    if (commonspec.getResults() != null) {
      ColumnDefinitions columns=commonspec.getResults().getColumnDefinitions();
      List<Row> rows=commonspec.getResults().all();
      List<Map<String,Object>> resultsListObtained=new ArrayList<Map<String,Object>>();
      Map<String,Object> results;
      for (int i=0; i < rows.size(); i++) {
        results=new HashMap<String,Object>();
        for (int e=0; e < columns.size(); e++) {
          results.put(columns.getName(e),rows.get(i).getObject(e));
        }
        resultsListObtained.add(results);
      }
      List<Map<String,Object>> resultsListExpected=new ArrayList<Map<String,Object>>();
      Map<String,Object> resultsCucumber;
      for (int e=1; e < expectedResults.getGherkinRows().size(); e++) {
        resultsCucumber=new HashMap<String,Object>();
        for (int i=0; i < expectedResults.getGherkinRows().get(0).getCells().size(); i++) {
          resultsCucumber.put(expectedResults.getGherkinRows().get(0).getCells().get(i),expectedResults.getGherkinRows().get(e).getCells().get(i));
        }
        resultsListExpected.add(resultsCucumber);
      }
      int occurrencesObtained=0;
      int iterations=0;
      int occurrencesExpected=0;
      String nextKey;
      for (int e=0; e < resultsListExpected.size(); e++) {
        iterations=0;
        occurrencesObtained=0;
        occurrencesExpected=Integer.parseInt(resultsListExpected.get(e).get("String_Node_Str").toString());
        for (int i=0; i < resultsListObtained.size(); i++) {
          Iterator<String> it=resultsListExpected.get(0).keySet().iterator();
          while (it.hasNext()) {
            nextKey=it.next();
            if (!nextKey.equals("String_Node_Str")) {
              if (resultsListObtained.get(i).get(nextKey).toString().equals(resultsListExpected.get(e).get(nextKey).toString())) {
                iterations++;
              }
            }
            if (iterations == resultsListExpected.get(0).keySet().size() - 1) {
              occurrencesObtained++;
            }
          }
          iterations=0;
        }
        assertThat(occurrencesExpected).overridingErrorMessage("String_Node_Str" + e + "String_Node_Str"+ occurrencesObtained+ "String_Node_Str"+ occurrencesExpected+ "String_Node_Str").isEqualTo(occurrencesObtained);
      }
    }
 else {
      throw new Exception("String_Node_Str");
    }
  break;
}
}

Fixed version (ground truth):
/** 
 * Checks the different results of a previous query
 * @param expectedResults: A DataTable Object with all data needed for check the results. The DataTable must contains at least 2 columns:a) A field column from the result b) Occurrences column (Integer type) Example: |latitude| longitude|place     |occurrences| |12.5    |12.7      |Valencia  |1           | |2.5     | 2.6      |Stratio   |0           | |12.5    |13.7      |Sevilla   |1           | IMPORTANT: There no should be no existing columns 
 * @throws Exception
 */
@Then("String_Node_Str") public void resultsMustBe(DataTable expectedResults) throws Exception {
  String type=commonspec.getResultsType();
  assertThat(type).isNotEqualTo("String_Node_Str").overridingErrorMessage("String_Node_Str");
switch (type) {
case "String_Node_Str":
    if (commonspec.getResults() != null) {
      ColumnDefinitions columns=commonspec.getResults().getColumnDefinitions();
      List<Row> rows=commonspec.getResults().all();
      List<Map<String,Object>> resultsListObtained=new ArrayList<Map<String,Object>>();
      Map<String,Object> results;
      for (int i=0; i < rows.size(); i++) {
        results=new HashMap<String,Object>();
        for (int e=0; e < columns.size(); e++) {
          results.put(columns.getName(e),rows.get(i).getObject(e));
        }
        resultsListObtained.add(results);
      }
      commonspec.getLogger().info("String_Node_Str" + resultsListObtained.toString());
      List<Map<String,Object>> resultsListExpected=new ArrayList<Map<String,Object>>();
      Map<String,Object> resultsCucumber;
      for (int e=1; e < expectedResults.getGherkinRows().size(); e++) {
        resultsCucumber=new HashMap<String,Object>();
        for (int i=0; i < expectedResults.getGherkinRows().get(0).getCells().size(); i++) {
          resultsCucumber.put(expectedResults.getGherkinRows().get(0).getCells().get(i),expectedResults.getGherkinRows().get(e).getCells().get(i));
        }
        resultsListExpected.add(resultsCucumber);
      }
      commonspec.getLogger().info("String_Node_Str" + resultsListExpected.toString());
      int occurrencesObtained=0;
      int iterations=0;
      int occurrencesExpected=0;
      String nextKey;
      for (int e=0; e < resultsListExpected.size(); e++) {
        iterations=0;
        occurrencesObtained=0;
        occurrencesExpected=Integer.parseInt(resultsListExpected.get(e).get("String_Node_Str").toString());
        for (int i=0; i < resultsListObtained.size(); i++) {
          Iterator<String> it=resultsListExpected.get(0).keySet().iterator();
          while (it.hasNext()) {
            nextKey=it.next();
            if (!nextKey.equals("String_Node_Str")) {
              if (resultsListObtained.get(i).get(nextKey).toString().equals(resultsListExpected.get(e).get(nextKey).toString())) {
                iterations++;
              }
            }
            if (iterations == resultsListExpected.get(0).keySet().size() - 1) {
              occurrencesObtained++;
              iterations=0;
            }
          }
          iterations=0;
        }
        assertThat(occurrencesExpected).overridingErrorMessage("String_Node_Str" + e + "String_Node_Str"+ occurrencesObtained+ "String_Node_Str"+ occurrencesExpected+ "String_Node_Str").isEqualTo(occurrencesObtained);
      }
    }
 else {
      throw new Exception("String_Node_Str");
    }
  break;
}
}