aboutsummaryrefslogtreecommitdiffstats
path: root/tests/design/around/StackChecker.java
blob: e55c64055d1571c662f2e807139a8e1ed5669fe7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import org.aspectj.testing.Tester;

public class StackChecker {
    static int baseStackDepth = 0;

    public static void setBaseDepth() {
        int depth = new Throwable().getStackTrace().length - 2; // XXX 1.4 only
        baseStackDepth = depth;
    }


    public static void checkDepth(int expectedDepth, String message) {
        int depth = new Throwable().getStackTrace().length - 1 - baseStackDepth;
        Tester.checkEqual(depth, expectedDepth, message);
    }
}