* tests/regression/base/All.java,
authorChristian Thalinger <twisti@complang.tuwien.ac.at>
Tue, 17 Jun 2008 14:25:28 +0000 (16:25 +0200)
committerChristian Thalinger <twisti@complang.tuwien.ac.at>
Tue, 17 Jun 2008 14:25:28 +0000 (16:25 +0200)
tests/regression/base/TestExceptionInStaticClassInitializer.java,
tests/regression/base/TestPatcher.java,
tests/regression/bugzilla/All.java,
tests/regression/bugzilla/PR52.java,
tests/regression/bugzilla/PR57.java,
tests/regression/bugzilla/PR58.java,
tests/regression/bugzilla/PR65.java,
tests/regression/bugzilla/PR80.java: Ported to JUnit 4.

tests/regression/base/All.java
tests/regression/base/TestExceptionInStaticClassInitializer.java
tests/regression/base/TestPatcher.java
tests/regression/bugzilla/All.java
tests/regression/bugzilla/PR52.java
tests/regression/bugzilla/PR57.java
tests/regression/bugzilla/PR58.java
tests/regression/bugzilla/PR65.java
tests/regression/bugzilla/PR80.java

index 15a55230158077245b8ba8e12df60f1de1c44cba..9d9c8e8b7d357bd6aefac1f9eae81e003f4b575e 100644 (file)
 */
 
 
