Add @Override annotations to test sources

Issue: SPR-10129
This commit is contained in:
Chris Beams
2012-12-28 13:59:24 +01:00
parent 6f0c7eb8c1
commit 4c8cd7b0bd
797 changed files with 4745 additions and 0 deletions

View File

@@ -113,6 +113,7 @@ public final class AspectJExpressionPointcutTests {
public static class OtherIOther implements IOther {
@Override
public void absquatulate() {
// Empty
}
@@ -354,6 +355,7 @@ class CallCountingInterceptor implements MethodInterceptor {
private int count;
@Override
public Object invoke(MethodInvocation methodInvocation) throws Throwable {
count++;
return methodInvocation.proceed();

View File

@@ -90,6 +90,7 @@ public final class BeanNamePointcutMatchingTests {
private static boolean matches(final String beanName, String pcExpression) {
@SuppressWarnings("serial")
AspectJExpressionPointcut pointcut = new AspectJExpressionPointcut() {
@Override
protected String getCurrentProxiedBeanName() {
return beanName;
}

View File

@@ -79,6 +79,7 @@ public final class MethodInvocationProceedingJoinPointTests {
pf.addAdvice(new MethodBeforeAdvice() {
private int depth;
@Override
public void before(Method method, Object[] args, Object target) throws Throwable {
JoinPoint jp = AbstractAspectJAdvice.currentJoinPoint();
assertTrue("Method named in toString", jp.toString().contains(method.getName()));
@@ -135,6 +136,7 @@ public final class MethodInvocationProceedingJoinPointTests {
ProxyFactory pf = new ProxyFactory(raw);
pf.addAdvisor(ExposeInvocationInterceptor.ADVISOR);
pf.addAdvice(new MethodBeforeAdvice() {
@Override
public void before(Method method, Object[] args, Object target) throws Throwable {
SourceLocation sloc = AbstractAspectJAdvice.currentJoinPoint().getSourceLocation();
assertEquals("Same source location must be returned on subsequent requests", sloc, AbstractAspectJAdvice.currentJoinPoint().getSourceLocation());
@@ -167,6 +169,7 @@ public final class MethodInvocationProceedingJoinPointTests {
ProxyFactory pf = new ProxyFactory(raw);
pf.addAdvisor(ExposeInvocationInterceptor.ADVISOR);
pf.addAdvice(new MethodBeforeAdvice() {
@Override
public void before(Method method, Object[] args, Object target) throws Throwable {
StaticPart staticPart = AbstractAspectJAdvice.currentJoinPoint().getStaticPart();
assertEquals("Same static part must be returned on subsequent requests", staticPart, AbstractAspectJAdvice.currentJoinPoint().getStaticPart());
@@ -186,6 +189,7 @@ public final class MethodInvocationProceedingJoinPointTests {
ProxyFactory pf = new ProxyFactory(raw);
pf.addAdvisor(ExposeInvocationInterceptor.ADVISOR);
pf.addAdvice(new MethodBeforeAdvice() {
@Override
public void before(Method method, Object[] args, Object target) throws Throwable {
// makeEncSJP, although meant for computing the enclosing join point,
// it serves our purpose here

View File

@@ -137,6 +137,7 @@ public class TrickyAspectJPointcutExpressionTests {
@Log
public static class TestServiceImpl implements TestService {
@Override
public String sayHello() {
throw new TestException("TestServiceImpl");
}
@@ -148,6 +149,7 @@ public class TrickyAspectJPointcutExpressionTests {
private int countThrows = 0;
@Override
public void before(Method method, Object[] objects, Object o) throws Throwable {
countBefore++;
}

View File

@@ -675,19 +675,23 @@ public abstract class AbstractAspectJAdvisorFactoryTests {
return this.count;
}
@Override
public Object getAspectInstance() {
++this.count;
return new PerTypeWithinAspect();
}
@Override
public ClassLoader getAspectClassLoader() {
return PerTypeWithinAspect.class.getClassLoader();
}
@Override
public AspectMetadata getAspectMetadata() {
return new AspectMetadata(PerTypeWithinAspect.class, "perTypeWithin");
}
@Override
public int getOrder() {
return Ordered.LOWEST_PRECEDENCE;
}
@@ -897,14 +901,17 @@ abstract class AbstractMakeModifiable {
public static class ModifiableImpl implements MutableModifable {
private boolean modified;
@Override
public void acceptChanges() {
modified = false;
}
@Override
public boolean isModified() {
return modified;
}
@Override
public void markDirty() {
this.modified = true;
}
@@ -1020,17 +1027,21 @@ class MakeLockable {
class CannotBeUnlocked implements Lockable, Comparable<Object> {
@Override
public void lock() {
}
@Override
public void unlock() {
throw new UnsupportedOperationException();
}
@Override
public boolean locked() {
return true;
}
@Override
public int compareTo(Object arg0) {
throw new UnsupportedOperationException();
}

View File

@@ -84,6 +84,7 @@ public final class ArgumentBindingTests {
public static class TransactionalBean implements ITransactionalBean {
@Override
@Transactional
public void doInTransaction() {
}

View File

@@ -111,6 +111,7 @@ public final class AspectProxyFactoryTests {
private int age;
@Override
public int getAge() {
return age;
}

View File

@@ -194,6 +194,7 @@ public final class AspectJPrecedenceComparatorTests {
private Advisor createSpringAOPAfterAdvice(int order) {
AfterReturningAdvice advice = new AfterReturningAdvice() {
@Override
public void afterReturning(Object returnValue, Method method, Object[] args, Object target) throws Throwable {
}
};

View File

@@ -129,6 +129,7 @@ public final class AopProxyUtilsTests {
public void testProxiedUserInterfacesWithNoInterface() {
Object proxy = Proxy.newProxyInstance(getClass().getClassLoader(), new Class[0],
new InvocationHandler() {
@Override
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
return null;
}

View File

@@ -42,6 +42,7 @@ public final class IntroductionBenchmarkTests {
@SuppressWarnings("serial")
public static class SimpleCounterIntroduction extends DelegatingIntroductionInterceptor implements Counter {
@Override
public int getCount() {
return EXPECTED_COMPARE;
}

View File

@@ -42,6 +42,7 @@ public final class MethodInvocationTests {
final Object returnValue = new Object();
List<Object> is = new LinkedList<Object>();
is.add(new MethodInterceptor() {
@Override
public Object invoke(MethodInvocation invocation) throws Throwable {
return returnValue;
}

View File

@@ -44,6 +44,7 @@ public class NullPrimitiveTests {
public void testNullPrimitiveWithJdkProxy() {
class SimpleFoo implements Foo {
@Override
public int getValue() {
return 100;
}
@@ -52,6 +53,7 @@ public class NullPrimitiveTests {
SimpleFoo target = new SimpleFoo();
ProxyFactory factory = new ProxyFactory(target);
factory.addAdvice(new MethodInterceptor() {
@Override
public Object invoke(MethodInvocation invocation) throws Throwable {
return null;
}
@@ -76,6 +78,7 @@ public class NullPrimitiveTests {
Bar target = new Bar();
ProxyFactory factory = new ProxyFactory(target);
factory.addAdvice(new MethodInterceptor() {
@Override
public Object invoke(MethodInvocation invocation) throws Throwable {
return null;
}

View File

@@ -73,6 +73,7 @@ public final class PrototypeTargetTests {
constructionCount++;
}
@Override
public void doSomething() {
}
}
@@ -81,6 +82,7 @@ public final class PrototypeTargetTests {
public static class TestInterceptor implements MethodInterceptor {
private int invocationCount = 0;
@Override
public Object invoke(MethodInvocation methodInvocation) throws Throwable {
invocationCount++;
return methodInvocation.proceed();

View File

@@ -165,6 +165,7 @@ public final class ProxyFactoryTests {
@Test
public void testAddRepeatedInterface() {
TimeStamped tst = new TimeStamped() {
@Override
public long getTimeStamp() {
throw new UnsupportedOperationException("getTimeStamp");
}
@@ -181,6 +182,7 @@ public final class ProxyFactoryTests {
public void testGetsAllInterfaces() throws Exception {
// Extend to get new interface
class TestBeanSubclass extends TestBean implements Comparable<Object> {
@Override
public int compareTo(Object arg0) {
throw new UnsupportedOperationException("compareTo");
}
@@ -214,6 +216,7 @@ public final class ProxyFactoryTests {
@Test
public void testInterceptorInclusionMethods() {
class MyInterceptor implements MethodInterceptor {
@Override
public Object invoke(MethodInvocation invocation) throws Throwable {
throw new UnsupportedOperationException();
}
@@ -350,6 +353,7 @@ public final class ProxyFactoryTests {
this.ts = ts;
}
@Override
public long getTimeStamp() {
return ts;
}

View File

@@ -125,6 +125,7 @@ public final class ThrowsAdviceInterceptorTests {
@SuppressWarnings("serial")
MyThrowsHandler th = new MyThrowsHandler() {
@Override
public void afterThrowing(RemoteException ex) throws Throwable {
super.afterThrowing(ex);
throw t;

View File

@@ -120,6 +120,7 @@ public final class ConcurrencyThrottleInterceptorTests {
this.ex = ex;
}
@Override
public void run() {
if (this.ex != null) {
try {

View File

@@ -189,6 +189,7 @@ public final class CustomizableTraceInterceptorTests {
this.log = log;
}
@Override
protected Log getLoggerForInvocation(MethodInvocation invocation) {
return this.log;
}

View File

@@ -96,6 +96,7 @@ public final class DebugInterceptorTests {
this.log = log;
}
@Override
protected Log getLoggerForInvocation(MethodInvocation invocation) {
return log;
}

View File

@@ -38,6 +38,7 @@ public final class ExposeBeanNameAdvisorsTests {
this.beanName = beanName;
}
@Override
public int getAge() {
assertEquals(beanName, ExposeBeanNameAdvisors.getBeanName());
return super.getAge();

View File

@@ -53,12 +53,14 @@ public final class ExposeInvocationInterceptorTests {
abstract class ExposedInvocationTestBean extends TestBean {
@Override
public String getName() {
MethodInvocation invocation = ExposeInvocationInterceptor.currentInvocation();
assertions(invocation);
return super.getName();
}
@Override
public void absquatulate() {
MethodInvocation invocation = ExposeInvocationInterceptor.currentInvocation();
assertions(invocation);
@@ -70,6 +72,7 @@ abstract class ExposedInvocationTestBean extends TestBean {
class InvocationCheckExposedInvocationTestBean extends ExposedInvocationTestBean {
@Override
protected void assertions(MethodInvocation invocation) {
assertTrue(invocation.getThis() == this);
assertTrue("Invocation should be on ITestBean: " + invocation.getMethod(),

View File

@@ -40,6 +40,7 @@ public final class AopUtilsTests {
@Test
public void testPointcutCanNeverApply() {
class TestPointcut extends StaticMethodMatcherPointcut {
@Override
public boolean matches(Method method, Class<?> clazzy) {
return false;
}
@@ -58,6 +59,7 @@ public final class AopUtilsTests {
@Test
public void testPointcutAppliesToOneMethodOnObject() {
class TestPointcut extends StaticMethodMatcherPointcut {
@Override
public boolean matches(Method method, Class<?> clazz) {
return method.getName().equals("hashCode");
}

View File

@@ -35,24 +35,28 @@ import test.beans.TestBean;
public final class ComposablePointcutTests {
public static MethodMatcher GETTER_METHOD_MATCHER = new StaticMethodMatcher() {
@Override
public boolean matches(Method m, Class<?> targetClass) {
return m.getName().startsWith("get");
}
};
public static MethodMatcher GET_AGE_METHOD_MATCHER = new StaticMethodMatcher() {
@Override
public boolean matches(Method m, Class<?> targetClass) {
return m.getName().equals("getAge");
}
};
public static MethodMatcher ABSQUATULATE_METHOD_MATCHER = new StaticMethodMatcher() {
@Override
public boolean matches(Method m, Class<?> targetClass) {
return m.getName().equals("absquatulate");
}
};
public static MethodMatcher SETTER_METHOD_MATCHER = new StaticMethodMatcher() {
@Override
public boolean matches(Method m, Class<?> targetClass) {
return m.getName().startsWith("set");
}

View File

@@ -112,8 +112,10 @@ public final class DelegatingIntroductionInterceptorTests {
public void testAutomaticInterfaceRecognitionInDelegate() throws Exception {
final long t = 1001L;
class Tester implements TimeStamped, ITester {
@Override
public void foo() throws Exception {
}
@Override
public long getTimeStamp() {
return t;
}
@@ -141,8 +143,10 @@ public final class DelegatingIntroductionInterceptorTests {
final long t = 1001L;
@SuppressWarnings("serial")
class TestII extends DelegatingIntroductionInterceptor implements TimeStamped, ITester {
@Override
public void foo() throws Exception {
}
@Override
public long getTimeStamp() {
return t;
}
@@ -206,6 +210,7 @@ public final class DelegatingIntroductionInterceptorTests {
String company = "Interface21";
target.setCompany(company);
TestBean delegate = new TestBean() {
@Override
public ITestBean getSpouse() {
return this;
}
@@ -250,6 +255,7 @@ public final class DelegatingIntroductionInterceptorTests {
final long t = 1001L;
@SuppressWarnings("serial")
class TestII extends DelegatingIntroductionInterceptor implements TimeStamped {
@Override
public long getTimeStamp() {
return t;
}
@@ -278,6 +284,7 @@ public final class DelegatingIntroductionInterceptorTests {
this.ts = ts;
}
@Override
public long getTimeStamp() {
return ts;
}
@@ -292,6 +299,7 @@ public final class DelegatingIntroductionInterceptorTests {
this.t = t;
}
@Override
public long getTimeStamp() {
return t;
}

View File

@@ -21,6 +21,7 @@ package org.springframework.aop.support;
*/
public final class JdkRegexpMethodPointcutTests extends AbstractRegexpMethodPointcutTests {
@Override
protected AbstractRegexpMethodPointcut getRegexpMethodPointcut() {
return new JdkRegexpMethodPointcut();
}

View File

@@ -107,6 +107,7 @@ public final class MethodMatchersTests {
public StartsWithMatcher(String s) {
this.prefix = s;
}
@Override
public boolean matches(Method m, Class<?> targetClass) {
return m.getName().startsWith(prefix);
}
@@ -114,12 +115,14 @@ public final class MethodMatchersTests {
private static class TestDynamicMethodMatcherWhichMatches extends DynamicMethodMatcher {
@Override
public boolean matches(Method m, Class<?> targetClass, Object[] args) {
return true;
}
}
private static class TestDynamicMethodMatcherWhichDoesNotMatch extends DynamicMethodMatcher {
@Override
public boolean matches(Method m, Class<?> targetClass, Object[] args) {
return false;
}

View File

@@ -53,14 +53,17 @@ public final class PointcutsTests {
* Matches only TestBean class, not subclasses
*/
public static Pointcut allTestBeanMethodsPointcut = new StaticMethodMatcherPointcut() {
@Override
public ClassFilter getClassFilter() {
return new ClassFilter() {
@Override
public boolean matches(Class<?> clazz) {
return clazz.equals(TestBean.class);
}
};
}
@Override
public boolean matches(Method m, Class<?> targetClass) {
return true;
}
@@ -73,10 +76,12 @@ public final class PointcutsTests {
}
public static Pointcut myTestBeanSetterPointcut = new StaticMethodMatcherPointcut() {
@Override
public ClassFilter getClassFilter() {
return new RootClassFilter(MyTestBean.class);
}
@Override
public boolean matches(Method m, Class<?> targetClass) {
return m.getName().startsWith("set");
}
@@ -84,10 +89,12 @@ public final class PointcutsTests {
// Will match MyTestBeanSubclass
public static Pointcut myTestBeanGetterPointcut = new StaticMethodMatcherPointcut() {
@Override
public ClassFilter getClassFilter() {
return new RootClassFilter(MyTestBean.class);
}
@Override
public boolean matches(Method m, Class<?> targetClass) {
return m.getName().startsWith("get");
}
@@ -98,10 +105,12 @@ public final class PointcutsTests {
}
public static Pointcut myTestBeanSubclassGetterPointcut = new StaticMethodMatcherPointcut() {
@Override
public ClassFilter getClassFilter() {
return new RootClassFilter(MyTestBeanSubclass.class);
}
@Override
public boolean matches(Method m, Class<?> targetClass) {
return m.getName().startsWith("get");
}

View File

@@ -32,9 +32,11 @@ public final class LazyCreationTargetSourceTests {
@Test
public void testCreateLazy() {
TargetSource targetSource = new AbstractLazyCreationTargetSource() {
@Override
protected Object createObject() {
return new InitCountingBean();
}
@Override
public Class<?> getTargetClass() {
return InitCountingBean.class;
}

View File

@@ -83,6 +83,7 @@ public final class LazyInitTargetSourceTests {
@SuppressWarnings("serial")
public static class CustomLazyInitTargetSource extends LazyInitTargetSource {
@Override
protected void postProcessTargetObject(Object targetObject) {
((ITestBean) targetObject).setName("Rob Harrop");
}

View File

@@ -70,10 +70,12 @@ public final class PrototypeBasedTargetSourceTests {
*/
private TestBean thisFieldIsNotSerializable = new TestBean();
@Override
public Object getTarget() throws Exception {
return newPrototypeInstance();
}
@Override
public void releaseTarget(Object target) throws Exception {
// Do nothing
}

View File

@@ -113,6 +113,7 @@ public class ThreadLocalTargetSourceTests {
class Runner implements Runnable {
public SideEffectBean mine;
@Override
public void run() {
this.mine = (SideEffectBean) beanFactory.getBean("apartment");
assertEquals(INITIAL_COUNT, mine.getCount() );

View File

@@ -116,6 +116,7 @@ public final class RefreshableTargetSourceTests {
this.requiresRefresh = requiresRefresh;
}
@Override
protected Object freshTarget() {
this.callCount++;
return new Object();
@@ -125,6 +126,7 @@ public final class RefreshableTargetSourceTests {
return this.callCount;
}
@Override
protected boolean requiresRefresh() {
return this.requiresRefresh;
}