]> source.dussan.org Git - aspectj.git/commitdiff
Add module tests back in - but streamlined
authorAndy Clement <aclement@pivotal.io>
Fri, 1 Feb 2019 00:38:43 +0000 (16:38 -0800)
committerAndy Clement <aclement@pivotal.io>
Fri, 1 Feb 2019 00:38:43 +0000 (16:38 -0800)
runtime/pom.xml
runtime/src/test/java/org/aspectj/runtime/RuntimeModuleTest.java [deleted file]
runtime/src/test/java/org/aspectj/runtime/RuntimeModuleTests.java [new file with mode: 0644]
runtime/src/test/java/org/aspectj/runtime/RuntimeTest.java [new file with mode: 0644]

index 2abf9ec1b17d4d0291fdb3a347413ebfa4165ce7..d90092aab9154a43791d6e40913d2b108102dea5 100644 (file)
@@ -14,7 +14,6 @@
   <packaging>jar</packaging>
   <name>runtime</name>
 
-
   <dependencies>
     <dependency>
       <groupId>org.aspectj</groupId>
diff --git a/runtime/src/test/java/org/aspectj/runtime/RuntimeModuleTest.java b/runtime/src/test/java/org/aspectj/runtime/RuntimeModuleTest.java
deleted file mode 100644 (file)
index 97e1750..0000000
+++ /dev/null
@@ -1,77 +0,0 @@
-package org.aspectj.runtime;
-/* *******************************************************************
- * Copyright (c) 1999-2001 Xerox Corporation, 
- *               2002 Palo Alto Research Center, Incorporated (PARC).
- * All rights reserved. 
- * This program and the accompanying materials are made available 
- * under the terms of the Eclipse Public License v1.0 
- * which accompanies this distribution and is available at 
- * http://www.eclipse.org/legal/epl-v10.html 
- *  
- * Contributors: 
- *     Xerox/PARC     initial implementation 
- * ******************************************************************/
-
-import java.io.*;
-
-import org.aspectj.lang.*;
-import org.aspectj.runtime.reflect.JoinPointImplTest;
-import org.aspectj.runtime.reflect.RuntimePerformanceTest;
-import org.aspectj.runtime.reflect.SignatureTest;
-
-import junit.framework.*;
-
-public class RuntimeModuleTest extends TestCase {
-
-    public RuntimeModuleTest(String name) { super(name); }
-    
-    public void testNoAspectBoundException() {
-        RuntimeException fun = new RuntimeException("fun");
-        NoAspectBoundException nab = new NoAspectBoundException("Foo", fun);
-        assertEquals(fun,nab.getCause());
-    }
-
-    public void testSoftExceptionPrintStackTrace() {
-        // let's see
-//        Throwable t = new Error("xyz");       
-//        new SoftException(t).printStackTrace();
-
-        // save to specified PrintStream
-        ByteArrayOutputStream sink = new ByteArrayOutputStream();
-        PrintStream out = new PrintStream(sink);
-        new SoftException(new Error("xyz")).printStackTrace(out);
-        String s = new String(sink.toByteArray());
-        out.flush();
-        checkSoftExceptionString(s);
-
-        // save to specified PrintWriter
-        sink = new ByteArrayOutputStream();
-        PrintWriter pout = new PrintWriter(sink);
-        new SoftException(new Error("xyz")).printStackTrace(pout);
-        pout.flush();
-        s = new String(sink.toByteArray());
-        checkSoftExceptionString(s);
-
-        // check System.err redirect
-        PrintStream systemErr = System.err;
-        try {
-            sink = new ByteArrayOutputStream();
-            out = new PrintStream(sink);
-            System.setErr(out);
-            new SoftException(new Error("xyz")).printStackTrace();
-            out.flush();
-            s = new String(sink.toByteArray());
-            checkSoftExceptionString(s);
-        } finally {
-            System.setErr(systemErr);
-        }
-    }
-   
-    
-    static void checkSoftExceptionString(String s) {        
-        assertTrue(-1 != s.indexOf("SoftException"));
-        assertTrue(-1 != s.indexOf("Caused by: java.lang.Error"));
-        assertTrue(-1 != s.indexOf("xyz"));
-        assertTrue(-1 != s.indexOf("testSoftExceptionPrintStackTrace"));
-    }
-}  
diff --git a/runtime/src/test/java/org/aspectj/runtime/RuntimeModuleTests.java b/runtime/src/test/java/org/aspectj/runtime/RuntimeModuleTests.java
new file mode 100644 (file)
index 0000000..bffd5c5
--- /dev/null
@@ -0,0 +1,41 @@
+package org.aspectj.runtime;
+/* *******************************************************************
+ * Copyright (c) 1999-2001 Xerox Corporation, 
+ *               2002 Palo Alto Research Center, Incorporated (PARC).
+ * All rights reserved. 
+ * This program and the accompanying materials are made available 
+ * under the terms of the Eclipse Public License v1.0 
+ * which accompanies this distribution and is available at 
+ * http://www.eclipse.org/legal/epl-v10.html 
+ *  
+ * Contributors: 
+ *     Xerox/PARC     initial implementation 
+ * ******************************************************************/
+
+import org.aspectj.internal.lang.reflect.AjTypeTest;
+import org.aspectj.internal.lang.reflect.AjTypeWithAspectsTest;
+import org.aspectj.internal.lang.reflect.InterTypeTest;
+import org.aspectj.runtime.reflect.JoinPointImplTest;
+import org.aspectj.runtime.reflect.RuntimePerformanceTest;
+import org.aspectj.runtime.reflect.SignatureTest;
+
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+public class RuntimeModuleTests extends TestCase {
+
+    public static TestSuite suite() { 
+        TestSuite suite = new TestSuite(RuntimeModuleTests.class.getName());
+        suite.addTestSuite(RuntimeTest.class);
+        suite.addTestSuite(SignatureTest.class);
+               suite.addTestSuite(JoinPointImplTest.class);
+               suite.addTestSuite(RuntimePerformanceTest.class);
+               suite.addTestSuite(AjTypeTest.class);
+               suite.addTestSuite(AjTypeWithAspectsTest.class);
+               suite.addTestSuite(InterTypeTest.class);
+        return suite;
+    }
+
+    public RuntimeModuleTests(String name) { super(name); }
+
+}  
diff --git a/runtime/src/test/java/org/aspectj/runtime/RuntimeTest.java b/runtime/src/test/java/org/aspectj/runtime/RuntimeTest.java
new file mode 100644 (file)
index 0000000..a908a8a
--- /dev/null
@@ -0,0 +1,77 @@
+package org.aspectj.runtime;
+/* *******************************************************************
+ * Copyright (c) 1999-2001 Xerox Corporation, 
+ *               2002 Palo Alto Research Center, Incorporated (PARC).
+ * All rights reserved. 
+ * This program and the accompanying materials are made available 
+ * under the terms of the Eclipse Public License v1.0 
+ * which accompanies this distribution and is available at 
+ * http://www.eclipse.org/legal/epl-v10.html 
+ *  
+ * Contributors: 
+ *     Xerox/PARC     initial implementation 
+ * ******************************************************************/
+
+import java.io.*;
+
+import org.aspectj.lang.*;
+import org.aspectj.runtime.reflect.JoinPointImplTest;
+import org.aspectj.runtime.reflect.RuntimePerformanceTest;
+import org.aspectj.runtime.reflect.SignatureTest;
+
+import junit.framework.*;
+
+public class RuntimeTest extends TestCase {
+
+    public RuntimeTest(String name) { super(name); }
+    
+    public void testNoAspectBoundException() {
+        RuntimeException fun = new RuntimeException("fun");
+        NoAspectBoundException nab = new NoAspectBoundException("Foo", fun);
+        assertEquals(fun,nab.getCause());
+    }
+
+    public void testSoftExceptionPrintStackTrace() {
+        // let's see
+//        Throwable t = new Error("xyz");       
+//        new SoftException(t).printStackTrace();
+
+        // save to specified PrintStream
+        ByteArrayOutputStream sink = new ByteArrayOutputStream();
+        PrintStream out = new PrintStream(sink);
+        new SoftException(new Error("xyz")).printStackTrace(out);
+        String s = new String(sink.toByteArray());
+        out.flush();
+        checkSoftExceptionString(s);
+
+        // save to specified PrintWriter
+        sink = new ByteArrayOutputStream();
+        PrintWriter pout = new PrintWriter(sink);
+        new SoftException(new Error("xyz")).printStackTrace(pout);
+        pout.flush();
+        s = new String(sink.toByteArray());
+        checkSoftExceptionString(s);
+
+        // check System.err redirect
+        PrintStream systemErr = System.err;
+        try {
+            sink = new ByteArrayOutputStream();
+            out = new PrintStream(sink);
+            System.setErr(out);
+            new SoftException(new Error("xyz")).printStackTrace();
+            out.flush();
+            s = new String(sink.toByteArray());
+            checkSoftExceptionString(s);
+        } finally {
+            System.setErr(systemErr);
+        }
+    }
+   
+    
+    static void checkSoftExceptionString(String s) {        
+        assertTrue(-1 != s.indexOf("SoftException"));
+        assertTrue(-1 != s.indexOf("Caused by: java.lang.Error"));
+        assertTrue(-1 != s.indexOf("xyz"));
+        assertTrue(-1 != s.indexOf("testSoftExceptionPrintStackTrace"));
+    }
+}