-import junit.framework.*;
-import junit.textui.*;
-
-public class All extends TestCase {
-    /**
-     * Runs all CACAO regression unit tests using
-     * junit.textui.TestRunner
-     */
-    public static void main(String[] args) {
-        Test s = suite();
-        TestRunner.run(s);
-    }
-
-    /**
-     * Collects all CACAO regression unit tests as one suite.
-     */
-    public static Test suite() {
-        TestSuite suite = new TestSuite("CACAO Regression Unit Tests");
-
-        // Add your test here.
-
-        suite.addTest(new TestSuite(TestPatcher.class));
-        suite.addTest(new TestSuite(TestExceptionInStaticClassInitializer.class));
-
-        return suite;
-    }
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+
+@RunWith(Suite.class)
+
+@Suite.SuiteClasses({
+TestExceptionInStaticClassInitializer.class,
+TestPatcher.class
+})
+
+public class All {
 }
index e6cc93e07b74fa6c74b0de0628b1cbd5e77d5fad..61ab65cbad2c6a070925a15e160a4772d198188d 100644 (file)
 */
 
 
-import junit.framework.*;
-import junit.textui.*;
-
-public class TestExceptionInStaticClassInitializer extends TestCase {
-    public static void main(String[] args) {
-        TestRunner.run(suite());
-    }
-
-    public static Test suite() {
-        return new TestSuite(TestExceptionInStaticClassInitializer.class);
-    }
+import org.junit.Test;
+import static org.junit.Assert.*;
 
+public class TestExceptionInStaticClassInitializer {
+    @Test
     public void test() {
         try {
             TestExceptionInStaticClassInitializer_x.i = 1;
@@ -52,7 +45,7 @@ public class TestExceptionInStaticClassInitializer extends TestCase {
     }
 
     // This linenumber must be the one from...
-    final static int LINE = 64;
+    final static int LINE = 57;
 }
 
 class TestExceptionInStaticClassInitializer_x {
index 841760826f719915382f2ab4af585b7e5dd27162..cbf8a1339db1571825e6093c62fe76e30c0d6ad8 100644 (file)
 */
 
 
-import junit.framework.*;
-import junit.textui.*;
+import org.junit.Test;
+import static org.junit.Assert.*;
 
 import java.io.*;
 
-public class TestPatcher extends TestCase {
-    public static void main(String[] args) {
-        TestRunner.run(suite());
-    }
-
-    public static Test suite() {
-        return new TestSuite(TestPatcher.class);
-    }
-
+public class TestPatcher {
     static boolean doit = true;
 
     final static int    i = 123;
@@ -45,6 +37,7 @@ public class TestPatcher extends TestCase {
     final static double d = 789.012;
     final static Object o = new Object();
 
+    @Test
     public void testNormal() {
         invokestatic();
         invokespecial();
index bdf0898784b074f15e70f54f00517c67a55a80fa..773d457cdb8b997b774a0481104afc323907a6b2 100644 (file)
 */
 
 
-import junit.framework.*;
-import junit.textui.*;
-
-public class All extends TestCase {
-    /**
-     * Runs all CACAO regression unit tests using
-     * junit.textui.TestRunner
-     */
-    public static void main(String[] args) {
-        Test s = suite();
-        TestRunner.run(s);
-    }
-
-    /**
-     * Collects all CACAO regression unit tests as one suite
-     */
-    public static Test suite() {
-        TestSuite suite = new TestSuite("CACAO Regression Unit Tests");
-
-        // Add your test here.
-
-        suite.addTest(new TestSuite(PR52.class));
-        suite.addTest(new TestSuite(PR57.class));
-        suite.addTest(new TestSuite(PR58.class));
-        suite.addTest(new TestSuite(PR65.class));
-        suite.addTest(new TestSuite(PR80.class));
-
-        return suite;
-    }
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+
+@RunWith(Suite.class)
+
+@Suite.SuiteClasses({
+PR52.class,
+PR57.class,
+PR58.class,
+PR65.class,
+PR70.class,
+PR80.class,
+})
+
+public class All {
 }
index fae85f1cab33f74e59e87449c560fdaaaf9a7fdd..c189a2eb8058a9711e4caa373040e6d01deda15d 100644 (file)
 */
 
 
-import junit.framework.*;
-import junit.textui.*;
+import org.junit.Test;
 
 import java.security.*;
 
-public class PR52 extends TestCase {
-    public static void main(String[] args) {
-        TestRunner.run(suite());
-    }
-
-    public static Test suite() {
-        return new TestSuite(PR52.class);
-    }
-
+public class PR52 {
+    @Test
     public void test() {
         // This one only triggers with GNU Classpath.
         AccessController.getContext();
index b8a960fe636efd0875d82f550e4c8cce25fca002..2bd11f5d04f0aa2bc1274f56e6fdc416597894cc 100644 (file)
 */
 
 
-import junit.framework.*;
-import junit.textui.*;
+import org.junit.Test;
 
-public class PR57 extends TestCase {
-    public static void main(String[] args) {
-        TestRunner.run(suite());
-    }
-
-    public static Test suite() {
-        return new TestSuite(PR57.class);
-    }
-
-    public void test() {
-        try {
-            Class.forName("x");
-            fail("Should throw ClassNotFoundException");
-        }
-        catch (ClassNotFoundException success) {
-        }
+public class PR57 {
+    @Test ( expected = ClassNotFoundException.class )
+    public void test() throws ClassNotFoundException {
+        Class.forName("x");
     }
 }
index d70281c294ae1fa367c728bdcd70a6eb4a0652f2..e8c9db083e7557e374eca4d42b57f0f64964573b 100644 (file)
 */
 
 
-import junit.framework.*;
-import junit.textui.*;
+import org.junit.Test;
+import static org.junit.Assert.*;
 
 import java.io.*;
 
-public class PR58 extends TestCase {
-    public static void main(String[] args) {
-        TestRunner.run(suite());
-    }
-
-    public static Test suite() {
-        return new TestSuite(PR58.class);
-    }
-
+public class PR58 {
     class x extends y {}
     class y {}
 
+    @Test
     public void testSuperClass() {
         // Delete the class file which is extended.
         new File("PR58$y.class").delete();
@@ -60,6 +53,7 @@ public class PR58 extends TestCase {
     interface i {}
     class j implements i {}
 
+    @Test
     public void testSuperInterface() {
         // Delete the interface file which is implemented.
         new File("PR58$i.class").delete();
index 400a3e61acd44b85877adb88658f66db17994315..8fd14180643bf735660fa968b708297613b9a8a9 100644 (file)
 */
 
 
-import junit.framework.*;
-import junit.textui.*;
-
-public class PR65 extends TestCase {
-    public static void main(String[] args) {
-        TestRunner.run(suite());
-    }
-
-    public static Test suite() {
-        return new TestSuite(PR65.class);
-    }
-
-    public void test() {
-        try {
-            Object o = new int[2][1];
-            Number[][] na = (Number[][]) o;
-            na[0][0] = null;
-            fail("Should throw ClassCastException");
-        } catch (ClassCastException success) {
-        }
+import org.junit.Test;
+
+public class PR65 {
+    @Test ( expected = ClassCastException.class )
+    public void test() throws ClassCastException {
+        Object o = new int[2][1];
+        Number[][] na = (Number[][]) o;
+        na[0][0] = null;
     }
 }
index 5e6e401cbdaf0dd80b12134615121cc575e2bfa1..85f23d8209aa1523613fa2fb637de4dd2ba3b30a 100644 (file)
 */
 
 
-import junit.framework.*;
-import junit.textui.*;
-
-public class PR80 extends TestCase {
-    public static void main(String[] args) {
-        TestRunner.run(suite());
-    }
-
-    public static Test suite() {
-        return new TestSuite(PR80.class);
-    }
-
-    public void test() {
-        try {
-            // Taken from Mauve gnu.testlet.java.lang.System.arraycopy
-            int[] a = new int[5];
-            int[] b = new int[5];
-            System.arraycopy(a, 4, b, 4, Integer.MAX_VALUE);
-            fail("Should throw ArrayIndexOutOfBoundsException");
-        } catch (ArrayIndexOutOfBoundsException success) {
-        }
+import org.junit.Test;
+
+public class PR80 {
+    @Test ( expected = ArrayIndexOutOfBoundsException.class )
+    public void test() throws ArrayIndexOutOfBoundsException {
+        // Taken from Mauve gnu.testlet.java.lang.System.arraycopy
+        int[] a = new int[5];
+        int[] b = new int[5];
+        System.arraycopy(a, 4, b, 4, Integer.MAX_VALUE);
     }
 }