commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r1660410 - in /commons/proper/compress/trunk/src/test/java/org/apache/commons/compress: ArchiveReadTest.java ArchiveReadTests.java
Date Tue, 17 Feb 2015 15:19:53 GMT
Author: sebb
Date: Tue Feb 17 15:19:53 2015
New Revision: 1660410

URL: http://svn.apache.org/r1660410
Log:
Oops - test class was not being run because the name ended in Tests instead of Test
Fix up to work under Surefire

Added:
    commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/ArchiveReadTest.java
      - copied, changed from r1660351, commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/ArchiveReadTests.java
Removed:
    commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/ArchiveReadTests.java

Copied: commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/ArchiveReadTest.java
(from r1660351, commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/ArchiveReadTests.java)
URL: http://svn.apache.org/viewvc/commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/ArchiveReadTest.java?p2=commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/ArchiveReadTest.java&p1=commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/ArchiveReadTests.java&r1=1660351&r2=1660410&rev=1660410&view=diff
==============================================================================
--- commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/ArchiveReadTests.java
(original)
+++ commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/ArchiveReadTest.java
Tue Feb 17 15:19:53 2015
@@ -41,30 +41,32 @@ import org.apache.commons.compress.archi
  * The class uses nested suites in order to be able to name the test after the file name,
  * as JUnit does not allow one to change the display name of a test.
  */
-public class ArchiveReadTests extends AbstractTestCase {
+public class ArchiveReadTest extends AbstractTestCase {
 
-    final static ClassLoader classLoader = ArchiveReadTests.class.getClassLoader();
+    final static ClassLoader classLoader = ArchiveReadTest.class.getClassLoader();
 
     private File file;
     private static final ArrayList<String> fileList = new ArrayList<String>();
 
-    public ArchiveReadTests(String name) {
+    public ArchiveReadTest(String name) {
         super(name);
     }
 
-    private ArchiveReadTests(String name, File file){
+    private ArchiveReadTest(String name, File file){
         super(name);
         this.file = file;
     }
 
     public static TestSuite suite() throws IOException{
         TestSuite suite = new TestSuite("ArchiveReadTests");
+        // TODO move fileList setup to static block
         File arcdir =new File(classLoader.getResource("archives").getFile());
         assertTrue(arcdir.exists());
         File listing= new File(arcdir,"files.txt");
         assertTrue("files.txt is readable",listing.canRead());
         BufferedReader br = new BufferedReader(new FileReader(listing));
         String line;
+        fileList.clear(); // Surefire calls the suite more than once
         while ((line=br.readLine())!=null){
             if (line.startsWith("#")){
                 continue;
@@ -79,7 +81,7 @@ public class ArchiveReadTests extends Ab
             }
             // Appears to be the only way to give the test a variable name
             TestSuite namedSuite = new TestSuite(file.getName());
-            Test test = new ArchiveReadTests("testArchive", file);
+            Test test = new ArchiveReadTest("testArchive", file);
             namedSuite.addTest(test);
             suite.addTest(namedSuite);
         }
@@ -99,6 +101,8 @@ public class ArchiveReadTests extends Ab
            checkArchiveContent(file, expected);
         } catch (ArchiveException e) {
             fail("Problem checking "+file);
+        } catch (junit.framework.AssertionFailedError e) { // show error in context
+            fail("Problem checking " + file + " " +e);
         }
     }
 }



Mime
View raw message