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

@@ -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());
}
}
}