]> source.dussan.org Git - javassist.git/commitdiff
Upgrade junit from ver 3 to 4. 157/head
authornickl- <github@jigsoft.co.za>
Wed, 25 Oct 2017 22:33:39 +0000 (00:33 +0200)
committernickl- <github@jigsoft.co.za>
Fri, 27 Oct 2017 15:40:48 +0000 (17:40 +0200)
There were minimal changes:
Some tests had their own runners these were discontinued as IDEs/maven run the tests anyway.
Removed the main methods for these.
2 tests were dependent on the running order so added the test sorter.

All tests succeed on junit 4 with legacy support.

pom.xml
src/test/javassist/Bench.java
src/test/javassist/JvstTest2.java
src/test/javassist/JvstTest4.java
src/test/javassist/bytecode/BytecodeTest.java
src/test/javassist/compiler/CompTest.java

diff --git a/pom.xml b/pom.xml
index bbeeee6f84c44a1e6a8e464d910409e0cdf008df..da4222830f7976f27f2eccc66913c8bd3145c5d0 100644 (file)
--- a/pom.xml
+++ b/pom.xml
   </profiles>
   <dependencies>
     <dependency>
-      <groupId>junit</groupId>
-      <artifactId>junit</artifactId>
-      <version>3.8.1</version>
-      <scope>test</scope>
+        <groupId>junit</groupId>
+        <artifactId>junit</artifactId>
+        <version>4.12</version>
+        <scope>test</scope>
+    </dependency>
+    <dependency>
+        <groupId>org.hamcrest</groupId>
+        <artifactId>hamcrest-all</artifactId>
+        <version>1.3</version>
+        <scope>test</scope>
     </dependency>
   </dependencies>
 </project>
index 723fa1982b55e85e73e7ff3a702f9b8ff16f7d25..b7b8b27e0fb1133ac32d5402d5443182e48226e4 100644 (file)
@@ -153,11 +153,6 @@ public class Bench extends JvstTestRoot {
         System.out.println("println: " + (t5 * 10) + " usec");
     }
 
-    public static void main(String[] args) {
-        // junit.textui.TestRunner.run(suite());
-        junit.swingui.TestRunner.main(new String[] { "javassist.Bench" });
-    }
-
     public static Test suite() {
         TestSuite suite = new TestSuite("Benchmark Tests");
         suite.addTestSuite(Bench.class);
index ec314e122d45591c0e60aa50c286ea4354321761..12bce5e425a379eeb41d0b8608d2d48095efc973 100644 (file)
@@ -2,10 +2,15 @@ package javassist;
 
 import java.io.*;
 import java.net.URL;
+
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
+
 import java.lang.reflect.Method;
 
 import javassist.expr.*;
 
+@FixMethodOrder(MethodSorters.NAME_ASCENDING)
 public class JvstTest2 extends JvstTestRoot {
     public JvstTest2(String name) {
          super(name);
index a9607e8bc06a3f1e570c112eba9df4c8f50eac21..6e4de44716a26828ada66327ceaa1b1b9da09a20 100644 (file)
@@ -6,10 +6,14 @@ import java.io.FileInputStream;
 import java.io.FileOutputStream;
 import java.util.HashSet;
 
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
+
 import javassist.bytecode.*;
 import javassist.bytecode.annotation.Annotation;
 import javassist.expr.*;
 
+@FixMethodOrder(MethodSorters.NAME_ASCENDING)
 public class JvstTest4 extends JvstTestRoot {
     public JvstTest4(String name) {
         super(name);
index a859f248d614b31251ea0000198334e632c574ec..a9b6e53870be68ab068cac9fd3ebdf5fc0dcb1d3 100644 (file)
@@ -826,12 +826,6 @@ public class BytecodeTest extends TestCase {
         assertEquals("(I)V", cPool2.getUtf8Info(cPool2.getMethodTypeInfo(mtIndex)));
     }
 
-    public static void main(String[] args) {
-        // junit.textui.TestRunner.run(suite());
-        junit.awtui.TestRunner.main(new String[] {
-            "javassist.bytecode.BytecodeTest" });
-    }
-
     public static Test suite() {
         TestSuite suite = new TestSuite("Bytecode Tests");
         suite.addTestSuite(BytecodeTest.class);
index 6a1d5424e1ed490ee17ba69122dc13a21a4ce8c0..158552e33b4baf3a8426393893a2edcdacd46a0d 100644 (file)
@@ -113,12 +113,6 @@ public class CompTest extends TestCase {
         assertEquals("(int,char[],String)", s);
     }
 
-    public static void main(String[] args) {
-        // junit.textui.TestRunner.run(suite());
-        junit.awtui.TestRunner.main(new String[] {
-            "javassist.compiler.CompTest" });
-    }
-
     public static Test suite() {
         TestSuite suite = new TestSuite("Compiler Tests");
         suite.addTestSuite(CompTest.class);