summaryrefslogtreecommitdiffstats
path: root/tests/new/pack/PackageWildcards.java
blob: 6493920721dd871ec95e12b6d5795145111acf8f (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
package pack;

import org.aspectj.testing.Tester;

public aspect PackageWildcards {
    pointcut fooCut(): call(String foo());

    String around(): fooCut() && within(*) {
            String result = proceed();
            return result + ":fooCut";
    }

    pointcut allMethodsCut(): target(Foo) && call(!abstract String *(..));

    String around(): allMethodsCut() {
            String result = proceed();
            return result + ":allMethodsCut";
    }

    public static void test() {
        String message = new Foo().foo();
        //System.out.println(message);
        Tester.checkEqual(message, "foo:allMethodsCut:fooCut", "all advice active");
    }

    public static void main(String[] args) {
        test();
    }
}

class Foo {
    String foo() { return "foo"; }
}