JUnit 4.0 released

サイトのDownloadは3.8.1のままだが
http://prdownloads.sourceforge.net/junit/junit4.0.zip
でダウンロードできた。

JDKのバージョンを変えて提供されているサンプルのTestを実行してみた。

>java -version
java version "1.5.0_04"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_04-b05)
BEA JRockit(R) (build R26.0.0-189-53463-1.5.0_04-20051122-2041-win-ia32, )

>java -cp junit-4.0.jar;.; junit.tests.AllTests
.........................................
.........................................
....................
Time: 5.669

OK (102 tests)

>java -version
java version "1.5.0_06"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05)
Java HotSpot(TM) Client VM (build 1.5.0_06-b05, mixed mode, sharing)

>java -cp junit-4.0.jar;.; junit.tests.AllTests
.........................................
.........................................
....................
Time: 0.761

OK (102 tests)

>java -version
java version "1.6.0-beta"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.6.0-beta-b59g)
Java HotSpot(TM) Client VM (build 1.6.0-beta-b59g, mixed mode, sharing)

>java -cp junit-4.0.jar;.; junit.tests.AllTests
.........................................
.........................................
....................
Time: 0.872

OK (102 tests)

あとは3.8.1で作ったパッチ

--- ComparisonFailure.java  Wed Apr 02 11:24:17 2003
+++ ComparisonFailure.java.ori  Wed Apr 02 11:24:17 2003
@@ -30,7 +30,7 @@
   public String getMessage() {
     if (fExpected == null || fActual == null)
       return Assert.format(super.getMessage(), fExpected, fActual);
-/*      
     int end= Math.min(fExpected.length(), fActual.length());
     
     int i= 0;
@@ -63,8 +63,6 @@
       if (k < fActual.length()-1)
         actual= actual+"...";
     }  
-    return Assert.format(super.getMessage(), expected, actual);
-*/
     return Assert.format(super.getMessage(), fExpected, fActual);
   }
 }

をあててjunit.jarを作り直しだ。