added unit tests

git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@115202 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
vmassol committed 2004-05-07 23:09:22 +00:00
1 parent 262cc4b4ad
commit 09db0e6e3a
6 files changed
+197

No files matched your search

+26
View File
@@ -0,0 +1,26 @@
<!--
/*
* Copyright 2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-->
<project xmlns:util="jelly:util" xmlns:j="jelly:core">
<goal name="testPlugin" prereqs="clean,test-aspectj-weave">
</goal>
<goal name="test-aspectj-weave" prereqs="java:compile,aspectj:compile,test:test">
</goal>
</project>
@@ -0,0 +1,15 @@
# -------------------------------------------------------------------
# Copyright 2004 The Apache Software Foundation.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# -------------------------------------------------------------------
+66
View File
@@ -0,0 +1,66 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/*
* Copyright 2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-->
<project>
<pomVersion>3</pomVersion>
<id>test-maven-aspectj-plugin</id>
<name>Test project for Maven AspectJ Plugin</name>
<groupId>maven</groupId>
<currentVersion>1.0-SNAPSHOT</currentVersion>
<organization>
<name>Apache Software Foundation</name>
<url>http://www.apache.org/</url>
<logo>http://maven.apache.org/images/jakarta-logo-blue.gif</logo>
</organization>
<inceptionYear>2001</inceptionYear>
<package>org.apache.maven</package>
<logo>http://maven.apache.org/images/maven.jpg</logo>
<description>Test for Maven AspectJ plugin</description>
<shortDescription>Test for Maven AspectJ plugin</shortDescription>
<url>http://maven.apache.org/reference/plugins/aspectj/</url>
<siteDirectory>/www/maven.apache.org/reference/plugins/aspectj/</siteDirectory>
<repository>
<connection>scm:cvs:pserver:anoncvs@cvs.apache.org:/home/cvspublic:maven/src/plugins-build/aspectj/</connection>
<url>http://cvs.apache.org/viewcvs/maven/src/plugins-build/aspectj/</url>
</repository>
<developers>
<developer>
<name>Vincent Massol</name>
<id>vmassol</id>
<email>vmassol@pivolis.com</email>
<organization>Pivolis</organization>
<roles>
<role>Java Developer</role>
</roles>
</developer>
</developers>
<dependencies>
<dependency>
<groupId>aspectj</groupId>
<artifactId>aspectjrt</artifactId>
<version>1.2rc1</version>
</dependency>
</dependencies>
<build>
<sourceDirectory>src/main</sourceDirectory>
<unitTestSourceDirectory>src/test</unitTestSourceDirectory>
<aspectSourceDirectory>src/aspect</aspectSourceDirectory>
</build>
</project>
@@ -0,0 +1,29 @@
package org.apache.maven.aspectj;
/* ====================================================================
* Copyright 2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ====================================================================
*/
public aspect Sample
{
pointcut testPointcut() :
execution(public * org.apache.maven.aspectj.Dummy.someMethod());
before() : testPointcut()
{
throw new RuntimeException("test exception voluntarily raised and that should caught in the test case");
}
}
@@ -0,0 +1,25 @@
package org.apache.maven.aspectj;
/* ====================================================================
* Copyright 2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ====================================================================
*/
public class Dummy
{
public void someMethod()
{
}
}
@@ -0,0 +1,36 @@
package org.apache.maven.aspectj;
/* ====================================================================
* Copyright 2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ====================================================================
*/
import junit.framework.TestCase;
public class AspectTest extends TestCase
{
public void testAspectIsCorrectlyWeaved()
{
Dummy dummy = new Dummy();
try
{
dummy.someMethod();
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());
}
}
}