Added test for aspectj:test-compile
git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@115707 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
1 parent
a1e7950bf0
commit
8946b13562
3 files changed
+36
-7
No files matched your search
@@ -17,10 +17,13 @@
|
||||
-->
|
||||
<project xmlns:util="jelly:util" xmlns:j="jelly:core">
|
||||
|
||||
<goal name="testPlugin" prereqs="clean,test-aspectj-weave">
|
||||
<goal name="testPlugin" prereqs="clean,test-aspectj-compile">
|
||||
</goal>
|
||||
|
||||
<goal name="test-aspectj-weave" prereqs="java:compile,aspectj:compile,test:test">
|
||||
<goal name="test-aspectj-compile">
|
||||
<attainGoal name="aspectj:test-compile"/>
|
||||
<attainGoal name="test:test"/>
|
||||
<attainGoal name="clean"/>
|
||||
</goal>
|
||||
|
||||
</project>
|
||||
@@ -19,11 +19,18 @@ package org.apache.maven.aspectj;
|
||||
|
||||
public aspect Sample
|
||||
{
|
||||
pointcut testPointcut() :
|
||||
pointcut srcPointcut() :
|
||||
execution(public * org.apache.maven.aspectj.Dummy.someMethod());
|
||||
pointcut testPointcut() :
|
||||
execution(public * org.apache.maven.aspectj.AspectTest.someMethod());
|
||||
|
||||
before() : srcPointcut()
|
||||
{
|
||||
throw new RuntimeException("test exception voluntarily raised and that should be caught in the test case");
|
||||
}
|
||||
|
||||
before() : testPointcut()
|
||||
{
|
||||
throw new RuntimeException("test exception voluntarily raised and that should caught in the test case");
|
||||
throw new RuntimeException("test exception voluntarily raised and that should be caught in the test case");
|
||||
}
|
||||
}
|
||||
@@ -20,7 +20,11 @@ import junit.framework.TestCase;
|
||||
|
||||
public class AspectTest extends TestCase
|
||||
{
|
||||
public void testAspectIsCorrectlyWeaved()
|
||||
|
||||
private static final String EXCEPTION_MESSAGE = "test exception " +
|
||||
"voluntarily raised and that should be caught in the test case";
|
||||
|
||||
public void testSourceIsCorrectlyWeaved()
|
||||
{
|
||||
Dummy dummy = new Dummy();
|
||||
try
|
||||
@@ -29,8 +33,23 @@ public class AspectTest extends TestCase
|
||||
fail("The Aspect should have thrown an exception");
|
||||
} catch (Exception expected)
|
||||
{
|
||||
assertEquals("test exception voluntarily raised and that should "
|
||||
+ "caught in the test case", expected.getMessage());
|
||||
assertEquals(EXCEPTION_MESSAGE, expected.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public void testTestIsCorrectlyWeaved()
|
||||
{
|
||||
try
|
||||
{
|
||||
this.someMethod();
|
||||
fail("The Aspect should have thrown an exception");
|
||||
} catch (Exception expected)
|
||||
{
|
||||
assertEquals(EXCEPTION_MESSAGE, expected.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public void someMethod()
|
||||
{
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user