From: nickl- Date: Wed, 25 Oct 2017 22:33:39 +0000 (+0200) Subject: Upgrade junit from ver 3 to 4. X-Git-Tag: rel_3_23_0_ga~13^2~14 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=ce84f84a174b279ee3e8a38446ea3a1f23bf8287;p=javassist.git Upgrade junit from ver 3 to 4. 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. --- diff --git a/pom.xml b/pom.xml index bbeeee6f..da422283 100644 --- a/pom.xml +++ b/pom.xml @@ -304,10 +304,16 @@ - junit - junit - 3.8.1 - test + junit + junit + 4.12 + test + + + org.hamcrest + hamcrest-all + 1.3 + test diff --git a/src/test/javassist/Bench.java b/src/test/javassist/Bench.java index 723fa198..b7b8b27e 100644 --- a/src/test/javassist/Bench.java +++ b/src/test/javassist/Bench.java @@ -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); diff --git a/src/test/javassist/JvstTest2.java b/src/test/javassist/JvstTest2.java index ec314e12..12bce5e4 100644 --- a/src/test/javassist/JvstTest2.java +++ b/src/test/javassist/JvstTest2.java @@ -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); diff --git a/src/test/javassist/JvstTest4.java b/src/test/javassist/JvstTest4.java index a9607e8b..6e4de447 100644 --- a/src/test/javassist/JvstTest4.java +++ b/src/test/javassist/JvstTest4.java @@ -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); diff --git a/src/test/javassist/bytecode/BytecodeTest.java b/src/test/javassist/bytecode/BytecodeTest.java index a859f248..a9b6e538 100644 --- a/src/test/javassist/bytecode/BytecodeTest.java +++ b/src/test/javassist/bytecode/BytecodeTest.java @@ -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); diff --git a/src/test/javassist/compiler/CompTest.java b/src/test/javassist/compiler/CompTest.java index 6a1d5424..158552e3 100644 --- a/src/test/javassist/compiler/CompTest.java +++ b/src/test/javassist/compiler/CompTest.java @@ -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);