diff options
author | acolyer <acolyer> | 2005-11-09 10:37:51 +0000 |
---|---|---|
committer | acolyer <acolyer> | 2005-11-09 10:37:51 +0000 |
commit | 7a1002aba3960caddb4c50ef7e66cc9ac6fb1f58 (patch) | |
tree | 91f01070ab3ede67fde2db454b22941232636eae /tests/bugs150 | |
parent | f6968e6f134df55243c451e45c303600560e6d04 (diff) | |
download | aspectj-7a1002aba3960caddb4c50ef7e66cc9ac6fb1f58.tar.gz aspectj-7a1002aba3960caddb4c50ef7e66cc9ac6fb1f58.zip |
tests and fix for pr112756 - use of assert/enum as "identifier" in pointcut expression.
Diffstat (limited to 'tests/bugs150')
-rw-r--r-- | tests/bugs150/Pr112756.aj | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/tests/bugs150/Pr112756.aj b/tests/bugs150/Pr112756.aj new file mode 100644 index 000000000..f1ce5c7ae --- /dev/null +++ b/tests/bugs150/Pr112756.aj @@ -0,0 +1,47 @@ + +public aspect Pr112756 { + private ThreadLocal counts = new ThreadLocal(); + + public pointcut testMethodExecution() : + execution(void Test+.test*()); + + public pointcut assertCall() : + cflow(testMethodExecution()) && call(void Assert+.assert*(..)); + + void around() : testMethodExecution() { + counts.set( new Counter()); + + proceed(); + + if(((Counter) counts.get()).getCount()==0) { + throw new RuntimeException("No assertions had been called"); + } + } + + before() : assertCall() { + ((Counter) counts.get()).inc(); + } + +} + +class Assert { + + public static boolean assertEquals() { return true; } + public static boolean assertSame() { return true; } + +} + +class Test { + + public void testFoo() {} + +} + +class Counter { + + int count; + + public void inc() { count++; } + public int getCount() { return count; } + +}
\ No newline at end of file |