summaryrefslogtreecommitdiffstats
path: root/tests/src
diff options
context:
space:
mode:
authoraclement <aclement>2005-04-19 10:42:09 +0000
committeraclement <aclement>2005-04-19 10:42:09 +0000
commitcc7e29f24ecb251265423cce1d1deffd98ace31a (patch)
tree001414006ff5c6a71bd93168373853ff3be7a54b /tests/src
parentcf9f154462313dc5cd54047c880551fc8439a68d (diff)
downloadaspectj-cc7e29f24ecb251265423cce1d1deffd98ace31a.tar.gz
aspectj-cc7e29f24ecb251265423cce1d1deffd98ace31a.zip
Andrew Huffs coverage tests for @AJ - not currently in RunTheseBeforeYouCommit due to failures.
Diffstat (limited to 'tests/src')
-rw-r--r--tests/src/org/aspectj/systemtest/ajc150/ataspectj/coverage/CoverageTests.java184
-rw-r--r--tests/src/org/aspectj/systemtest/ajc150/ataspectj/coverage/coverage.xml311
2 files changed, 495 insertions, 0 deletions
diff --git a/tests/src/org/aspectj/systemtest/ajc150/ataspectj/coverage/CoverageTests.java b/tests/src/org/aspectj/systemtest/ajc150/ataspectj/coverage/CoverageTests.java
new file mode 100644
index 000000000..4d2c960b3
--- /dev/null
+++ b/tests/src/org/aspectj/systemtest/ajc150/ataspectj/coverage/CoverageTests.java
@@ -0,0 +1,184 @@
+package org.aspectj.systemtest.ajc150.ataspectj.coverage;
+
+import java.io.File;
+
+import junit.framework.Test;
+
+import org.aspectj.testing.XMLBasedAjcTestCase;
+
+
+public class CoverageTests extends org.aspectj.testing.XMLBasedAjcTestCase {
+
+
+ public static Test suite() {
+ return XMLBasedAjcTestCase.loadSuite(CoverageTests.class);
+ }
+
+ protected File getSpecFile() {
+ return new File("../tests/src/org/aspectj/systemtest/ajc150/ataspectj/coverage/coverage.xml");
+ }
+
+
+ public void test001(){
+ runTest("@Aspect extending Aspect");
+ }
+
+ public void test002(){
+ runTest("@Aspect with codestyle pointcut");
+ }
+
+ public void test003(){
+ runTest("Codestyle Aspect with @Pointcut");
+}
+
+ public void test004(){
+ runTest("@Pointcut declared on codestyle advice");
+}
+
+ public void test005(){
+ runTest("@Aspect class extending @Aspect class");
+}
+
+ public void test006(){
+ runTest("class with @Before extending @Aspect class");
+}
+
+ public void test007(){
+ runTest("@Before declared on codestyle advice");
+}
+
+ public void test008(){
+ runTest("@Pointcut not returning void");
+}
+
+ public void test009(){
+ runTest("@Pointcut on @Aspect class constructor");
+}
+
+ public void test010(){
+ runTest("@Aspect on interface");
+}
+
+ public void test011(){
+ runTest("@Pointcut on non-aspect class method");
+}
+
+ public void test012(){
+ runTest("@Before on non-aspect class method");
+}
+
+ public void test013(){
+ runTest("@Pointcut on Interface method");
+}
+
+ public void test014(){
+ runTest("@Pointcut with garbage string");
+}
+
+ public void test015(){
+ runTest("@Pointcut with non-empty method body");
+}
+
+
+ public void test016(){
+ runTest("@Pointcut with throws clause");
+}
+
+ public void test017(){
+ runTest("@Aspect used badly");
+}
+
+ public void test018(){
+ runTest("@Before declared on @Aspect class constructor");
+}
+
+ public void test019(){
+ runTest("@AfterReturning with wrong number of args");
+}
+
+ public void test020(){
+ runTest("@Before on non-public method");
+}
+
+ public void test021(){
+ runTest("@Before on method not returning void");
+}
+ public void test022(){
+ runTest("@Pointcut with wrong number of args");
+}
+ public void test023(){
+ runTest("@DeclareParents with interface extending interface");
+}
+ public void test024(){
+ runTest("@DeclareParents implementing more than one interface");
+}
+ public void test025(){
+ runTest("@DeclareParents used outside of an Aspect");
+}
+ public void test026(){
+ runTest("@DeclareParents on an @Aspect");
+}
+ public void test027(){
+ runTest("@DeclareParents on an @Aspect with @DeclarePrecidence");
+}
+ public void test028(){
+ runTest("@DeclareWarning with a non-final String");
+}
+ public void test029(){
+ runTest("@DeclareWarning with a static final Object (that is a String)");
+}
+ public void test030(){
+ runTest("@DeclareWarning with a static final Integer");
+}
+ public void test031(){
+ runTest("@Around given an extension of ProceedingJoinPoint");
+}
+ public void test032(){
+ runTest("calling @Before advice explicitly as a method");
+}
+ public void test033(){
+ runTest("@Before on Interface method");
+}
+ public void test034(){
+ runTest("@Aspect Aspect double declaration");
+}
+ public void test035(){
+ runTest("@Before and @After on one method");
+}
+ public void test036(){
+ runTest("@Before twice on one method");
+}
+ public void test037(){
+ runTest("@Before advice with empty string");
+}
+public void test038(){
+ runTest("isPrivileged=truu misspelling");
+}
+
+public void test039(){
+ runTest("@Pointcut with an empty string");
+}
+
+public void test040(){
+ runTest("@Before with && in string");
+}
+
+public void test041(){
+ runTest("@AdviceName given an empty string");
+}
+
+public void test042(){
+ runTest("@AdviceName used on @Before advice");
+}
+
+public void test043(){
+ runTest("The Moody example");
+}
+
+public void test044(){
+ runTest("@DeclareWarning");
+}
+
+
+
+}
diff --git a/tests/src/org/aspectj/systemtest/ajc150/ataspectj/coverage/coverage.xml b/tests/src/org/aspectj/systemtest/ajc150/ataspectj/coverage/coverage.xml
new file mode 100644
index 000000000..abea29b4b
--- /dev/null
+++ b/tests/src/org/aspectj/systemtest/ajc150/ataspectj/coverage/coverage.xml
@@ -0,0 +1,311 @@
+<!DOCTYPE suite SYSTEM "../tests/ajcTestSuite.dtd"[]>
+
+<!-- AspectJ v1.5.0 Tests -->
+
+<suite>
+
+ <ajc-test dir="java5/ataspectj/coverage"
+ pr="" title="@Aspect extending Aspect">
+ <compile files="Test001.java" options="-1.5">
+ </compile>
+ </ajc-test>
+
+ <ajc-test dir="java5/ataspectj/coverage"
+ pr="" title="@Aspect with codestyle pointcut">
+ <compile files="Test002.java" options="-1.5">
+ </compile>
+ </ajc-test>
+
+ <ajc-test dir="java5/ataspectj/coverage"
+ pr="" title="Codestyle Aspect with @Pointcut">
+ <compile files="Test003.java" options="-1.5">
+ </compile>
+ </ajc-test>
+
+ <ajc-test dir="java5/ataspectj/coverage"
+ pr="" title="@Pointcut declared on codestyle advice">
+ <compile files="Test004.java" options="-1.5">
+ <message kind="error" line="7" text="Can't declare @Pointcut on advice"/>
+ </compile>
+ </ajc-test>
+
+ <ajc-test dir="java5/ataspectj/coverage"
+ pr="" title="@Aspect class extending @Aspect class">
+ <compile files="Test005.java" options="-1.5">
+ </compile>
+ </ajc-test>
+
+ <ajc-test dir="java5/ataspectj/coverage"
+ pr="" title="class with @Before extending @Aspect class">
+ <compile files="Test006.java" options="-1.5">
+ <message kind="error" line="8" text="class 'B' can not extend aspect 'A'"/>
+ </compile>
+ </ajc-test>
+
+ <ajc-test dir="java5/ataspectj/coverage"
+ pr="" title="@Before declared on codestyle advice">
+ <compile files="Test007.java" options="-1.5">
+ <message kind="error" line="7" text="@Before declaration should be followed by a method"/>
+ </compile>
+ </ajc-test>
+
+ <ajc-test dir="java5/ataspectj/coverage"
+ pr="" title="@Pointcut not returning void">
+ <compile files="Test008.java" options="-1.5">
+ <message kind="error" line="8" text="Method following @Pointcut should have a void return type"/>
+ </compile>
+ </ajc-test>
+
+ <ajc-test dir="java5/ataspectj/coverage"
+ pr="" title="@Pointcut on @Aspect class constructor">
+ <compile files="Test009.java" options="-1.5">
+ <message kind="error" line="7" text="The annotation @Pointcut is disallowed for this location"/>
+ </compile>
+ </ajc-test>
+
+ <ajc-test dir="java5/ataspectj/coverage"
+ pr="" title="@Aspect on interface">
+ <compile files="Test010.java" options="-1.5">
+ <message kind="error" line="6" text="The annotation @Aspect must be followed by a class declaration"/>
+ </compile>
+ </ajc-test>
+
+ <ajc-test dir="java5/ataspectj/coverage"
+ pr="" title="@Pointcut on non-aspect class method">
+ <compile files="Test011.java" options="-1.5">
+ <message kind="error" line="6" text="The annotation @Pointcut is disallowed for this location"/>
+ </compile>
+ </ajc-test>
+
+ <ajc-test dir="java5/ataspectj/coverage"
+ pr="" title="@Before on non-aspect class method">
+ <compile files="Test012.java" options="-1.5">
+ <message kind="error" line="6" text="The annotation @Before is disallowed for this location"/>
+ </compile>
+ </ajc-test>
+
+ <ajc-test dir="java5/ataspectj/coverage"
+ pr="" title="@Pointcut on Interface method">
+ <compile files="Test013.java" options="-1.5">
+ <message kind="error" line="6" text="The annotation @Pointcut is disallowed for this location"/>
+ </compile>
+ </ajc-test>
+
+ <ajc-test dir="java5/ataspectj/coverage"
+ pr="" title="@Pointcut with garbage string">
+ <compile files="Test014.java" options="-1.5">
+ <message kind="error" line="7" text="String literal is not properly closed by a double-quote"/>
+ <message kind="error" line="8" text="Syntax error, insert &quot;}&quot; to complete BlockStatements"/>
+ </compile>
+ </ajc-test>
+
+ <ajc-test dir="java5/ataspectj/coverage"
+ pr="" title="@Pointcut with non-empty method body">
+ <compile files="Test015.java" options="-1.5">
+ <message kind="error" line="9" text="@Pointcut method body must be empty"/>
+ </compile>
+ </ajc-test>
+
+ <ajc-test dir="java5/ataspectj/coverage"
+ pr="" title="@Pointcut with throws clause">
+ <compile files="Test016.java" options="-1.5">
+ <message kind="error" line="8" text="@Pointcut method cannot throw anything"/>
+ </compile>
+ </ajc-test>
+
+ <ajc-test dir="java5/ataspectj/coverage"
+ pr="" title="@Aspect used badly">
+ <compile files="Test017.java" options="-1.5">
+ <message kind="error" line="5" text="Syntax error, insert &quot;interface JavaIdentifier&quot; to complete InterfaceHeader"/>
+ </compile>
+ </ajc-test>
+
+ <ajc-test dir="java5/ataspectj/coverage"
+ pr="" title="@Before declared on @Aspect class constructor">
+ <compile files="Test018.java" options="-1.5">
+ <message kind="error" line="7" text="The annotation @Before is disallowed for this location"/>
+ </compile>
+ </ajc-test>
+
+ <ajc-test dir="java5/ataspectj/coverage"
+ pr="" title="@AfterReturning with wrong number of args">
+ <compile files="Test019.java" options="-1.5">
+ <message kind="error" line="5" text="formal unbound in pointcut"/>
+ </compile>
+ </ajc-test>
+
+ <ajc-test dir="java5/ataspectj/coverage"
+ pr="" title="@Before on non-public method">
+ <compile files="Test020.java" options="-1.5">
+ <message kind="error" line="6" text="@Before must be declared on a public method"/>
+ </compile>
+ </ajc-test>
+
+ <ajc-test dir="java5/ataspectj/coverage"
+ pr="" title="@Before on method not returning void">
+ <compile files="Test021.java" options="-1.5">
+ <message kind="error" line="6" text="@Before must be declared on a method returning void"/>
+ </compile>
+ </ajc-test>
+
+ <ajc-test dir="java5/ataspectj/coverage"
+ pr="" title="@Pointcut with wrong number of args">
+ <compile files="Test022.java" options="-1.5">
+ <message kind="error" line="8" text="int x is not declared in the pointcut parameters"/>
+ </compile>
+ </ajc-test>
+
+ <ajc-test dir="java5/ataspectj/coverage"
+ pr="" title="@DeclareParents with interface extending interface">
+ <compile files="Test023.java" options="-1.5">
+ <message kind="error" line="11" text="@DeclareParents must be called before a class implementing a single interface"/>
+ </compile>
+ </ajc-test>
+
+ <ajc-test dir="java5/ataspectj/coverage"
+ pr="" title="@DeclareParents with interface extending interface">
+ <compile files="Test024.java" options="-1.5">
+ <message kind="error" line="13" text="@DeclareParents must be called before a class implementing a single interface"/>
+ </compile>
+ </ajc-test>
+
+ <ajc-test dir="java5/ataspectj/coverage"
+ pr="" title="@DeclareParents used outside of an Aspect">
+ <compile files="Test025.java" options="-1.5">
+ <message kind="error" line="9" text="@DeclareParents must be called inside an aspect"/>
+ </compile>
+ </ajc-test>
+
+ <ajc-test dir="java5/ataspectj/coverage"
+ pr="" title="@DeclareParents on an @Aspect">
+ <compile files="Test026.java" options="-1.5">
+ <message kind="error" line="11" text="@DeclareParents must be called before a class implementing a single interface"/>
+ </compile>
+ </ajc-test>
+
+ <ajc-test dir="java5/ataspectj/coverage"
+ pr="" title="@DeclareParents on an @Aspect with @DeclarePrecidence">
+ <compile files="Test027.java" options="-1.5">
+ <message kind="error" line="12" text="@DeclareParents must be called before a class implementing a single interface"/>
+ </compile>
+ </ajc-test>
+
+ <ajc-test dir="java5/ataspectj/coverage"
+ pr="" title="@DeclareWarning with a non-final String">
+ <compile files="Test028.java" options="-1.5">
+ <message kind="error" line="6" text="@DeclareWarning must be called before a static final String"/>
+ </compile>
+ </ajc-test>
+
+ <ajc-test dir="java5/ataspectj/coverage"
+ pr="" title="@DeclareWarning with a static final Object (that is a String)">
+ <compile files="Test029.java" options="-1.5">
+ <message kind="error" line="7" text="Is this an error?"/>
+ </compile>
+ </ajc-test>
+
+ <ajc-test dir="java5/ataspectj/coverage"
+ pr="" title="@DeclareWarning with a static final Integer">
+ <compile files="Test030.java" options="-1.5">
+ <message kind="error" line="6" text="@DeclareWarning must be called before a static final String"/>
+ </compile>
+ </ajc-test>
+
+ <ajc-test dir="java5/ataspectj/coverage"
+ pr="" title="@Around given an extension of ProceedingJoinPoint">
+ <compile files="Test031.java" options="-1.5">
+ <message kind="error" line="9" text="Is this an error?"/>
+ </compile>
+ </ajc-test>
+
+ <ajc-test dir="java5/ataspectj/coverage"
+ pr="" title="calling @Before advice explicitly as a method">
+ <compile files="Test032.java" options="-1.5">
+ <message kind="error" line="14" text="Advice should never be called explicitly"/>
+ </compile>
+ </ajc-test>
+
+ <ajc-test dir="java5/ataspectj/coverage"
+ pr="" title="@Before on Interface method">
+ <compile files="Test033.java" options="-1.5">
+ <message kind="error" line="4" text="The annotation @Before is disallowed for this location"/>
+ </compile>
+ </ajc-test>
+
+ <ajc-test dir="java5/ataspectj/coverage"
+ pr="" title="@Aspect Aspect double declaration">
+ <compile files="Test034.java" options="-1.5">
+ <message kind="error" line="5" text="The annotation @Aspect is only allowed before a class definition"/>
+ </compile>
+ </ajc-test>
+
+ <ajc-test dir="java5/ataspectj/coverage"
+ pr="" title="@Before and @After on one method">
+ <compile files="Test035.java" options="-1.5">
+ <message kind="error" line="7" text="A method may only be declared as advice once"/>
+ </compile>
+ </ajc-test>
+
+ <ajc-test dir="java5/ataspectj/coverage"
+ pr="" title="@Before twice on one method">
+ <compile files="Test036.java" options="-1.5">
+ <message kind="error" line="7" text="A method may only be declared as advice once"/>
+ </compile>
+ </ajc-test>
+
+ <ajc-test dir="java5/ataspectj/coverage"
+ pr="" title="@Before advice with empty string">
+ <compile files="Test037.java" options="-1.5">
+ </compile>
+ </ajc-test>
+
+ <ajc-test dir="java5/ataspectj/coverage"
+ pr="" title="isPrivileged=truu misspelling">
+ <compile files="Test038.java" options="-1.5">
+ <message kind="error" line="5" text="truu is undefined"/>
+ </compile>
+ </ajc-test>
+
+ <ajc-test dir="java5/ataspectj/coverage"
+ pr="" title="@Pointcut with an empty string">
+ <compile files="Test039.java" options="-1.5">
+ </compile>
+ </ajc-test>
+
+ <ajc-test dir="java5/ataspectj/coverage"
+ pr="" title="@Before with &amp;&amp; in string">
+ <compile files="Test040.java" options="-1.5">
+ </compile>
+ </ajc-test>
+
+ <ajc-test dir="java5/ataspectj/coverage"
+ pr="" title="@AdviceName given an empty string">
+ <compile files="Test041.java" options="-1.5">
+ </compile>
+ </ajc-test>
+
+ <ajc-test dir="java5/ataspectj/coverage"
+ pr="" title="@AdviceName used on @Before advice">
+ <compile files="Test042.java" options="-1.5">
+ <message kind="error" line="6" text="The @AdviceName annotation can only be used before codestyle advice"/>
+ </compile>
+ </ajc-test>
+
+ <ajc-test dir="java5/ataspectj/coverage"
+ pr="" title="The Moody example">
+ <compile files="Test043.java" options="-1.5">
+ </compile>
+ </ajc-test>
+
+ <ajc-test dir="java5/ataspectj/coverage"
+ pr="" title="@DeclareWarning">
+ <compile files="Test044.java" options="-1.5">
+ <message kind="warning" line="13" text="This call is warned"/>
+ </compile>
+ </ajc-test>
+
+
+
+
+
+</suite>