moving unit tests from .testsuite -> .aop

This commit is contained in:
Chris Beams 2008-12-11 23:35:15 +00:00
parent c373688c00
commit 7bba0b7a69
3 changed files with 26 additions and 8 deletions

View File

@ -16,17 +16,20 @@
package org.springframework.aop.aspectj;
import junit.framework.TestCase;
import static org.junit.Assert.*;
import org.junit.Test;
import org.springframework.beans.TestBean;
/**
* Tests for matching of bean() pointcut designator.
*
* @author Ramnivas Laddad
* @author Chris Beams
*/
public class BeanNamePointcutMatchingTests extends TestCase {
public class BeanNamePointcutMatchingTests {
@Test
public void testMatchingPointcuts() {
assertMatch("someName", "bean(someName)");
@ -61,6 +64,7 @@ public class BeanNamePointcutMatchingTests extends TestCase {
assertMatch("someName", "bean(someName) && !bean(someOtherName)");
}
@Test
public void testNonMatchingPointcuts() {
assertMisMatch("someName", "bean(someNamex)");
assertMisMatch("someName", "bean(someX*Name)");
@ -82,7 +86,8 @@ public class BeanNamePointcutMatchingTests extends TestCase {
matches(beanName, pcExpression));
}
private static boolean matches(final String beanName, String pcExpression) {
private static boolean matches(final String beanName, String pcExpression) {
@SuppressWarnings("serial")
AspectJExpressionPointcut pointcut = new AspectJExpressionPointcut() {
protected String getCurrentProxiedBeanName() {
return beanName;

View File

@ -16,7 +16,9 @@
package org.springframework.aop.aspectj.autoproxy;
import junit.framework.TestCase;
import static org.junit.Assert.*;
import org.junit.Test;
import org.springframework.beans.ITestBean;
import org.springframework.aop.support.AopUtils;
import org.springframework.context.support.ClassPathXmlApplicationContext;
@ -27,8 +29,9 @@ import java.io.IOException;
* @author Rob Harrop
* @since 2.0
*/
public class AtAspectJAfterThrowingTests extends TestCase {
public class AtAspectJAfterThrowingTests {
@Test
public void testAccessThrowable() throws Exception {
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("afterThrowingAdviceTests.xml", getClass());

View File

@ -16,8 +16,9 @@
package org.springframework.aop.aspectj.autoproxy.benchmark;
import junit.framework.TestCase;
import static org.junit.Assert.*;
import org.junit.Test;
import org.springframework.aop.framework.Advised;
import org.springframework.aop.support.AopUtils;
import org.springframework.beans.ITestBean;
@ -25,12 +26,13 @@ import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.util.StopWatch;
/**
* Tests for AspectJ auto proxying. Includes mixing with Spring AOP
* Integration tests for AspectJ auto proxying. Includes mixing with Spring AOP
* Advisors to demonstrate that existing autoproxying contract is honoured.
*
* @author Rod Johnson
* @author Chris Beams
*/
public class BenchmarkTests extends TestCase {
public class BenchmarkTests {
private static final String ASPECTJ_CONTEXT = "/org/springframework/aop/aspectj/autoproxy/benchmark/aspectj.xml";
@ -43,34 +45,42 @@ public class BenchmarkTests extends TestCase {
return 10;
}
@Test
public void testRepeatedAroundAdviceInvocationsWithAspectJ() {
testRepeatedAroundAdviceInvocations(ASPECTJ_CONTEXT, getCount(), "AspectJ");
}
@Test
public void testRepeatedAroundAdviceInvocationsWithSpringAop() {
testRepeatedAroundAdviceInvocations(SPRING_AOP_CONTEXT, getCount(), "Spring AOP");
}
@Test
public void testRepeatedBeforeAdviceInvocationsWithAspectJ() {
testBeforeAdviceWithoutJoinPoint(ASPECTJ_CONTEXT, getCount(), "AspectJ");
}
@Test
public void testRepeatedBeforeAdviceInvocationsWithSpringAop() {
testBeforeAdviceWithoutJoinPoint(SPRING_AOP_CONTEXT, getCount(), "Spring AOP");
}
@Test
public void testRepeatedAfterReturningAdviceInvocationsWithAspectJ() {
testAfterReturningAdviceWithoutJoinPoint(ASPECTJ_CONTEXT, getCount(), "AspectJ");
}
@Test
public void testRepeatedAfterReturningAdviceInvocationsWithSpringAop() {
testAfterReturningAdviceWithoutJoinPoint(SPRING_AOP_CONTEXT, getCount(), "Spring AOP");
}
@Test
public void testRepeatedMixWithAspectJ() {
testMix(ASPECTJ_CONTEXT, getCount(), "AspectJ");
}
@Test
public void testRepeatedMixWithSpringAop() {
testMix(SPRING_AOP_CONTEXT, getCount(), "Spring AOP");
}