public static void validateResult(Collection<Datum[]> results,
                                    List<Datum[]> expectedResults,
                                    List<String> colNames)
    throws IncorrectAnswer
  {
    List<Datum[]> unexpectedResults = new ArrayList<Datum[]>();
    
    for(Datum[] row : results){ 
      // have to iterate manually -- .equals doesn't work on arrays
      int i;
      for(i = 0; i < expectedResults.size(); i++){
        Datum[] cmpRow = expectedResults.get(i);
        if(row.length != cmpRow.length){
          throw new IncorrectAnswer("Result has an incorrect number of fields");
        }
        int j;
        for(j = 0; j < cmpRow.length; j++){
          if(!row[j].equals(cmpRow[j])){ break; }
        }
        if(j >= cmpRow.length) { break; }
      }
      if(i < expectedResults.size()){
        expectedResults.remove(i);
      } else {
        unexpectedResults.add(row);
      }
    }
    if((expectedResults.size() > 0)||(unexpectedResults.size() > 0)){
      throw new InvalidResults(expectedResults, unexpectedResults, colNames);
    }
  }