You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by se...@apache.org on 2012/03/29 15:09:43 UTC
svn commit: r1306833 - in
/commons/proper/csv/trunk/src/test/java/org/apache/commons/csv:
CSVParserTest.java CSVPrinterTest.java
Author: sebb
Date: Thu Mar 29 13:09:43 2012
New Revision: 1306833
URL: http://svn.apache.org/viewvc?rev=1306833&view=rev
Log:
CSV-69 Eliminate CSVPrinterTest.equals(String[][], String[][]) by using Assert.assertArrayEquals
Modified:
commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVParserTest.java
commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVPrinterTest.java
Modified: commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVParserTest.java
URL: http://svn.apache.org/viewvc/commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVParserTest.java?rev=1306833&r1=1306832&r2=1306833&view=diff
==============================================================================
--- commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVParserTest.java (original)
+++ commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVParserTest.java Thu Mar 29 13:09:43 2012
@@ -324,7 +324,7 @@ public class CSVParserTest {
List<CSVRecord> records = parser.getRecords();
assertTrue(records.size() > 0);
- assertTrue(CSVPrinterTest.equals(res, records));
+ Utils.compare("", res, records);
}
@Test
@@ -349,7 +349,7 @@ public class CSVParserTest {
List<CSVRecord> records = parser.getRecords();
assertTrue(records.size() > 0);
- assertTrue("Failed to parse without comments", CSVPrinterTest.equals(res, records));
+ Utils.compare("Failed to parse without comments", res, records);
String[][] res_comments = {
{"a", "b#"},
@@ -360,7 +360,7 @@ public class CSVParserTest {
parser = new CSVParser(code, format);
records = parser.getRecords();
- assertTrue("Failed to parse with comments",CSVPrinterTest.equals(res_comments, records));
+ Utils.compare("Failed to parse with comments", res_comments, records);
}
@Test
Modified: commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVPrinterTest.java
URL: http://svn.apache.org/viewvc/commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVPrinterTest.java?rev=1306833&r1=1306832&r2=1306833&view=diff
==============================================================================
--- commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVPrinterTest.java (original)
+++ commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVPrinterTest.java Thu Mar 29 13:09:43 2012
@@ -181,37 +181,7 @@ public class CSVPrinterTest {
CSVParser parser = new CSVParser(result, format);
List<CSVRecord> parseResult = parser.getRecords();
- if (!equals(lines, parseResult)) {
- System.out.println("Printer output :" + printable(result));
- assertTrue(false);
- }
- }
-
- public static boolean equals(String[][] a, List<CSVRecord> b) {
- if (a.length != b.size()) {
- System.out.println("expected length :" + a.length);
- System.out.println("got :" + b.size());
- return false;
- }
- for (int i = 0; i < a.length; i++) {
- String[] linea = a[i];
- String[] lineb = b.get(i).values();
- if (linea.length != lineb.length) {
- System.out.println("[" + i + "] expected length :" + linea.length);
- System.out.println("[" + i + "] got :" + lineb.length);
- return false;
- }
- for (int j = 0; j < linea.length; j++) {
- String aval = linea[j];
- String bval = lineb[j];
- if (!aval.equals(bval)) {
- System.out.println("[" + i + "," + j + "] expected :" + printable(aval));
- System.out.println("[" + i + "," + j + "] got :" + printable(bval));
- return false;
- }
- }
- }
- return true;
+ Utils.compare("Printer output :" + printable(result), lines, parseResult);
}
public static String printable(String s) {