summaryrefslogtreecommitdiffstats
path: root/tests/new/PR691.java
diff options
context:
space:
mode:
Diffstat (limited to 'tests/new/PR691.java')
-rw-r--r--tests/new/PR691.java49
1 files changed, 49 insertions, 0 deletions
diff --git a/tests/new/PR691.java b/tests/new/PR691.java
new file mode 100644
index 000000000..b624c4839
--- /dev/null
+++ b/tests/new/PR691.java
@@ -0,0 +1,49 @@
+
+import org.aspectj.testing.*;
+
+/** @testcase PR#691 around AST type XXX */
+public class PR691 {
+ public static void main (String[] args) {
+ Tester.expectEvent("around");
+ new MailerTest().run(new TestResult());
+ Tester.checkAllEvents();
+ }
+
+}
+class TestResult {}
+class Message {}
+class MailerTest {
+ public void run(TestResult result) {
+ new Mailer().sendTextMail();
+ }
+}
+class Mailer {
+ public void sendTextMail(){
+ new Transport().send(new Message());
+ }
+}
+class Transport { public void send(Message m){ } }
+
+aspect Mail {
+ pointcut inThisTestCase(MailerTest testCase) :
+ call(* MailerTest.run(TestResult))
+ && target(testCase);
+
+ pointcut flowOfTestCase(MailerTest testCase) :
+ cflow(inThisTestCase(testCase));
+
+ pointcut sendMailCall() : call(void Mailer.sendTextMail(..));
+ pointcut transportSend(Message msg) :
+ call(void Transport.send(Message)) && args(msg);
+
+ // no bug if no testCase context
+ //void around(Message msg) :
+ // flowOfTestCase(MailerTest)
+ void around(Message msg, final MailerTest testCase) :
+ flowOfTestCase(testCase)
+ && cflow(sendMailCall())
+ && transportSend(msg) {
+ Tester.event("around");
+ proceed(msg,testCase);
+ }
+}