blob: b624c48393fcaa4aa39f46298bd22dc25284e8a4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
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);
}
}
|