Browse Source

Add @Override annotations to test sources

Issue: SPR-10129
pull/216/merge
Chris Beams 13 years ago
parent
commit
4c8cd7b0bd
  1. 2
      spring-aop/src/test/java/org/springframework/aop/aspectj/AspectJExpressionPointcutTests.java
  2. 1
      spring-aop/src/test/java/org/springframework/aop/aspectj/BeanNamePointcutMatchingTests.java
  3. 4
      spring-aop/src/test/java/org/springframework/aop/aspectj/MethodInvocationProceedingJoinPointTests.java
  4. 2
      spring-aop/src/test/java/org/springframework/aop/aspectj/TrickyAspectJPointcutExpressionTests.java
  5. 11
      spring-aop/src/test/java/org/springframework/aop/aspectj/annotation/AbstractAspectJAdvisorFactoryTests.java
  6. 1
      spring-aop/src/test/java/org/springframework/aop/aspectj/annotation/ArgumentBindingTests.java
  7. 1
      spring-aop/src/test/java/org/springframework/aop/aspectj/annotation/AspectProxyFactoryTests.java
  8. 1
      spring-aop/src/test/java/org/springframework/aop/aspectj/autoproxy/AspectJPrecedenceComparatorTests.java
  9. 1
      spring-aop/src/test/java/org/springframework/aop/framework/AopProxyUtilsTests.java
  10. 1
      spring-aop/src/test/java/org/springframework/aop/framework/IntroductionBenchmarkTests.java
  11. 1
      spring-aop/src/test/java/org/springframework/aop/framework/MethodInvocationTests.java
  12. 3
      spring-aop/src/test/java/org/springframework/aop/framework/NullPrimitiveTests.java
  13. 2
      spring-aop/src/test/java/org/springframework/aop/framework/PrototypeTargetTests.java
  14. 4
      spring-aop/src/test/java/org/springframework/aop/framework/ProxyFactoryTests.java
  15. 1
      spring-aop/src/test/java/org/springframework/aop/framework/adapter/ThrowsAdviceInterceptorTests.java
  16. 1
      spring-aop/src/test/java/org/springframework/aop/interceptor/ConcurrencyThrottleInterceptorTests.java
  17. 1
      spring-aop/src/test/java/org/springframework/aop/interceptor/CustomizableTraceInterceptorTests.java
  18. 1
      spring-aop/src/test/java/org/springframework/aop/interceptor/DebugInterceptorTests.java
  19. 1
      spring-aop/src/test/java/org/springframework/aop/interceptor/ExposeBeanNameAdvisorsTests.java
  20. 3
      spring-aop/src/test/java/org/springframework/aop/interceptor/ExposeInvocationInterceptorTests.java
  21. 2
      spring-aop/src/test/java/org/springframework/aop/support/AopUtilsTests.java
  22. 4
      spring-aop/src/test/java/org/springframework/aop/support/ComposablePointcutTests.java
  23. 8
      spring-aop/src/test/java/org/springframework/aop/support/DelegatingIntroductionInterceptorTests.java
  24. 1
      spring-aop/src/test/java/org/springframework/aop/support/JdkRegexpMethodPointcutTests.java
  25. 3
      spring-aop/src/test/java/org/springframework/aop/support/MethodMatchersTests.java
  26. 9
      spring-aop/src/test/java/org/springframework/aop/support/PointcutsTests.java
  27. 2
      spring-aop/src/test/java/org/springframework/aop/target/LazyCreationTargetSourceTests.java
  28. 1
      spring-aop/src/test/java/org/springframework/aop/target/LazyInitTargetSourceTests.java
  29. 2
      spring-aop/src/test/java/org/springframework/aop/target/PrototypeBasedTargetSourceTests.java
  30. 1
      spring-aop/src/test/java/org/springframework/aop/target/ThreadLocalTargetSourceTests.java
  31. 2
      spring-aop/src/test/java/org/springframework/aop/target/dynamic/RefreshableTargetSourceTests.java
  32. 1
      spring-aop/src/test/java/test/aop/CountingBeforeAdvice.java
  33. 3
      spring-aop/src/test/java/test/aop/DefaultLockable.java
  34. 1
      spring-aop/src/test/java/test/aop/NopInterceptor.java
  35. 1
      spring-aop/src/test/java/test/aop/PerTargetAspect.java
  36. 2
      spring-aop/src/test/java/test/aop/SerializableNopInterceptor.java
  37. 4
      spring-aop/src/test/java/test/beans/DerivedTestBean.java
  38. 1
      spring-aop/src/test/java/test/beans/NestedTestBean.java
  39. 5
      spring-aop/src/test/java/test/beans/SerializablePerson.java
  40. 17
      spring-aop/src/test/java/test/beans/TestBean.java
  41. 4
      spring-aop/src/test/java/test/parsing/CollectingReaderEventListener.java
  42. 1
      spring-beans/src/test/java/com/foo/ComponentBeanDefinitionParser.java
  43. 3
      spring-beans/src/test/java/com/foo/ComponentFactoryBean.java
  44. 1
      spring-beans/src/test/java/com/foo/ComponentNamespaceHandler.java
  45. 4
      spring-beans/src/test/java/org/springframework/beans/BeanUtilsTests.java
  46. 6
      spring-beans/src/test/java/org/springframework/beans/BeanWrapperGenericsTests.java
  47. 13
      spring-beans/src/test/java/org/springframework/beans/BeanWrapperTests.java
  48. 1
      spring-beans/src/test/java/org/springframework/beans/ConcurrentBeanWrapperTests.java
  49. 5
      spring-beans/src/test/java/org/springframework/beans/ExtendedBeanInfoTests.java
  50. 2
      spring-beans/src/test/java/org/springframework/beans/annotation/RequiredAnnotationBeanPostProcessorTests.java
  51. 2
      spring-beans/src/test/java/org/springframework/beans/factory/ConcurrentBeanFactoryTests.java
  52. 31
      spring-beans/src/test/java/org/springframework/beans/factory/DefaultListableBeanFactoryTests.java
  53. 8
      spring-beans/src/test/java/org/springframework/beans/factory/FactoryBeanTests.java
  54. 1
      spring-beans/src/test/java/org/springframework/beans/factory/SharedBeanRegistryTests.java
  55. 7
      spring-beans/src/test/java/org/springframework/beans/factory/annotation/AutowiredAnnotationBeanPostProcessorTests.java
  56. 2
      spring-beans/src/test/java/org/springframework/beans/factory/annotation/CustomAutowireConfigurerTests.java
  57. 7
      spring-beans/src/test/java/org/springframework/beans/factory/annotation/InjectAnnotationBeanPostProcessorTests.java
  58. 2
      spring-beans/src/test/java/org/springframework/beans/factory/config/CustomEditorConfigurerTests.java
  59. 3
      spring-beans/src/test/java/org/springframework/beans/factory/config/PropertyResourceConfigurerTests.java
  60. 1
      spring-beans/src/test/java/org/springframework/beans/factory/config/SimpleScopeTests.java
  61. 5
      spring-beans/src/test/java/org/springframework/beans/factory/config/TestTypes.java
  62. 3
      spring-beans/src/test/java/org/springframework/beans/factory/parsing/CustomProblemReporterTests.java
  63. 2
      spring-beans/src/test/java/org/springframework/beans/factory/support/BeanFactoryGenericsTests.java
  64. 1
      spring-beans/src/test/java/org/springframework/beans/factory/support/PropertiesBeanDefinitionReaderTests.java
  65. 3
      spring-beans/src/test/java/org/springframework/beans/factory/support/Spr8954Tests.java
  66. 18
      spring-beans/src/test/java/org/springframework/beans/factory/support/security/CallbacksSecurityTests.java
  67. 3
      spring-beans/src/test/java/org/springframework/beans/factory/support/security/support/CustomFactoryBean.java
  68. 1
      spring-beans/src/test/java/org/springframework/beans/factory/support/security/support/DestroyBean.java
  69. 1
      spring-beans/src/test/java/org/springframework/beans/factory/support/security/support/InitBean.java
  70. 2
      spring-beans/src/test/java/org/springframework/beans/factory/xml/AbstractBeanFactoryTests.java
  71. 1
      spring-beans/src/test/java/org/springframework/beans/factory/xml/BeanNameGenerationTests.java
  72. 4
      spring-beans/src/test/java/org/springframework/beans/factory/xml/CollectingReaderEventListener.java
  73. 1
      spring-beans/src/test/java/org/springframework/beans/factory/xml/CollectionMergingTests.java
  74. 3
      spring-beans/src/test/java/org/springframework/beans/factory/xml/CountingFactory.java
  75. 1
      spring-beans/src/test/java/org/springframework/beans/factory/xml/DefaultLifecycleMethodsTests.java
  76. 1
      spring-beans/src/test/java/org/springframework/beans/factory/xml/DelegatingEntityResolverTests.java
  77. 1
      spring-beans/src/test/java/org/springframework/beans/factory/xml/DependenciesBean.java
  78. 1
      spring-beans/src/test/java/org/springframework/beans/factory/xml/EventPublicationTests.java
  79. 1
      spring-beans/src/test/java/org/springframework/beans/factory/xml/GeneratedNameBean.java
  80. 1
      spring-beans/src/test/java/org/springframework/beans/factory/xml/MetadataAttachmentTests.java
  81. 1
      spring-beans/src/test/java/org/springframework/beans/factory/xml/ProfileXmlBeanDefinitionTests.java
  82. 6
      spring-beans/src/test/java/org/springframework/beans/factory/xml/ProtectedLifecycleBean.java
  83. 1
      spring-beans/src/test/java/org/springframework/beans/factory/xml/UtilNamespaceHandlerTests.java
  84. 5
      spring-beans/src/test/java/org/springframework/beans/factory/xml/XmlListableBeanFactoryTests.java
  85. 2
      spring-beans/src/test/java/org/springframework/beans/propertyeditors/BeanInfoTests.java
  86. 46
      spring-beans/src/test/java/org/springframework/beans/propertyeditors/CustomEditorTests.java
  87. 1
      spring-beans/src/test/java/org/springframework/beans/support/PropertyComparatorTests.java
  88. 4
      spring-beans/src/test/java/test/beans/DerivedTestBean.java
  89. 7
      spring-beans/src/test/java/test/beans/DummyFactory.java
  90. 6
      spring-beans/src/test/java/test/beans/LifecycleBean.java
  91. 1
      spring-beans/src/test/java/test/beans/NestedTestBean.java
  92. 20
      spring-beans/src/test/java/test/beans/TestBean.java
  93. 1
      spring-context-support/src/test/java/org/springframework/beans/NestedTestBean.java
  94. 20
      spring-context-support/src/test/java/org/springframework/beans/TestBean.java
  95. 3
      spring-context-support/src/test/java/org/springframework/cache/ehcache/EhCacheSupportTests.java
  96. 1
      spring-context-support/src/test/java/org/springframework/mail/javamail/InternetAddressEditorTests.java
  97. 4
      spring-context-support/src/test/java/org/springframework/mail/javamail/JavaMailSenderTests.java
  98. 28
      spring-context-support/src/test/java/org/springframework/scheduling/quartz/QuartzSupportTests.java
  99. 1
      spring-context-support/src/test/java/org/springframework/ui/jasperreports/JasperReportsUtilsTests.java
  100. 3
      spring-context/src/test/java/example/scannable/AutowiredQualifierFooService.java
  101. Some files were not shown because too many files have changed in this diff Show More

2
spring-aop/src/test/java/org/springframework/aop/aspectj/AspectJExpressionPointcutTests.java

@ -113,6 +113,7 @@ public final class AspectJExpressionPointcutTests { @@ -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 { @@ -354,6 +355,7 @@ class CallCountingInterceptor implements MethodInterceptor {
private int count;
@Override
public Object invoke(MethodInvocation methodInvocation) throws Throwable {
count++;
return methodInvocation.proceed();

1
spring-aop/src/test/java/org/springframework/aop/aspectj/BeanNamePointcutMatchingTests.java

@ -90,6 +90,7 @@ public final class BeanNamePointcutMatchingTests { @@ -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;
}

4
spring-aop/src/test/java/org/springframework/aop/aspectj/MethodInvocationProceedingJoinPointTests.java

@ -79,6 +79,7 @@ public final class MethodInvocationProceedingJoinPointTests { @@ -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 { @@ -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 { @@ -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 { @@ -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

2
spring-aop/src/test/java/org/springframework/aop/aspectj/TrickyAspectJPointcutExpressionTests.java

@ -137,6 +137,7 @@ public class TrickyAspectJPointcutExpressionTests { @@ -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 { @@ -148,6 +149,7 @@ public class TrickyAspectJPointcutExpressionTests {
private int countThrows = 0;
@Override
public void before(Method method, Object[] objects, Object o) throws Throwable {
countBefore++;
}

11
spring-aop/src/test/java/org/springframework/aop/aspectj/annotation/AbstractAspectJAdvisorFactoryTests.java

@ -675,19 +675,23 @@ public abstract class AbstractAspectJAdvisorFactoryTests { @@ -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 { @@ -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 { @@ -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();
}

1
spring-aop/src/test/java/org/springframework/aop/aspectj/annotation/ArgumentBindingTests.java

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

1
spring-aop/src/test/java/org/springframework/aop/aspectj/annotation/AspectProxyFactoryTests.java

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

1
spring-aop/src/test/java/org/springframework/aop/aspectj/autoproxy/AspectJPrecedenceComparatorTests.java

@ -194,6 +194,7 @@ public final class AspectJPrecedenceComparatorTests { @@ -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 {
}
};

1
spring-aop/src/test/java/org/springframework/aop/framework/AopProxyUtilsTests.java

@ -129,6 +129,7 @@ public final class AopProxyUtilsTests { @@ -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;
}

1
spring-aop/src/test/java/org/springframework/aop/framework/IntroductionBenchmarkTests.java

@ -42,6 +42,7 @@ public final class IntroductionBenchmarkTests { @@ -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;
}

1
spring-aop/src/test/java/org/springframework/aop/framework/MethodInvocationTests.java

@ -42,6 +42,7 @@ public final class MethodInvocationTests { @@ -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;
}

3
spring-aop/src/test/java/org/springframework/aop/framework/NullPrimitiveTests.java

@ -44,6 +44,7 @@ public class NullPrimitiveTests { @@ -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 { @@ -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 { @@ -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;
}

2
spring-aop/src/test/java/org/springframework/aop/framework/PrototypeTargetTests.java

@ -73,6 +73,7 @@ public final class PrototypeTargetTests { @@ -73,6 +73,7 @@ public final class PrototypeTargetTests {
constructionCount++;
}
@Override
public void doSomething() {
}
}
@ -81,6 +82,7 @@ public final class PrototypeTargetTests { @@ -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();

4
spring-aop/src/test/java/org/springframework/aop/framework/ProxyFactoryTests.java

@ -165,6 +165,7 @@ public final class ProxyFactoryTests { @@ -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 { @@ -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 { @@ -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 { @@ -350,6 +353,7 @@ public final class ProxyFactoryTests {
this.ts = ts;
}
@Override
public long getTimeStamp() {
return ts;
}

1
spring-aop/src/test/java/org/springframework/aop/framework/adapter/ThrowsAdviceInterceptorTests.java

@ -125,6 +125,7 @@ public final class ThrowsAdviceInterceptorTests { @@ -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;

1
spring-aop/src/test/java/org/springframework/aop/interceptor/ConcurrencyThrottleInterceptorTests.java

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

1
spring-aop/src/test/java/org/springframework/aop/interceptor/CustomizableTraceInterceptorTests.java

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

1
spring-aop/src/test/java/org/springframework/aop/interceptor/DebugInterceptorTests.java

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

1
spring-aop/src/test/java/org/springframework/aop/interceptor/ExposeBeanNameAdvisorsTests.java

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

3
spring-aop/src/test/java/org/springframework/aop/interceptor/ExposeInvocationInterceptorTests.java

@ -53,12 +53,14 @@ public final class ExposeInvocationInterceptorTests { @@ -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 { @@ -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(),

2
spring-aop/src/test/java/org/springframework/aop/support/AopUtilsTests.java

@ -40,6 +40,7 @@ public final class AopUtilsTests { @@ -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 { @@ -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");
}

4
spring-aop/src/test/java/org/springframework/aop/support/ComposablePointcutTests.java

@ -35,24 +35,28 @@ import test.beans.TestBean; @@ -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");
}

8
spring-aop/src/test/java/org/springframework/aop/support/DelegatingIntroductionInterceptorTests.java

@ -112,8 +112,10 @@ public final class DelegatingIntroductionInterceptorTests { @@ -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 { @@ -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 { @@ -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 { @@ -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 { @@ -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 { @@ -292,6 +299,7 @@ public final class DelegatingIntroductionInterceptorTests {
this.t = t;
}
@Override
public long getTimeStamp() {
return t;
}

1
spring-aop/src/test/java/org/springframework/aop/support/JdkRegexpMethodPointcutTests.java

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

3
spring-aop/src/test/java/org/springframework/aop/support/MethodMatchersTests.java

@ -107,6 +107,7 @@ public final class MethodMatchersTests { @@ -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 { @@ -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;
}

9
spring-aop/src/test/java/org/springframework/aop/support/PointcutsTests.java

@ -53,14 +53,17 @@ public final class PointcutsTests { @@ -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 { @@ -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 { @@ -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 { @@ -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");
}

2
spring-aop/src/test/java/org/springframework/aop/target/LazyCreationTargetSourceTests.java

@ -32,9 +32,11 @@ public final class LazyCreationTargetSourceTests { @@ -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;
}

1
spring-aop/src/test/java/org/springframework/aop/target/LazyInitTargetSourceTests.java

@ -83,6 +83,7 @@ public final class LazyInitTargetSourceTests { @@ -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");
}

2
spring-aop/src/test/java/org/springframework/aop/target/PrototypeBasedTargetSourceTests.java

@ -70,10 +70,12 @@ public final class PrototypeBasedTargetSourceTests { @@ -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
}

1
spring-aop/src/test/java/org/springframework/aop/target/ThreadLocalTargetSourceTests.java

@ -113,6 +113,7 @@ public class ThreadLocalTargetSourceTests { @@ -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() );

2
spring-aop/src/test/java/org/springframework/aop/target/dynamic/RefreshableTargetSourceTests.java

@ -116,6 +116,7 @@ public final class RefreshableTargetSourceTests { @@ -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 { @@ -125,6 +126,7 @@ public final class RefreshableTargetSourceTests {
return this.callCount;
}
@Override
protected boolean requiresRefresh() {
return this.requiresRefresh;
}

1
spring-aop/src/test/java/test/aop/CountingBeforeAdvice.java

@ -28,6 +28,7 @@ import org.springframework.aop.MethodBeforeAdvice; @@ -28,6 +28,7 @@ import org.springframework.aop.MethodBeforeAdvice;
@SuppressWarnings("serial")
public class CountingBeforeAdvice extends MethodCounter implements MethodBeforeAdvice {
@Override
public void before(Method m, Object[] args, Object target) throws Throwable {
count(m);
}

3
spring-aop/src/test/java/test/aop/DefaultLockable.java

@ -25,14 +25,17 @@ public class DefaultLockable implements Lockable { @@ -25,14 +25,17 @@ public class DefaultLockable implements Lockable {
private boolean locked;
@Override
public void lock() {
this.locked = true;
}
@Override
public void unlock() {
this.locked = false;
}
@Override
public boolean locked() {
return this.locked;
}

1
spring-aop/src/test/java/test/aop/NopInterceptor.java

@ -31,6 +31,7 @@ public class NopInterceptor implements MethodInterceptor { @@ -31,6 +31,7 @@ public class NopInterceptor implements MethodInterceptor {
/**
* @see org.aopalliance.intercept.MethodInterceptor#invoke(MethodInvocation)
*/
@Override
public Object invoke(MethodInvocation invocation) throws Throwable {
increment();
return invocation.proceed();

1
spring-aop/src/test/java/test/aop/PerTargetAspect.java

@ -25,6 +25,7 @@ public class PerTargetAspect implements Ordered { @@ -25,6 +25,7 @@ public class PerTargetAspect implements Ordered {
++count;
}
@Override
public int getOrder() {
return this.order;
}

2
spring-aop/src/test/java/test/aop/SerializableNopInterceptor.java

@ -37,10 +37,12 @@ public class SerializableNopInterceptor extends NopInterceptor implements Serial @@ -37,10 +37,12 @@ public class SerializableNopInterceptor extends NopInterceptor implements Serial
*/
private int count;
@Override
public int getCount() {
return this.count;
}
@Override
protected void increment() {
++count;
}

4
spring-aop/src/test/java/test/beans/DerivedTestBean.java

@ -51,12 +51,14 @@ public class DerivedTestBean extends TestBean implements Serializable, BeanNameA @@ -51,12 +51,14 @@ public class DerivedTestBean extends TestBean implements Serializable, BeanNameA
}
@Override
public void setBeanName(String beanName) {
if (this.beanName == null || beanName == null) {
this.beanName = beanName;
}
}
@Override
public String getBeanName() {
return beanName;
}
@ -75,10 +77,12 @@ public class DerivedTestBean extends TestBean implements Serializable, BeanNameA @@ -75,10 +77,12 @@ public class DerivedTestBean extends TestBean implements Serializable, BeanNameA
}
@Override
public void destroy() {
this.destroyed = true;
}
@Override
public boolean wasDestroyed() {
return destroyed;
}

1
spring-aop/src/test/java/test/beans/NestedTestBean.java

@ -37,6 +37,7 @@ public class NestedTestBean implements INestedTestBean { @@ -37,6 +37,7 @@ public class NestedTestBean implements INestedTestBean {
this.company = (company != null ? company : "");
}
@Override
public String getCompany() {
return company;
}

5
spring-aop/src/test/java/test/beans/SerializablePerson.java

@ -31,22 +31,27 @@ public class SerializablePerson implements Person, Serializable { @@ -31,22 +31,27 @@ public class SerializablePerson implements Person, Serializable {
private String name;
private int age;
@Override
public int getAge() {
return age;
}
@Override
public void setAge(int age) {
this.age = age;
}
@Override
public String getName() {
return name;
}
@Override
public void setName(String name) {
this.name = name;
}
@Override
public Object echo(Object o) throws Throwable {
if (o instanceof Throwable) {
throw (Throwable) o;

17
spring-aop/src/test/java/test/beans/TestBean.java

@ -146,10 +146,12 @@ public class TestBean implements ITestBean, IOther, Comparable<Object> { @@ -146,10 +146,12 @@ public class TestBean implements ITestBean, IOther, Comparable<Object> {
return postProcessed;
}
@Override
public String getName() {
return name;
}
@Override
public void setName(String name) {
this.name = name;
}
@ -165,10 +167,12 @@ public class TestBean implements ITestBean, IOther, Comparable<Object> { @@ -165,10 +167,12 @@ public class TestBean implements ITestBean, IOther, Comparable<Object> {
}
}
@Override
public int getAge() {
return age;
}
@Override
public void setAge(int age) {
this.age = age;
}
@ -181,14 +185,17 @@ public class TestBean implements ITestBean, IOther, Comparable<Object> { @@ -181,14 +185,17 @@ public class TestBean implements ITestBean, IOther, Comparable<Object> {
this.jedi = jedi;
}
@Override
public ITestBean getSpouse() {
return (spouses != null ? spouses[0] : null);
}
@Override
public void setSpouse(ITestBean spouse) {
this.spouses = new ITestBean[] {spouse};
}
@Override
public ITestBean[] getSpouses() {
return spouses;
}
@ -215,10 +222,12 @@ public class TestBean implements ITestBean, IOther, Comparable<Object> { @@ -215,10 +222,12 @@ public class TestBean implements ITestBean, IOther, Comparable<Object> {
this.country = country;
}
@Override
public String[] getStringArray() {
return stringArray;
}
@Override
public void setStringArray(String[] stringArray) {
this.stringArray = stringArray;
}
@ -287,6 +296,7 @@ public class TestBean implements ITestBean, IOther, Comparable<Object> { @@ -287,6 +296,7 @@ public class TestBean implements ITestBean, IOther, Comparable<Object> {
this.someProperties = someProperties;
}
@Override
public INestedTestBean getDoctor() {
return doctor;
}
@ -295,6 +305,7 @@ public class TestBean implements ITestBean, IOther, Comparable<Object> { @@ -295,6 +305,7 @@ public class TestBean implements ITestBean, IOther, Comparable<Object> {
this.doctor = doctor;
}
@Override
public INestedTestBean getLawyer() {
return lawyer;
}
@ -347,18 +358,21 @@ public class TestBean implements ITestBean, IOther, Comparable<Object> { @@ -347,18 +358,21 @@ public class TestBean implements ITestBean, IOther, Comparable<Object> {
/**
* @see ITestBean#exceptional(Throwable)
*/
@Override
public void exceptional(Throwable t) throws Throwable {
if (t != null) {
throw t;
}
}
@Override
public void unreliableFileOperation() throws IOException {
throw new IOException();
}
/**
* @see ITestBean#returnsThis()
*/
@Override
public Object returnsThis() {
return this;
}
@ -366,9 +380,11 @@ public class TestBean implements ITestBean, IOther, Comparable<Object> { @@ -366,9 +380,11 @@ public class TestBean implements ITestBean, IOther, Comparable<Object> {
/**
* @see IOther#absquatulate()
*/
@Override
public void absquatulate() {
}
@Override
public int haveBirthday() {
return age++;
}
@ -398,6 +414,7 @@ public class TestBean implements ITestBean, IOther, Comparable<Object> { @@ -398,6 +414,7 @@ public class TestBean implements ITestBean, IOther, Comparable<Object> {
return this.age;
}
@Override
public int compareTo(Object other) {
if (this.name != null && other instanceof TestBean) {
return this.name.compareTo(((TestBean) other).getName());

4
spring-aop/src/test/java/test/parsing/CollectingReaderEventListener.java

@ -46,6 +46,7 @@ public class CollectingReaderEventListener implements ReaderEventListener { @@ -46,6 +46,7 @@ public class CollectingReaderEventListener implements ReaderEventListener {
private final List<ImportDefinition> imports = new LinkedList<ImportDefinition>();
@Override
public void defaultsRegistered(DefaultsDefinition defaultsDefinition) {
this.defaults.add(defaultsDefinition);
}
@ -54,6 +55,7 @@ public class CollectingReaderEventListener implements ReaderEventListener { @@ -54,6 +55,7 @@ public class CollectingReaderEventListener implements ReaderEventListener {
return Collections.unmodifiableList(this.defaults);
}
@Override
public void componentRegistered(ComponentDefinition componentDefinition) {
this.componentDefinitions.put(componentDefinition.getName(), componentDefinition);
}
@ -67,6 +69,7 @@ public class CollectingReaderEventListener implements ReaderEventListener { @@ -67,6 +69,7 @@ public class CollectingReaderEventListener implements ReaderEventListener {
return collection.toArray(new ComponentDefinition[collection.size()]);
}
@Override
@SuppressWarnings("unchecked")
public void aliasRegistered(AliasDefinition aliasDefinition) {
List aliases = (List) this.aliasMap.get(aliasDefinition.getBeanName());
@ -82,6 +85,7 @@ public class CollectingReaderEventListener implements ReaderEventListener { @@ -82,6 +85,7 @@ public class CollectingReaderEventListener implements ReaderEventListener {
return aliases == null ? null : Collections.unmodifiableList(aliases);
}
@Override
public void importProcessed(ImportDefinition importDefinition) {
this.imports.add(importDefinition);
}

1
spring-beans/src/test/java/com/foo/ComponentBeanDefinitionParser.java

@ -13,6 +13,7 @@ import org.w3c.dom.Element; @@ -13,6 +13,7 @@ import org.w3c.dom.Element;
public class ComponentBeanDefinitionParser extends AbstractBeanDefinitionParser {
@Override
protected AbstractBeanDefinition parseInternal(Element element,
ParserContext parserContext) {
return parseComponentElement(element);

3
spring-beans/src/test/java/com/foo/ComponentFactoryBean.java

@ -16,6 +16,7 @@ public class ComponentFactoryBean implements FactoryBean<Component> { @@ -16,6 +16,7 @@ public class ComponentFactoryBean implements FactoryBean<Component> {
this.children = children;
}
@Override
public Component getObject() throws Exception {
if (this.children != null && this.children.size() > 0) {
for (Component child : children) {
@ -25,10 +26,12 @@ public class ComponentFactoryBean implements FactoryBean<Component> { @@ -25,10 +26,12 @@ public class ComponentFactoryBean implements FactoryBean<Component> {
return this.parent;
}
@Override
public Class<Component> getObjectType() {
return Component.class;
}
@Override
public boolean isSingleton() {
return true;
}

1
spring-beans/src/test/java/com/foo/ComponentNamespaceHandler.java

@ -3,6 +3,7 @@ package com.foo; @@ -3,6 +3,7 @@ package com.foo;
import org.springframework.beans.factory.xml.NamespaceHandlerSupport;
public class ComponentNamespaceHandler extends NamespaceHandlerSupport {
@Override
public void init() {
registerBeanDefinitionParser("component",
new ComponentBeanDefinitionParser());

4
spring-beans/src/test/java/org/springframework/beans/BeanUtilsTests.java

@ -360,18 +360,22 @@ public final class BeanUtilsTests { @@ -360,18 +360,22 @@ public final class BeanUtilsTests {
private String value;
@Override
public String getKey() {
return key;
}
@Override
public void setKey(String aKey) {
key = aKey;
}
@Override
public String getValue() {
return value;
}
@Override
public void setValue(String aValue) {
value = aValue;
}

6
spring-beans/src/test/java/org/springframework/beans/BeanWrapperGenericsTests.java

@ -507,6 +507,7 @@ public class BeanWrapperGenericsTests { @@ -507,6 +507,7 @@ public class BeanWrapperGenericsTests {
private Map<String, List<List<Integer>>> mapOfListOfListOfInteger;
@Override
public Map<String, Integer> getMapOfInteger() {
return mapOfInteger;
}
@ -515,10 +516,12 @@ public class BeanWrapperGenericsTests { @@ -515,10 +516,12 @@ public class BeanWrapperGenericsTests {
this.mapOfInteger = mapOfInteger;
}
@Override
public Map<String, List<Integer>> getMapOfListOfInteger() {
return mapOfListOfInteger;
}
@Override
public void setMapOfListOfInteger(Map<String, List<Integer>> mapOfListOfInteger) {
this.mapOfListOfInteger = mapOfListOfInteger;
}
@ -591,6 +594,7 @@ public class BeanWrapperGenericsTests { @@ -591,6 +594,7 @@ public class BeanWrapperGenericsTests {
private double version;
@Override
public Double getVersion() {
return this.version;
}
@ -613,10 +617,12 @@ public class BeanWrapperGenericsTests { @@ -613,10 +617,12 @@ public class BeanWrapperGenericsTests {
private Long id;
@Override
public Long getId() {
return id;
}
@Override
public void setId(Long aId) {
this.id = aId;
}

13
spring-beans/src/test/java/org/springframework/beans/BeanWrapperTests.java

@ -329,6 +329,7 @@ public final class BeanWrapperTests { @@ -329,6 +329,7 @@ public final class BeanWrapperTests {
TestBean tb = new TestBean();
BeanWrapper bw = new BeanWrapperImpl(tb);
bw.registerCustomEditor(String.class, new PropertyEditorSupport() {
@Override
public void setValue(Object value) {
super.setValue(value.toString());
}
@ -500,6 +501,7 @@ public final class BeanWrapperTests { @@ -500,6 +501,7 @@ public final class BeanWrapperTests {
PropsTester pt = new PropsTester();
BeanWrapper bw = new BeanWrapperImpl(pt);
bw.registerCustomEditor(String.class, "stringArray", new PropertyEditorSupport() {
@Override
public void setAsText(String text) {
setValue(text.substring(1));
}
@ -559,6 +561,7 @@ public final class BeanWrapperTests { @@ -559,6 +561,7 @@ public final class BeanWrapperTests {
TestBean tb = new TestBean();
BeanWrapper bw = new BeanWrapperImpl(tb);
bw.registerCustomEditor(String.class, "name", new PropertyEditorSupport() {
@Override
public void setValue(Object value) {
if (value instanceof String[]) {
setValue(StringUtils.arrayToDelimitedString(((String[]) value), "-"));
@ -636,6 +639,7 @@ public final class BeanWrapperTests { @@ -636,6 +639,7 @@ public final class BeanWrapperTests {
PropsTester pt = new PropsTester();
BeanWrapper bw = new BeanWrapperImpl(pt);
bw.registerCustomEditor(int.class, new PropertyEditorSupport() {
@Override
public void setAsText(String text) {
setValue(new Integer(Integer.parseInt(text) + 1));
}
@ -1022,6 +1026,7 @@ public final class BeanWrapperTests { @@ -1022,6 +1026,7 @@ public final class BeanWrapperTests {
IndexedTestBean bean = new IndexedTestBean();
BeanWrapper bw = new BeanWrapperImpl(bean);
bw.registerCustomEditor(TestBean.class, new PropertyEditorSupport() {
@Override
public void setAsText(String text) throws IllegalArgumentException {
if (!StringUtils.hasLength(text)) {
throw new IllegalArgumentException();
@ -1055,6 +1060,7 @@ public final class BeanWrapperTests { @@ -1055,6 +1060,7 @@ public final class BeanWrapperTests {
IndexedTestBean bean = new IndexedTestBean();
BeanWrapper bw = new BeanWrapperImpl(bean);
bw.registerCustomEditor(TestBean.class, "map", new PropertyEditorSupport() {
@Override
public void setAsText(String text) throws IllegalArgumentException {
if (!StringUtils.hasLength(text)) {
throw new IllegalArgumentException();
@ -1078,6 +1084,7 @@ public final class BeanWrapperTests { @@ -1078,6 +1084,7 @@ public final class BeanWrapperTests {
IndexedTestBean bean = new IndexedTestBean();
BeanWrapper bw = new BeanWrapperImpl(bean);
bw.registerCustomEditor(TestBean.class, "map", new PropertyEditorSupport() {
@Override
public void setAsText(String text) throws IllegalArgumentException {
if (!StringUtils.hasLength(text)) {
throw new IllegalArgumentException();
@ -1191,6 +1198,7 @@ public final class BeanWrapperTests { @@ -1191,6 +1198,7 @@ public final class BeanWrapperTests {
PrimitiveArrayBean tb = new PrimitiveArrayBean();
BeanWrapper bw = new BeanWrapperImpl(tb);
bw.registerCustomEditor(int.class, "array", new PropertyEditorSupport() {
@Override
public void setValue(Object value) {
if (value instanceof Integer) {
super.setValue(new Integer(((Integer) value).intValue() + 1));
@ -1209,6 +1217,7 @@ public final class BeanWrapperTests { @@ -1209,6 +1217,7 @@ public final class BeanWrapperTests {
PrimitiveArrayBean tb = new PrimitiveArrayBean();
BeanWrapper bw = new BeanWrapperImpl(tb);
bw.registerCustomEditor(int.class, "array[1]", new PropertyEditorSupport() {
@Override
public void setValue(Object value) {
if (value instanceof Integer) {
super.setValue(new Integer(((Integer) value).intValue() + 1));
@ -1821,6 +1830,7 @@ public final class BeanWrapperTests { @@ -1821,6 +1830,7 @@ public final class BeanWrapperTests {
this.frozen = true;
}
@Override
public V put(K key, V value) {
if (this.frozen) {
throw new UnsupportedOperationException();
@ -1830,16 +1840,19 @@ public final class BeanWrapperTests { @@ -1830,16 +1840,19 @@ public final class BeanWrapperTests {
}
}
@Override
public Set<Map.Entry<K, V>> entrySet() {
this.accessed = true;
return super.entrySet();
}
@Override
public Set<K> keySet() {
this.accessed = true;
return super.keySet();
}
@Override
public int size() {
this.accessed = true;
return super.size();

1
spring-beans/src/test/java/org/springframework/beans/ConcurrentBeanWrapperTests.java

@ -115,6 +115,7 @@ public final class ConcurrentBeanWrapperTests { @@ -115,6 +115,7 @@ public final class ConcurrentBeanWrapperTests {
this.test = test;
}
@Override
public void run() {
try {
for (int i = 0; i < 100; i++) {

5
spring-beans/src/test/java/org/springframework/beans/ExtendedBeanInfoTests.java

@ -214,6 +214,7 @@ public class ExtendedBeanInfoTests { @@ -214,6 +214,7 @@ public class ExtendedBeanInfoTests {
@Test
public void cornerSpr9453() throws IntrospectionException {
final class Bean implements Spr9453<Class<?>> {
@Override
public Class<?> getProp() {
return null;
}
@ -589,7 +590,9 @@ public class ExtendedBeanInfoTests { @@ -589,7 +590,9 @@ public class ExtendedBeanInfoTests {
public Number setFoo(String foo) { return null; }
}
class C extends B {
@Override
public String getFoo() { return null; }
@Override
public Integer setFoo(String foo) { return null; }
}
@ -861,6 +864,7 @@ public class ExtendedBeanInfoTests { @@ -861,6 +864,7 @@ public class ExtendedBeanInfoTests {
}
interface TextBookOperations extends BookOperations {
@Override
TextBook getBook();
}
@ -870,6 +874,7 @@ public class ExtendedBeanInfoTests { @@ -870,6 +874,7 @@ public class ExtendedBeanInfoTests {
}
class LawLibrary extends Library implements TextBookOperations {
@Override
public LawBook getBook() { return null; }
}

2
spring-beans/src/test/java/org/springframework/beans/annotation/RequiredAnnotationBeanPostProcessorTests.java

@ -182,10 +182,12 @@ class RequiredTestBean implements BeanNameAware, BeanFactoryAware { @@ -182,10 +182,12 @@ class RequiredTestBean implements BeanNameAware, BeanFactoryAware {
this.jobTitle = jobTitle;
}
@Override
@Required
public void setBeanName(String name) {
}
@Override
@Required
public void setBeanFactory(BeanFactory beanFactory) {
}

2
spring-beans/src/test/java/org/springframework/beans/factory/ConcurrentBeanFactoryTests.java

@ -72,6 +72,7 @@ public final class ConcurrentBeanFactoryTests { @@ -72,6 +72,7 @@ public final class ConcurrentBeanFactoryTests {
public void setUp() throws Exception {
XmlBeanFactory factory = new XmlBeanFactory(CONTEXT);
factory.addPropertyEditorRegistrar(new PropertyEditorRegistrar() {
@Override
public void registerCustomEditors(PropertyEditorRegistry registry) {
registry.registerCustomEditor(Date.class, new CustomDateEditor((DateFormat) DATE_FORMAT.clone(), false));
}
@ -125,6 +126,7 @@ public final class ConcurrentBeanFactoryTests { @@ -125,6 +126,7 @@ public final class ConcurrentBeanFactoryTests {
private class TestRun extends Thread {
@Override
public void run() {
try {
for (int i = 0; i < 10000; i++) {

31
spring-beans/src/test/java/org/springframework/beans/factory/DefaultListableBeanFactoryTests.java

@ -836,6 +836,7 @@ public class DefaultListableBeanFactoryTests { @@ -836,6 +836,7 @@ public class DefaultListableBeanFactoryTests {
public void testCustomEditor() {
DefaultListableBeanFactory lbf = new DefaultListableBeanFactory();
lbf.addPropertyEditorRegistrar(new PropertyEditorRegistrar() {
@Override
public void registerCustomEditors(PropertyEditorRegistry registry) {
NumberFormat nf = NumberFormat.getInstance(Locale.GERMAN);
registry.registerCustomEditor(Float.class, new CustomNumberEditor(Float.class, nf, true));
@ -853,6 +854,7 @@ public class DefaultListableBeanFactoryTests { @@ -853,6 +854,7 @@ public class DefaultListableBeanFactoryTests {
DefaultListableBeanFactory lbf = new DefaultListableBeanFactory();
GenericConversionService conversionService = new DefaultConversionService();
conversionService.addConverter(new Converter<String, Float>() {
@Override
public Float convert(String source) {
try {
NumberFormat nf = NumberFormat.getInstance(Locale.GERMAN);
@ -875,6 +877,7 @@ public class DefaultListableBeanFactoryTests { @@ -875,6 +877,7 @@ public class DefaultListableBeanFactoryTests {
public void testCustomEditorWithBeanReference() {
DefaultListableBeanFactory lbf = new DefaultListableBeanFactory();
lbf.addPropertyEditorRegistrar(new PropertyEditorRegistrar() {
@Override
public void registerCustomEditors(PropertyEditorRegistry registry) {
NumberFormat nf = NumberFormat.getInstance(Locale.GERMAN);
registry.registerCustomEditor(Float.class, new CustomNumberEditor(Float.class, nf, true));
@ -1907,9 +1910,11 @@ public class DefaultListableBeanFactoryTests { @@ -1907,9 +1910,11 @@ public class DefaultListableBeanFactoryTests {
RootBeanDefinition bd = new RootBeanDefinition(BeanWithDisposableBean.class);
lbf.registerBeanDefinition("test", bd);
lbf.addBeanPostProcessor(new BeanPostProcessor() {
@Override
public Object postProcessBeforeInitialization(Object bean, String beanName) {
return new TestBean();
}
@Override
public Object postProcessAfterInitialization(Object bean, String beanName) {
return bean;
}
@ -1926,9 +1931,11 @@ public class DefaultListableBeanFactoryTests { @@ -1926,9 +1931,11 @@ public class DefaultListableBeanFactoryTests {
RootBeanDefinition bd = new RootBeanDefinition(BeanWithCloseable.class);
lbf.registerBeanDefinition("test", bd);
lbf.addBeanPostProcessor(new BeanPostProcessor() {
@Override
public Object postProcessBeforeInitialization(Object bean, String beanName) {
return new TestBean();
}
@Override
public Object postProcessAfterInitialization(Object bean, String beanName) {
return bean;
}
@ -1946,9 +1953,11 @@ public class DefaultListableBeanFactoryTests { @@ -1946,9 +1953,11 @@ public class DefaultListableBeanFactoryTests {
bd.setDestroyMethodName("close");
lbf.registerBeanDefinition("test", bd);
lbf.addBeanPostProcessor(new BeanPostProcessor() {
@Override
public Object postProcessBeforeInitialization(Object bean, String beanName) {
return new TestBean();
}
@Override
public Object postProcessAfterInitialization(Object bean, String beanName) {
return bean;
}
@ -2117,6 +2126,7 @@ public class DefaultListableBeanFactoryTests { @@ -2117,6 +2126,7 @@ public class DefaultListableBeanFactoryTests {
lbf.registerBeanDefinition("test", bd);
final String nameSetOnField = "nameSetOnField";
lbf.addBeanPostProcessor(new InstantiationAwareBeanPostProcessorAdapter() {
@Override
public boolean postProcessAfterInstantiation(Object bean, String beanName) throws BeansException {
TestBean tb = (TestBean) bean;
try {
@ -2156,6 +2166,7 @@ public class DefaultListableBeanFactoryTests { @@ -2156,6 +2166,7 @@ public class DefaultListableBeanFactoryTests {
TestSecuredBean bean = (TestSecuredBean) Subject.doAsPrivileged(subject,
new PrivilegedAction() {
@Override
public Object run() {
return lbf.getBean("test");
}
@ -2244,14 +2255,17 @@ public class DefaultListableBeanFactoryTests { @@ -2244,14 +2255,17 @@ public class DefaultListableBeanFactoryTests {
public ConstructorDependencyFactoryBean(String dependency) {
}
@Override
public Object getObject() {
return "test";
}
@Override
public Class<?> getObjectType() {
return String.class;
}
@Override
public boolean isSingleton() {
return true;
}
@ -2262,6 +2276,7 @@ public class DefaultListableBeanFactoryTests { @@ -2262,6 +2276,7 @@ public class DefaultListableBeanFactoryTests {
private static boolean closed;
@Override
public void destroy() {
closed = true;
}
@ -2272,6 +2287,7 @@ public class DefaultListableBeanFactoryTests { @@ -2272,6 +2287,7 @@ public class DefaultListableBeanFactoryTests {
private static boolean closed;
@Override
public void close() {
closed = true;
}
@ -2316,14 +2332,17 @@ public class DefaultListableBeanFactoryTests { @@ -2316,14 +2332,17 @@ public class DefaultListableBeanFactoryTests {
public static class FactoryBeanThatShouldntBeCalled implements FactoryBean<Object> {
@Override
public Object getObject() {
throw new IllegalStateException();
}
@Override
public Class<?> getObjectType() {
return null;
}
@Override
public boolean isSingleton() {
return false;
}
@ -2334,15 +2353,18 @@ public class DefaultListableBeanFactoryTests { @@ -2334,15 +2353,18 @@ public class DefaultListableBeanFactoryTests {
public boolean initialized = false;
@Override
public Object getObject() throws Exception {
this.initialized = true;
return "";
}
@Override
public Class<?> getObjectType() {
return String.class;
}
@Override
public boolean isSingleton() {
return true;
}
@ -2353,23 +2375,28 @@ public class DefaultListableBeanFactoryTests { @@ -2353,23 +2375,28 @@ public class DefaultListableBeanFactoryTests {
public boolean initialized = false;
@Override
public Object getObject() throws Exception {
this.initialized = true;
return "";
}
@Override
public Class<?> getObjectType() {
return String.class;
}
@Override
public boolean isSingleton() {
return true;
}
@Override
public boolean isPrototype() {
return false;
}
@Override
public boolean isEagerInit() {
return true;
}
@ -2452,6 +2479,7 @@ public class DefaultListableBeanFactoryTests { @@ -2452,6 +2479,7 @@ public class DefaultListableBeanFactoryTests {
this.numberFormat = numberFormat;
}
@Override
@SuppressWarnings("unchecked")
public Object convertIfNecessary(Object value, Class requiredType) {
if (value instanceof String && Float.class.isAssignableFrom(requiredType)) {
@ -2470,11 +2498,13 @@ public class DefaultListableBeanFactoryTests { @@ -2470,11 +2498,13 @@ public class DefaultListableBeanFactoryTests {
}
}
@Override
@SuppressWarnings("unchecked")
public Object convertIfNecessary(Object value, Class requiredType, MethodParameter methodParam) {
return convertIfNecessary(value, requiredType);
}
@Override
@SuppressWarnings("unchecked")
public Object convertIfNecessary(Object value, Class requiredType, Field field) {
return convertIfNecessary(value, requiredType);
@ -2490,6 +2520,7 @@ public class DefaultListableBeanFactoryTests { @@ -2490,6 +2520,7 @@ public class DefaultListableBeanFactoryTests {
this.name = name;
}
@Override
public String getName() {
return this.name;
}

8
spring-beans/src/test/java/org/springframework/beans/factory/FactoryBeanTests.java

@ -77,14 +77,17 @@ public final class FactoryBeanTests { @@ -77,14 +77,17 @@ public final class FactoryBeanTests {
public static class NullReturningFactoryBean implements FactoryBean<Object> {
@Override
public Object getObject() {
return null;
}
@Override
public Class<?> getObjectType() {
return null;
}
@Override
public boolean isSingleton() {
return true;
}
@ -103,6 +106,7 @@ public final class FactoryBeanTests { @@ -103,6 +106,7 @@ public final class FactoryBeanTests {
return beta;
}
@Override
public void afterPropertiesSet() {
Assert.notNull(beta, "'beta' property is required");
}
@ -131,6 +135,7 @@ public final class FactoryBeanTests { @@ -131,6 +135,7 @@ public final class FactoryBeanTests {
return name;
}
@Override
public void afterPropertiesSet() {
Assert.notNull(gamma, "'gamma' property is required");
}
@ -149,14 +154,17 @@ public final class FactoryBeanTests { @@ -149,14 +154,17 @@ public final class FactoryBeanTests {
this.beta = beta;
}
@Override
public Object getObject() {
return this.beta;
}
@Override
public Class<?> getObjectType() {
return null;
}
@Override
public boolean isSingleton() {
return true;
}

1
spring-beans/src/test/java/org/springframework/beans/factory/SharedBeanRegistryTests.java

@ -43,6 +43,7 @@ public final class SharedBeanRegistryTests { @@ -43,6 +43,7 @@ public final class SharedBeanRegistryTests {
assertSame(tb, beanRegistry.getSingleton("tb"));
TestBean tb2 = (TestBean) beanRegistry.getSingleton("tb2", new ObjectFactory<Object>() {
@Override
public Object getObject() throws BeansException {
return new TestBean();
}

7
spring-beans/src/test/java/org/springframework/beans/factory/annotation/AutowiredAnnotationBeanPostProcessorTests.java

@ -989,6 +989,7 @@ public final class AutowiredAnnotationBeanPostProcessorTests { @@ -989,6 +989,7 @@ public final class AutowiredAnnotationBeanPostProcessorTests {
public ExtendedResourceInjectionBean() {
}
@Override
@Autowired @Required
public void setTestBean2(TestBean testBean2) {
super.setTestBean2(testBean2);
@ -1068,6 +1069,7 @@ public final class AutowiredAnnotationBeanPostProcessorTests { @@ -1068,6 +1069,7 @@ public final class AutowiredAnnotationBeanPostProcessorTests {
private ITestBean testBean4;
@Override
@Autowired(required = false)
public void setTestBean2(TestBean testBean2) {
super.setTestBean2(testBean2);
@ -1114,6 +1116,7 @@ public final class AutowiredAnnotationBeanPostProcessorTests { @@ -1114,6 +1116,7 @@ public final class AutowiredAnnotationBeanPostProcessorTests {
private ITestBean testBean4;
@Override
@Autowired(required = false)
public void setTestBean2(TestBean testBean2) {
super.setTestBean2(testBean2);
@ -1185,6 +1188,7 @@ public final class AutowiredAnnotationBeanPostProcessorTests { @@ -1185,6 +1188,7 @@ public final class AutowiredAnnotationBeanPostProcessorTests {
throw new UnsupportedOperationException();
}
@Override
@Autowired
public void setTestBean2(TestBean testBean2) {
super.setTestBean2(testBean2);
@ -1447,14 +1451,17 @@ public final class AutowiredAnnotationBeanPostProcessorTests { @@ -1447,14 +1451,17 @@ public final class AutowiredAnnotationBeanPostProcessorTests {
public static class StringFactoryBean implements FactoryBean<String> {
@Override
public String getObject() throws Exception {
return "";
}
@Override
public Class<String> getObjectType() {
return String.class;
}
@Override
public boolean isSingleton() {
return true;
}

2
spring-beans/src/test/java/org/springframework/beans/factory/annotation/CustomAutowireConfigurerTests.java

@ -69,6 +69,7 @@ public final class CustomAutowireConfigurerTests { @@ -69,6 +69,7 @@ public final class CustomAutowireConfigurerTests {
public static class CustomResolver implements AutowireCandidateResolver {
@Override
public boolean isAutowireCandidate(BeanDefinitionHolder bdHolder, DependencyDescriptor descriptor) {
if (!bdHolder.getBeanDefinition().isAutowireCandidate()) {
return false;
@ -82,6 +83,7 @@ public final class CustomAutowireConfigurerTests { @@ -82,6 +83,7 @@ public final class CustomAutowireConfigurerTests {
return false;
}
@Override
public Object getSuggestedValue(DependencyDescriptor descriptor) {
return null;
}

7
spring-beans/src/test/java/org/springframework/beans/factory/annotation/InjectAnnotationBeanPostProcessorTests.java

@ -609,6 +609,7 @@ public class InjectAnnotationBeanPostProcessorTests { @@ -609,6 +609,7 @@ public class InjectAnnotationBeanPostProcessorTests {
public ExtendedResourceInjectionBean() {
}
@Override
@Inject @Required
public void setTestBean2(TestBean testBean2) {
super.setTestBean2(testBean2);
@ -662,6 +663,7 @@ public class InjectAnnotationBeanPostProcessorTests { @@ -662,6 +663,7 @@ public class InjectAnnotationBeanPostProcessorTests {
private ITestBean testBean4;
@Override
@Inject
public void setTestBean2(TestBean testBean2) {
super.setTestBean2(testBean2);
@ -708,6 +710,7 @@ public class InjectAnnotationBeanPostProcessorTests { @@ -708,6 +710,7 @@ public class InjectAnnotationBeanPostProcessorTests {
private ITestBean testBean4;
@Override
@Inject
public void setTestBean2(TestBean testBean2) {
super.setTestBean2(testBean2);
@ -779,6 +782,7 @@ public class InjectAnnotationBeanPostProcessorTests { @@ -779,6 +782,7 @@ public class InjectAnnotationBeanPostProcessorTests {
throw new UnsupportedOperationException();
}
@Override
@Inject
public void setTestBean2(TestBean testBean2) {
super.setTestBean2(testBean2);
@ -1074,14 +1078,17 @@ public class InjectAnnotationBeanPostProcessorTests { @@ -1074,14 +1078,17 @@ public class InjectAnnotationBeanPostProcessorTests {
public static class StringFactoryBean implements FactoryBean<String> {
@Override
public String getObject() throws Exception {
return "";
}
@Override
public Class<String> getObjectType() {
return String.class;
}
@Override
public boolean isSingleton() {
return true;
}

2
spring-beans/src/test/java/org/springframework/beans/factory/config/CustomEditorConfigurerTests.java

@ -53,6 +53,7 @@ public final class CustomEditorConfigurerTests { @@ -53,6 +53,7 @@ public final class CustomEditorConfigurerTests {
final DateFormat df = DateFormat.getDateInstance(DateFormat.SHORT, Locale.GERMAN);
cec.setPropertyEditorRegistrars(new PropertyEditorRegistrar[] {
new PropertyEditorRegistrar() {
@Override
public void registerCustomEditors(PropertyEditorRegistry registry) {
registry.registerCustomEditor(Date.class, new CustomDateEditor(df, true));
}
@ -189,6 +190,7 @@ public final class CustomEditorConfigurerTests { @@ -189,6 +190,7 @@ public final class CustomEditorConfigurerTests {
public static class MyTestEditor extends PropertyEditorSupport {
@Override
public void setAsText(String text) {
setValue(new String[] {"test"});
}

3
spring-beans/src/test/java/org/springframework/beans/factory/config/PropertyResourceConfigurerTests.java

@ -812,6 +812,7 @@ public final class PropertyResourceConfigurerTests { @@ -812,6 +812,7 @@ public final class PropertyResourceConfigurerTests {
private static class ConvertingOverrideConfigurer extends PropertyOverrideConfigurer {
@Override
protected String convertPropertyValue(String originalValue) {
return "X" + originalValue;
}
@ -826,10 +827,12 @@ public final class PropertyResourceConfigurerTests { @@ -826,10 +827,12 @@ public final class PropertyResourceConfigurerTests {
private Preferences userRoot = new MockPreferences();
@Override
public Preferences systemRoot() {
return systemRoot;
}
@Override
public Preferences userRoot() {
return userRoot;
}

1
spring-beans/src/test/java/org/springframework/beans/factory/config/SimpleScopeTests.java

@ -53,6 +53,7 @@ public final class SimpleScopeTests { @@ -53,6 +53,7 @@ public final class SimpleScopeTests {
objects.add(new TestBean());
objects.add(new TestBean());
}
@Override
public Object get(String name, ObjectFactory<?> objectFactory) {
if (index >= objects.size()) {
index = 0;

5
spring-beans/src/test/java/org/springframework/beans/factory/config/TestTypes.java

@ -30,21 +30,26 @@ final class TestTypes {} @@ -30,21 +30,26 @@ final class TestTypes {}
*/
class NoOpScope implements Scope {
@Override
public Object get(String name, ObjectFactory<?> objectFactory) {
throw new UnsupportedOperationException();
}
@Override
public Object remove(String name) {
throw new UnsupportedOperationException();
}
@Override
public void registerDestructionCallback(String name, Runnable callback) {
}
@Override
public Object resolveContextualObject(String key) {
return null;
}
@Override
public String getConversationId() {
return null;
}

3
spring-beans/src/test/java/org/springframework/beans/factory/parsing/CustomProblemReporterTests.java

@ -71,10 +71,12 @@ public final class CustomProblemReporterTests { @@ -71,10 +71,12 @@ public final class CustomProblemReporterTests {
private List<Problem> warnings = new ArrayList<Problem>();
@Override
public void fatal(Problem problem) {
throw new BeanDefinitionParsingException(problem);
}
@Override
public void error(Problem problem) {
System.out.println(problem);
this.errors.add(problem);
@ -84,6 +86,7 @@ public final class CustomProblemReporterTests { @@ -84,6 +86,7 @@ public final class CustomProblemReporterTests {
return this.errors.toArray(new Problem[this.errors.size()]);
}
@Override
public void warning(Problem problem) {
System.out.println(problem);
this.warnings.add(problem);

2
spring-beans/src/test/java/org/springframework/beans/factory/support/BeanFactoryGenericsTests.java

@ -391,6 +391,7 @@ public class BeanFactoryGenericsTests { @@ -391,6 +391,7 @@ public class BeanFactoryGenericsTests {
public void testGenericMapWithCollectionValueConstructor() throws MalformedURLException {
DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
bf.addPropertyEditorRegistrar(new PropertyEditorRegistrar() {
@Override
public void registerCustomEditors(PropertyEditorRegistry registry) {
registry.registerCustomEditor(Number.class, new CustomNumberEditor(Integer.class, false));
}
@ -547,6 +548,7 @@ public class BeanFactoryGenericsTests { @@ -547,6 +548,7 @@ public class BeanFactoryGenericsTests {
public void testGenericMapWithCollectionValueFactoryMethod() throws MalformedURLException {
DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
bf.addPropertyEditorRegistrar(new PropertyEditorRegistrar() {
@Override
public void registerCustomEditors(PropertyEditorRegistry registry) {
registry.registerCustomEditor(Number.class, new CustomNumberEditor(Integer.class, false));
}

1
spring-beans/src/test/java/org/springframework/beans/factory/support/PropertiesBeanDefinitionReaderTests.java

@ -30,6 +30,7 @@ public class PropertiesBeanDefinitionReaderTests extends TestCase { @@ -30,6 +30,7 @@ public class PropertiesBeanDefinitionReaderTests extends TestCase {
private PropertiesBeanDefinitionReader reader;
@Override
protected void setUp() throws Exception {
this.beanFactory = new DefaultListableBeanFactory();
this.reader = new PropertiesBeanDefinitionReader(beanFactory);

3
spring-beans/src/test/java/org/springframework/beans/factory/support/Spr8954Tests.java

@ -61,14 +61,17 @@ public class Spr8954Tests { @@ -61,14 +61,17 @@ public class Spr8954Tests {
static class FooFactoryBean implements FactoryBean<Foo>, AnInterface {
@Override
public Foo getObject() throws Exception {
return new Foo();
}
@Override
public Class<?> getObjectType() {
return Foo.class;
}
@Override
public boolean isSingleton() {
return true;
}

18
spring-beans/src/test/java/org/springframework/beans/factory/support/security/CallbacksSecurityTests.java

@ -129,23 +129,28 @@ public class CallbacksSecurityTests { @@ -129,23 +129,28 @@ public class CallbacksSecurityTests {
checkCurrentContext();
}
@Override
public void afterPropertiesSet() {
checkCurrentContext();
}
@Override
public void destroy() {
checkCurrentContext();
destroyed = true;
}
@Override
public void setBeanName(String name) {
checkCurrentContext();
}
@Override
public void setBeanClassLoader(ClassLoader classLoader) {
checkCurrentContext();
}
@Override
public void setBeanFactory(BeanFactory beanFactory)
throws BeansException {
checkCurrentContext();
@ -164,26 +169,31 @@ public class CallbacksSecurityTests { @@ -164,26 +169,31 @@ public class CallbacksSecurityTests {
checkCurrentContext();
}
@Override
public boolean isEagerInit() {
checkCurrentContext();
return false;
}
@Override
public boolean isPrototype() {
checkCurrentContext();
return true;
}
@Override
public Object getObject() throws Exception {
checkCurrentContext();
return new Object();
}
@Override
public Class getObjectType() {
checkCurrentContext();
return Object.class;
}
@Override
public boolean isSingleton() {
checkCurrentContext();
return false;
@ -219,6 +229,7 @@ public class CallbacksSecurityTests { @@ -219,6 +229,7 @@ public class CallbacksSecurityTests {
return AccessController.doPrivileged(new PrivilegedAction<String>() {
@Override
public String run() {
Subject subject = Subject.getSubject(acc);
if (subject == null) {
@ -246,6 +257,7 @@ public class CallbacksSecurityTests { @@ -246,6 +257,7 @@ public class CallbacksSecurityTests {
this.name = name;
}
@Override
public String getName() {
return this.name;
}
@ -291,6 +303,7 @@ public class CallbacksSecurityTests { @@ -291,6 +303,7 @@ public class CallbacksSecurityTests {
private final AccessControlContext acc = new AccessControlContext(
new ProtectionDomain[] { empty });
@Override
public AccessControlContext getAccessControlContext() {
return acc;
}
@ -320,6 +333,7 @@ public class CallbacksSecurityTests { @@ -320,6 +333,7 @@ public class CallbacksSecurityTests {
try {
AccessController.doPrivileged(new PrivilegedExceptionAction<Object>() {
@Override
public Object run() throws Exception {
method.invoke(bean);
return null;
@ -334,6 +348,7 @@ public class CallbacksSecurityTests { @@ -334,6 +348,7 @@ public class CallbacksSecurityTests {
AccessController.doPrivileged(
new PrivilegedExceptionAction<Object>() {
@Override
public Object run() throws Exception {
return cl.newInstance();
}
@ -444,6 +459,7 @@ public class CallbacksSecurityTests { @@ -444,6 +459,7 @@ public class CallbacksSecurityTests {
AccessController.doPrivileged(new PrivilegedExceptionAction<Object>() {
@Override
public Object run() throws Exception {
beanFactory.getBean("working-factory-method");
beanFactory.getBean("container-execution");
@ -478,6 +494,7 @@ public class CallbacksSecurityTests { @@ -478,6 +494,7 @@ public class CallbacksSecurityTests {
NonPrivilegedBean bean = Subject.doAsPrivileged(
subject, new PrivilegedAction<NonPrivilegedBean>() {
@Override
public NonPrivilegedBean run() {
return lbf.getBean("test", NonPrivilegedBean.class);
}
@ -502,6 +519,7 @@ public class CallbacksSecurityTests { @@ -502,6 +519,7 @@ public class CallbacksSecurityTests {
// request the beans from non-privileged code
Subject.doAsPrivileged(subject, new PrivilegedAction<Object>() {
@Override
public Object run() {
// sanity check
assertEquals("user1", getCurrentSubjectName());

3
spring-beans/src/test/java/org/springframework/beans/factory/support/security/support/CustomFactoryBean.java

@ -24,15 +24,18 @@ import org.springframework.beans.factory.FactoryBean; @@ -24,15 +24,18 @@ import org.springframework.beans.factory.FactoryBean;
*/
public class CustomFactoryBean implements FactoryBean<Object> {
@Override
public Object getObject() throws Exception {
return System.getProperties();
}
@Override
public Class getObjectType() {
System.setProperty("factory.object.type", "true");
return Properties.class;
}
@Override
public boolean isSingleton() {
return true;
}

1
spring-beans/src/test/java/org/springframework/beans/factory/support/security/support/DestroyBean.java

@ -22,6 +22,7 @@ import org.springframework.beans.factory.DisposableBean; @@ -22,6 +22,7 @@ import org.springframework.beans.factory.DisposableBean;
*/
public class DestroyBean implements DisposableBean {
@Override
public void destroy() throws Exception {
System.setProperty("security.destroy", "true");
}

1
spring-beans/src/test/java/org/springframework/beans/factory/support/security/support/InitBean.java

@ -22,6 +22,7 @@ import org.springframework.beans.factory.InitializingBean; @@ -22,6 +22,7 @@ import org.springframework.beans.factory.InitializingBean;
*/
public class InitBean implements InitializingBean {
@Override
public void afterPropertiesSet() throws Exception {
System.getProperties();
}

2
spring-beans/src/test/java/org/springframework/beans/factory/xml/AbstractBeanFactoryTests.java

@ -326,6 +326,7 @@ public abstract class AbstractBeanFactoryTests extends TestCase { @@ -326,6 +326,7 @@ public abstract class AbstractBeanFactoryTests extends TestCase {
public static class TestBeanEditor extends PropertyEditorSupport {
@Override
public void setAsText(String text) {
TestBean tb = new TestBean();
StringTokenizer st = new StringTokenizer(text, "_");
@ -350,6 +351,7 @@ class MustBeInitialized implements InitializingBean { @@ -350,6 +351,7 @@ class MustBeInitialized implements InitializingBean {
/**
* @see InitializingBean#afterPropertiesSet()
*/
@Override
public void afterPropertiesSet() throws Exception {
this.inited = true;
}

1
spring-beans/src/test/java/org/springframework/beans/factory/xml/BeanNameGenerationTests.java

@ -30,6 +30,7 @@ public class BeanNameGenerationTests extends TestCase { @@ -30,6 +30,7 @@ public class BeanNameGenerationTests extends TestCase {
private DefaultListableBeanFactory beanFactory;
@Override
public void setUp() {
this.beanFactory = new DefaultListableBeanFactory();
XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(this.beanFactory);

4
spring-beans/src/test/java/org/springframework/beans/factory/xml/CollectingReaderEventListener.java

@ -45,6 +45,7 @@ public class CollectingReaderEventListener implements ReaderEventListener { @@ -45,6 +45,7 @@ public class CollectingReaderEventListener implements ReaderEventListener {
private final List imports = new LinkedList();
@Override
public void defaultsRegistered(DefaultsDefinition defaultsDefinition) {
this.defaults.add(defaultsDefinition);
}
@ -53,6 +54,7 @@ public class CollectingReaderEventListener implements ReaderEventListener { @@ -53,6 +54,7 @@ public class CollectingReaderEventListener implements ReaderEventListener {
return Collections.unmodifiableList(this.defaults);
}
@Override
public void componentRegistered(ComponentDefinition componentDefinition) {
this.componentDefinitions.put(componentDefinition.getName(), componentDefinition);
}
@ -66,6 +68,7 @@ public class CollectingReaderEventListener implements ReaderEventListener { @@ -66,6 +68,7 @@ public class CollectingReaderEventListener implements ReaderEventListener {
return (ComponentDefinition[]) collection.toArray(new ComponentDefinition[collection.size()]);
}
@Override
public void aliasRegistered(AliasDefinition aliasDefinition) {
List aliases = (List) this.aliasMap.get(aliasDefinition.getBeanName());
if(aliases == null) {
@ -80,6 +83,7 @@ public class CollectingReaderEventListener implements ReaderEventListener { @@ -80,6 +83,7 @@ public class CollectingReaderEventListener implements ReaderEventListener {
return aliases == null ? null : Collections.unmodifiableList(aliases);
}
@Override
public void importProcessed(ImportDefinition importDefinition) {
this.imports.add(importDefinition);
}

1
spring-beans/src/test/java/org/springframework/beans/factory/xml/CollectionMergingTests.java

@ -40,6 +40,7 @@ public class CollectionMergingTests extends TestCase { @@ -40,6 +40,7 @@ public class CollectionMergingTests extends TestCase {
private DefaultListableBeanFactory beanFactory;
@Override
protected void setUp() throws Exception {
this.beanFactory = new DefaultListableBeanFactory();
BeanDefinitionReader reader = new XmlBeanDefinitionReader(this.beanFactory);

3
spring-beans/src/test/java/org/springframework/beans/factory/xml/CountingFactory.java

@ -51,14 +51,17 @@ public class CountingFactory implements FactoryBean { @@ -51,14 +51,17 @@ public class CountingFactory implements FactoryBean {
}
@Override
public Object getObject() {
return "myString";
}
@Override
public Class getObjectType() {
return String.class;
}
@Override
public boolean isSingleton() {
return true;
}

1
spring-beans/src/test/java/org/springframework/beans/factory/xml/DefaultLifecycleMethodsTests.java

@ -27,6 +27,7 @@ public class DefaultLifecycleMethodsTests extends TestCase { @@ -27,6 +27,7 @@ public class DefaultLifecycleMethodsTests extends TestCase {
private XmlBeanFactory beanFactory;
@Override
protected void setUp() throws Exception {
this.beanFactory = new XmlBeanFactory(new ClassPathResource("defaultLifecycleMethods.xml", getClass()));
}

1
spring-beans/src/test/java/org/springframework/beans/factory/xml/DelegatingEntityResolverTests.java

@ -45,6 +45,7 @@ public final class DelegatingEntityResolverTests { @@ -45,6 +45,7 @@ public final class DelegatingEntityResolverTests {
private static final class NoOpEntityResolver implements EntityResolver {
@Override
public InputSource resolveEntity(String publicId, String systemId) {
return null;
}

1
spring-beans/src/test/java/org/springframework/beans/factory/xml/DependenciesBean.java

@ -62,6 +62,7 @@ public class DependenciesBean implements BeanFactoryAware { @@ -62,6 +62,7 @@ public class DependenciesBean implements BeanFactoryAware {
return spouse;
}
@Override
public void setBeanFactory(BeanFactory beanFactory) {
this.beanFactory = beanFactory;
}

1
spring-beans/src/test/java/org/springframework/beans/factory/xml/EventPublicationTests.java

@ -42,6 +42,7 @@ public class EventPublicationTests extends TestCase { @@ -42,6 +42,7 @@ public class EventPublicationTests extends TestCase {
private final CollectingReaderEventListener eventListener = new CollectingReaderEventListener();
@Override
protected void setUp() throws Exception {
XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(this.beanFactory);
reader.setEventListener(this.eventListener);

1
spring-beans/src/test/java/org/springframework/beans/factory/xml/GeneratedNameBean.java

@ -27,6 +27,7 @@ public class GeneratedNameBean implements BeanNameAware { @@ -27,6 +27,7 @@ public class GeneratedNameBean implements BeanNameAware {
private GeneratedNameBean child;
@Override
public void setBeanName(String beanName) {
this.beanName = beanName;
}

1
spring-beans/src/test/java/org/springframework/beans/factory/xml/MetadataAttachmentTests.java

@ -29,6 +29,7 @@ public class MetadataAttachmentTests extends TestCase { @@ -29,6 +29,7 @@ public class MetadataAttachmentTests extends TestCase {
private XmlBeanFactory beanFactory;
@Override
protected void setUp() throws Exception {
this.beanFactory = new XmlBeanFactory(new ClassPathResource("withMeta.xml", getClass()));
}

1
spring-beans/src/test/java/org/springframework/beans/factory/xml/ProfileXmlBeanDefinitionTests.java

@ -171,6 +171,7 @@ public class ProfileXmlBeanDefinitionTests { @@ -171,6 +171,7 @@ public class ProfileXmlBeanDefinitionTests {
private static Matcher<BeanDefinitionRegistry> containsBeanDefinition(final String beanName) {
return new TypeSafeMatcher<BeanDefinitionRegistry>() {
@Override
public void describeTo(Description desc) {
desc.appendText("a BeanDefinitionRegistry containing bean named ")
.appendValue(beanName);

6
spring-beans/src/test/java/org/springframework/beans/factory/xml/ProtectedLifecycleBean.java

@ -57,6 +57,7 @@ class ProtectedLifecycleBean implements BeanNameAware, BeanFactoryAware, Initial @@ -57,6 +57,7 @@ class ProtectedLifecycleBean implements BeanNameAware, BeanFactoryAware, Initial
return initMethodDeclared;
}
@Override
public void setBeanName(String name) {
this.beanName = name;
}
@ -65,6 +66,7 @@ class ProtectedLifecycleBean implements BeanNameAware, BeanFactoryAware, Initial @@ -65,6 +66,7 @@ class ProtectedLifecycleBean implements BeanNameAware, BeanFactoryAware, Initial
return beanName;
}
@Override
public void setBeanFactory(BeanFactory beanFactory) {
this.owningFactory = beanFactory;
}
@ -79,6 +81,7 @@ class ProtectedLifecycleBean implements BeanNameAware, BeanFactoryAware, Initial @@ -79,6 +81,7 @@ class ProtectedLifecycleBean implements BeanNameAware, BeanFactoryAware, Initial
this.postProcessedBeforeInit = true;
}
@Override
public void afterPropertiesSet() {
if (this.owningFactory == null) {
throw new RuntimeException("Factory didn't call setBeanFactory before afterPropertiesSet on lifecycle bean");
@ -130,6 +133,7 @@ class ProtectedLifecycleBean implements BeanNameAware, BeanFactoryAware, Initial @@ -130,6 +133,7 @@ class ProtectedLifecycleBean implements BeanNameAware, BeanFactoryAware, Initial
}
}
@Override
public void destroy() {
if (this.destroyed) {
throw new IllegalStateException("Already destroyed");
@ -144,6 +148,7 @@ class ProtectedLifecycleBean implements BeanNameAware, BeanFactoryAware, Initial @@ -144,6 +148,7 @@ class ProtectedLifecycleBean implements BeanNameAware, BeanFactoryAware, Initial
public static class PostProcessor implements BeanPostProcessor {
@Override
public Object postProcessBeforeInitialization(Object bean, String name) throws BeansException {
if (bean instanceof ProtectedLifecycleBean) {
((ProtectedLifecycleBean) bean).postProcessBeforeInit();
@ -151,6 +156,7 @@ class ProtectedLifecycleBean implements BeanNameAware, BeanFactoryAware, Initial @@ -151,6 +156,7 @@ class ProtectedLifecycleBean implements BeanNameAware, BeanFactoryAware, Initial
return bean;
}
@Override
public Object postProcessAfterInitialization(Object bean, String name) throws BeansException {
if (bean instanceof ProtectedLifecycleBean) {
((ProtectedLifecycleBean) bean).postProcessAfterInit();

1
spring-beans/src/test/java/org/springframework/beans/factory/xml/UtilNamespaceHandlerTests.java

@ -46,6 +46,7 @@ public class UtilNamespaceHandlerTests extends TestCase { @@ -46,6 +46,7 @@ public class UtilNamespaceHandlerTests extends TestCase {
private CollectingReaderEventListener listener = new CollectingReaderEventListener();
@Override
public void setUp() {
this.beanFactory = new DefaultListableBeanFactory();
XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(this.beanFactory);

5
spring-beans/src/test/java/org/springframework/beans/factory/xml/XmlListableBeanFactoryTests.java

@ -46,6 +46,7 @@ public class XmlListableBeanFactoryTests extends AbstractListableBeanFactoryTest @@ -46,6 +46,7 @@ public class XmlListableBeanFactoryTests extends AbstractListableBeanFactoryTest
private XmlBeanFactory factory;
@Override
protected void setUp() {
parent = new DefaultListableBeanFactory();
Map m = new HashMap();
@ -59,6 +60,7 @@ public class XmlListableBeanFactoryTests extends AbstractListableBeanFactoryTest @@ -59,6 +60,7 @@ public class XmlListableBeanFactoryTests extends AbstractListableBeanFactoryTest
this.factory = new XmlBeanFactory(new ClassPathResource("test.xml", getClass()), parent);
this.factory.addBeanPostProcessor(new BeanPostProcessor() {
@Override
public Object postProcessBeforeInitialization(Object bean, String name) throws BeansException {
if (bean instanceof TestBean) {
((TestBean) bean).setPostProcessed(true);
@ -68,6 +70,7 @@ public class XmlListableBeanFactoryTests extends AbstractListableBeanFactoryTest @@ -68,6 +70,7 @@ public class XmlListableBeanFactoryTests extends AbstractListableBeanFactoryTest
}
return bean;
}
@Override
public Object postProcessAfterInitialization(Object bean, String name) throws BeansException {
return bean;
}
@ -77,10 +80,12 @@ public class XmlListableBeanFactoryTests extends AbstractListableBeanFactoryTest @@ -77,10 +80,12 @@ public class XmlListableBeanFactoryTests extends AbstractListableBeanFactoryTest
//this.factory.preInstantiateSingletons();
}
@Override
protected BeanFactory getBeanFactory() {
return factory;
}
@Override
public void testCount() {
assertCount(24);
}

2
spring-beans/src/test/java/org/springframework/beans/propertyeditors/BeanInfoTests.java

@ -70,6 +70,7 @@ public class BeanInfoTests extends TestCase { @@ -70,6 +70,7 @@ public class BeanInfoTests extends TestCase {
public static class ValueBeanBeanInfo extends SimpleBeanInfo {
@Override
public PropertyDescriptor[] getPropertyDescriptors() {
try {
PropertyDescriptor pd = new PropertyDescriptor("value", ValueBean.class);
@ -96,6 +97,7 @@ public class BeanInfoTests extends TestCase { @@ -96,6 +97,7 @@ public class BeanInfoTests extends TestCase {
this.target = target;
}
@Override
public void setAsText(String text) throws IllegalArgumentException {
if (JdkVersion.getMajorJavaVersion() >= JdkVersion.JAVA_15) {
Assert.isTrue(this.target instanceof ValueBean, "Target must be available on JDK 1.5+");

46
spring-beans/src/test/java/org/springframework/beans/propertyeditors/CustomEditorTests.java

@ -113,6 +113,7 @@ public class CustomEditorTests { @@ -113,6 +113,7 @@ public class CustomEditorTests {
TestBean tb = new TestBean();
BeanWrapper bw = new BeanWrapperImpl(tb);
bw.registerCustomEditor(String.class, "name", new PropertyEditorSupport() {
@Override
public void setAsText(String text) throws IllegalArgumentException {
setValue("prefix" + text);
}
@ -130,6 +131,7 @@ public class CustomEditorTests { @@ -130,6 +131,7 @@ public class CustomEditorTests {
TestBean tb = new TestBean();
BeanWrapper bw = new BeanWrapperImpl(tb);
bw.registerCustomEditor(String.class, new PropertyEditorSupport() {
@Override
public void setAsText(String text) throws IllegalArgumentException {
setValue("prefix" + text);
}
@ -148,6 +150,7 @@ public class CustomEditorTests { @@ -148,6 +150,7 @@ public class CustomEditorTests {
tb.setSpouse(new TestBean());
BeanWrapper bw = new BeanWrapperImpl(tb);
bw.registerCustomEditor(String.class, "spouse.name", new PropertyEditorSupport() {
@Override
public void setAsText(String text) throws IllegalArgumentException {
setValue("prefix" + text);
}
@ -166,6 +169,7 @@ public class CustomEditorTests { @@ -166,6 +169,7 @@ public class CustomEditorTests {
tb.setSpouse(new TestBean());
BeanWrapper bw = new BeanWrapperImpl(tb);
bw.registerCustomEditor(String.class, new PropertyEditorSupport() {
@Override
public void setAsText(String text) throws IllegalArgumentException {
setValue("prefix" + text);
}
@ -853,6 +857,7 @@ public class CustomEditorTests { @@ -853,6 +857,7 @@ public class CustomEditorTests {
IndexedTestBean bean = new IndexedTestBean();
BeanWrapper bw = new BeanWrapperImpl(bean);
bw.registerCustomEditor(String.class, new PropertyEditorSupport() {
@Override
public void setAsText(String text) throws IllegalArgumentException {
setValue("prefix" + text);
}
@ -905,16 +910,19 @@ public class CustomEditorTests { @@ -905,16 +910,19 @@ public class CustomEditorTests {
IndexedTestBean bean = new IndexedTestBean(false);
BeanWrapper bw = new BeanWrapperImpl(bean);
bw.registerCustomEditor(String.class, "array.name", new PropertyEditorSupport() {
@Override
public void setAsText(String text) throws IllegalArgumentException {
setValue("array" + text);
}
});
bw.registerCustomEditor(String.class, "list.name", new PropertyEditorSupport() {
@Override
public void setAsText(String text) throws IllegalArgumentException {
setValue("list" + text);
}
});
bw.registerCustomEditor(String.class, "map.name", new PropertyEditorSupport() {
@Override
public void setAsText(String text) throws IllegalArgumentException {
setValue("map" + text);
}
@ -969,31 +977,37 @@ public class CustomEditorTests { @@ -969,31 +977,37 @@ public class CustomEditorTests {
IndexedTestBean bean = new IndexedTestBean(false);
BeanWrapper bw = new BeanWrapperImpl(bean);
bw.registerCustomEditor(String.class, "array[0].name", new PropertyEditorSupport() {
@Override
public void setAsText(String text) throws IllegalArgumentException {
setValue("array0" + text);
}
});
bw.registerCustomEditor(String.class, "array[1].name", new PropertyEditorSupport() {
@Override
public void setAsText(String text) throws IllegalArgumentException {
setValue("array1" + text);
}
});
bw.registerCustomEditor(String.class, "list[0].name", new PropertyEditorSupport() {
@Override
public void setAsText(String text) throws IllegalArgumentException {
setValue("list0" + text);
}
});
bw.registerCustomEditor(String.class, "list[1].name", new PropertyEditorSupport() {
@Override
public void setAsText(String text) throws IllegalArgumentException {
setValue("list1" + text);
}
});
bw.registerCustomEditor(String.class, "map[key1].name", new PropertyEditorSupport() {
@Override
public void setAsText(String text) throws IllegalArgumentException {
setValue("mapkey1" + text);
}
});
bw.registerCustomEditor(String.class, "map[key2].name", new PropertyEditorSupport() {
@Override
public void setAsText(String text) throws IllegalArgumentException {
setValue("mapkey2" + text);
}
@ -1060,28 +1074,34 @@ public class CustomEditorTests { @@ -1060,28 +1074,34 @@ public class CustomEditorTests {
tb5.setNestedIndexedBean(new IndexedTestBean());
BeanWrapper bw = new BeanWrapperImpl(bean);
bw.registerCustomEditor(String.class, "array.nestedIndexedBean.array.name", new PropertyEditorSupport() {
@Override
public void setAsText(String text) throws IllegalArgumentException {
setValue("array" + text);
}
@Override
public String getAsText() {
return ((String) getValue()).substring(5);
}
});
bw.registerCustomEditor(String.class, "list.nestedIndexedBean.list.name", new PropertyEditorSupport() {
@Override
public void setAsText(String text) throws IllegalArgumentException {
setValue("list" + text);
}
@Override
public String getAsText() {
return ((String) getValue()).substring(4);
}
});
bw.registerCustomEditor(String.class, "map.nestedIndexedBean.map.name", new PropertyEditorSupport() {
@Override
public void setAsText(String text) throws IllegalArgumentException {
setValue("map" + text);
}
@Override
public String getAsText() {
return ((String) getValue()).substring(4);
}
@ -1138,16 +1158,19 @@ public class CustomEditorTests { @@ -1138,16 +1158,19 @@ public class CustomEditorTests {
tb5.setNestedIndexedBean(new IndexedTestBean());
BeanWrapper bw = new BeanWrapperImpl(bean);
bw.registerCustomEditor(String.class, "array[0].nestedIndexedBean.array[0].name", new PropertyEditorSupport() {
@Override
public void setAsText(String text) throws IllegalArgumentException {
setValue("array" + text);
}
});
bw.registerCustomEditor(String.class, "list.nestedIndexedBean.list[1].name", new PropertyEditorSupport() {
@Override
public void setAsText(String text) throws IllegalArgumentException {
setValue("list" + text);
}
});
bw.registerCustomEditor(String.class, "map[key1].nestedIndexedBean.map.name", new PropertyEditorSupport() {
@Override
public void setAsText(String text) throws IllegalArgumentException {
setValue("map" + text);
}
@ -1174,28 +1197,34 @@ public class CustomEditorTests { @@ -1174,28 +1197,34 @@ public class CustomEditorTests {
IndexedTestBean bean = new IndexedTestBean();
BeanWrapper bw = new BeanWrapperImpl(bean);
bw.registerCustomEditor(TestBean.class, "array", new PropertyEditorSupport() {
@Override
public void setAsText(String text) throws IllegalArgumentException {
setValue(new TestBean("array" + text, 99));
}
@Override
public String getAsText() {
return ((TestBean) getValue()).getName();
}
});
bw.registerCustomEditor(TestBean.class, "list", new PropertyEditorSupport() {
@Override
public void setAsText(String text) throws IllegalArgumentException {
setValue(new TestBean("list" + text, 99));
}
@Override
public String getAsText() {
return ((TestBean) getValue()).getName();
}
});
bw.registerCustomEditor(TestBean.class, "map", new PropertyEditorSupport() {
@Override
public void setAsText(String text) throws IllegalArgumentException {
setValue(new TestBean("map" + text, 99));
}
@Override
public String getAsText() {
return ((TestBean) getValue()).getName();
}
@ -1222,55 +1251,67 @@ public class CustomEditorTests { @@ -1222,55 +1251,67 @@ public class CustomEditorTests {
IndexedTestBean bean = new IndexedTestBean();
BeanWrapper bw = new BeanWrapperImpl(bean);
bw.registerCustomEditor(TestBean.class, "array[0]", new PropertyEditorSupport() {
@Override
public void setAsText(String text) throws IllegalArgumentException {
setValue(new TestBean("array0" + text, 99));
}
@Override
public String getAsText() {
return ((TestBean) getValue()).getName();
}
});
bw.registerCustomEditor(TestBean.class, "array[1]", new PropertyEditorSupport() {
@Override
public void setAsText(String text) throws IllegalArgumentException {
setValue(new TestBean("array1" + text, 99));
}
@Override
public String getAsText() {
return ((TestBean) getValue()).getName();
}
});
bw.registerCustomEditor(TestBean.class, "list[0]", new PropertyEditorSupport() {
@Override
public void setAsText(String text) throws IllegalArgumentException {
setValue(new TestBean("list0" + text, 99));
}
@Override
public String getAsText() {
return ((TestBean) getValue()).getName();
}
});
bw.registerCustomEditor(TestBean.class, "list[1]", new PropertyEditorSupport() {
@Override
public void setAsText(String text) throws IllegalArgumentException {
setValue(new TestBean("list1" + text, 99));
}
@Override
public String getAsText() {
return ((TestBean) getValue()).getName();
}
});
bw.registerCustomEditor(TestBean.class, "map[key1]", new PropertyEditorSupport() {
@Override
public void setAsText(String text) throws IllegalArgumentException {
setValue(new TestBean("mapkey1" + text, 99));
}
@Override
public String getAsText() {
return ((TestBean) getValue()).getName();
}
});
bw.registerCustomEditor(TestBean.class, "map[key2]", new PropertyEditorSupport() {
@Override
public void setAsText(String text) throws IllegalArgumentException {
setValue(new TestBean("mapkey2" + text, 99));
}
@Override
public String getAsText() {
return ((TestBean) getValue()).getName();
}
@ -1297,6 +1338,7 @@ public class CustomEditorTests { @@ -1297,6 +1338,7 @@ public class CustomEditorTests {
IndexedTestBean bean = new IndexedTestBean();
BeanWrapper bw = new BeanWrapperImpl(bean);
bw.registerCustomEditor(List.class, "list", new PropertyEditorSupport() {
@Override
public void setAsText(String text) throws IllegalArgumentException {
List<TestBean> result = new ArrayList<TestBean>();
result.add(new TestBean("list" + text, 99));
@ -1347,6 +1389,7 @@ public class CustomEditorTests { @@ -1347,6 +1389,7 @@ public class CustomEditorTests {
IndexedTestBean tb = new IndexedTestBean();
BeanWrapper bw = new BeanWrapperImpl(tb);
bw.registerCustomEditor(TestBean.class, new PropertyEditorSupport() {
@Override
public void setAsText(String text) throws IllegalArgumentException {
setValue(new TestBean(text, 99));
}
@ -1362,6 +1405,7 @@ public class CustomEditorTests { @@ -1362,6 +1405,7 @@ public class CustomEditorTests {
TestBean tb = new TestBean();
BeanWrapper bw = new BeanWrapperImpl(tb);
bw.registerCustomEditor(String.class, new PropertyEditorSupport() {
@Override
public void setAsText(String text) throws IllegalArgumentException {
setValue("-" + text + "-");
}
@ -1436,6 +1480,7 @@ public class CustomEditorTests { @@ -1436,6 +1480,7 @@ public class CustomEditorTests {
private static class TestBeanEditor extends PropertyEditorSupport {
@Override
public void setAsText(String text) {
TestBean tb = new TestBean();
StringTokenizer st = new StringTokenizer(text, "_");
@ -1448,6 +1493,7 @@ public class CustomEditorTests { @@ -1448,6 +1493,7 @@ public class CustomEditorTests {
private static class OldValueAccessingTestBeanEditor extends PropertyEditorSupport {
@Override
public void setAsText(String text) {
TestBean tb = new TestBean();
StringTokenizer st = new StringTokenizer(text, "_");

1
spring-beans/src/test/java/org/springframework/beans/support/PropertyComparatorTests.java

@ -104,6 +104,7 @@ public class PropertyComparatorTests { @@ -104,6 +104,7 @@ public class PropertyComparatorTests {
private String lastName;
@Override
public int compareTo(Object o) {
return nickName.compareTo(((Dog)o).nickName);
}

4
spring-beans/src/test/java/test/beans/DerivedTestBean.java

@ -51,12 +51,14 @@ public class DerivedTestBean extends TestBean implements Serializable, BeanNameA @@ -51,12 +51,14 @@ public class DerivedTestBean extends TestBean implements Serializable, BeanNameA
}
@Override
public void setBeanName(String beanName) {
if (this.beanName == null || beanName == null) {
this.beanName = beanName;
}
}
@Override
public String getBeanName() {
return beanName;
}
@ -79,10 +81,12 @@ public class DerivedTestBean extends TestBean implements Serializable, BeanNameA @@ -79,10 +81,12 @@ public class DerivedTestBean extends TestBean implements Serializable, BeanNameA
}
@Override
public void destroy() {
this.destroyed = true;
}
@Override
public boolean wasDestroyed() {
return destroyed;
}

7
spring-beans/src/test/java/test/beans/DummyFactory.java

@ -81,6 +81,7 @@ public class DummyFactory @@ -81,6 +81,7 @@ public class DummyFactory
* Return if the bean managed by this factory is a singleton.
* @see FactoryBean#isSingleton()
*/
@Override
public boolean isSingleton() {
return this.singleton;
}
@ -92,6 +93,7 @@ public class DummyFactory @@ -92,6 +93,7 @@ public class DummyFactory
this.singleton = singleton;
}
@Override
public void setBeanName(String beanName) {
this.beanName = beanName;
}
@ -100,6 +102,7 @@ public class DummyFactory @@ -100,6 +102,7 @@ public class DummyFactory
return beanName;
}
@Override
public void setBeanFactory(BeanFactory beanFactory) {
this.beanFactory = (AutowireCapableBeanFactory) beanFactory;
this.beanFactory.applyBeanPostProcessorsBeforeInitialization(this.testBean, this.beanName);
@ -126,6 +129,7 @@ public class DummyFactory @@ -126,6 +129,7 @@ public class DummyFactory
return otherTestBean;
}
@Override
public void afterPropertiesSet() {
if (initialized) {
throw new RuntimeException("Cannot call afterPropertiesSet twice on the one bean");
@ -151,6 +155,7 @@ public class DummyFactory @@ -151,6 +155,7 @@ public class DummyFactory
* and prototype mode.
* @see FactoryBean#getObject()
*/
@Override
public Object getObject() throws BeansException {
if (isSingleton()) {
return this.testBean;
@ -165,11 +170,13 @@ public class DummyFactory @@ -165,11 +170,13 @@ public class DummyFactory
}
}
@Override
public Class<?> getObjectType() {
return TestBean.class;
}
@Override
public void destroy() {
if (this.testBean != null) {
this.testBean.setName(null);

6
spring-beans/src/test/java/test/beans/LifecycleBean.java

@ -59,6 +59,7 @@ public class LifecycleBean implements BeanNameAware, BeanFactoryAware, Initializ @@ -59,6 +59,7 @@ public class LifecycleBean implements BeanNameAware, BeanFactoryAware, Initializ
return initMethodDeclared;
}
@Override
public void setBeanName(String name) {
this.beanName = name;
}
@ -67,6 +68,7 @@ public class LifecycleBean implements BeanNameAware, BeanFactoryAware, Initializ @@ -67,6 +68,7 @@ public class LifecycleBean implements BeanNameAware, BeanFactoryAware, Initializ
return beanName;
}
@Override
public void setBeanFactory(BeanFactory beanFactory) {
this.owningFactory = beanFactory;
}
@ -81,6 +83,7 @@ public class LifecycleBean implements BeanNameAware, BeanFactoryAware, Initializ @@ -81,6 +83,7 @@ public class LifecycleBean implements BeanNameAware, BeanFactoryAware, Initializ
this.postProcessedBeforeInit = true;
}
@Override
public void afterPropertiesSet() {
if (this.owningFactory == null) {
throw new RuntimeException("Factory didn't call setBeanFactory before afterPropertiesSet on lifecycle bean");
@ -132,6 +135,7 @@ public class LifecycleBean implements BeanNameAware, BeanFactoryAware, Initializ @@ -132,6 +135,7 @@ public class LifecycleBean implements BeanNameAware, BeanFactoryAware, Initializ
}
}
@Override
public void destroy() {
if (this.destroyed) {
throw new IllegalStateException("Already destroyed");
@ -146,6 +150,7 @@ public class LifecycleBean implements BeanNameAware, BeanFactoryAware, Initializ @@ -146,6 +150,7 @@ public class LifecycleBean implements BeanNameAware, BeanFactoryAware, Initializ
public static class PostProcessor implements BeanPostProcessor {
@Override
public Object postProcessBeforeInitialization(Object bean, String name) throws BeansException {
if (bean instanceof LifecycleBean) {
((LifecycleBean) bean).postProcessBeforeInit();
@ -153,6 +158,7 @@ public class LifecycleBean implements BeanNameAware, BeanFactoryAware, Initializ @@ -153,6 +158,7 @@ public class LifecycleBean implements BeanNameAware, BeanFactoryAware, Initializ
return bean;
}
@Override
public Object postProcessAfterInitialization(Object bean, String name) throws BeansException {
if (bean instanceof LifecycleBean) {
((LifecycleBean) bean).postProcessAfterInit();

1
spring-beans/src/test/java/test/beans/NestedTestBean.java

@ -37,6 +37,7 @@ public class NestedTestBean implements INestedTestBean { @@ -37,6 +37,7 @@ public class NestedTestBean implements INestedTestBean {
this.company = (company != null ? company : "");
}
@Override
public String getCompany() {
return company;
}

20
spring-beans/src/test/java/test/beans/TestBean.java

@ -137,6 +137,7 @@ public class TestBean implements BeanNameAware, BeanFactoryAware, ITestBean, IOt @@ -137,6 +137,7 @@ public class TestBean implements BeanNameAware, BeanFactoryAware, ITestBean, IOt
}
@Override
public void setBeanName(String beanName) {
this.beanName = beanName;
}
@ -145,6 +146,7 @@ public class TestBean implements BeanNameAware, BeanFactoryAware, ITestBean, IOt @@ -145,6 +146,7 @@ public class TestBean implements BeanNameAware, BeanFactoryAware, ITestBean, IOt
return beanName;
}
@Override
public void setBeanFactory(BeanFactory beanFactory) {
this.beanFactory = beanFactory;
}
@ -161,10 +163,12 @@ public class TestBean implements BeanNameAware, BeanFactoryAware, ITestBean, IOt @@ -161,10 +163,12 @@ public class TestBean implements BeanNameAware, BeanFactoryAware, ITestBean, IOt
return postProcessed;
}
@Override
public String getName() {
return name;
}
@Override
public void setName(String name) {
this.name = name;
}
@ -180,10 +184,12 @@ public class TestBean implements BeanNameAware, BeanFactoryAware, ITestBean, IOt @@ -180,10 +184,12 @@ public class TestBean implements BeanNameAware, BeanFactoryAware, ITestBean, IOt
}
}
@Override
public int getAge() {
return age;
}
@Override
public void setAge(int age) {
this.age = age;
}
@ -196,14 +202,17 @@ public class TestBean implements BeanNameAware, BeanFactoryAware, ITestBean, IOt @@ -196,14 +202,17 @@ public class TestBean implements BeanNameAware, BeanFactoryAware, ITestBean, IOt
this.jedi = jedi;
}
@Override
public void setSpouse(ITestBean spouse) {
this.spouses = new ITestBean[] {spouse};
}
@Override
public ITestBean getSpouse() {
return (spouses != null ? spouses[0] : null);
}
@Override
public ITestBean[] getSpouses() {
return spouses;
}
@ -230,10 +239,12 @@ public class TestBean implements BeanNameAware, BeanFactoryAware, ITestBean, IOt @@ -230,10 +239,12 @@ public class TestBean implements BeanNameAware, BeanFactoryAware, ITestBean, IOt
this.country = country;
}
@Override
public String[] getStringArray() {
return stringArray;
}
@Override
public void setStringArray(String[] stringArray) {
this.stringArray = stringArray;
}
@ -302,6 +313,7 @@ public class TestBean implements BeanNameAware, BeanFactoryAware, ITestBean, IOt @@ -302,6 +313,7 @@ public class TestBean implements BeanNameAware, BeanFactoryAware, ITestBean, IOt
this.someProperties = someProperties;
}
@Override
public INestedTestBean getDoctor() {
return doctor;
}
@ -310,6 +322,7 @@ public class TestBean implements BeanNameAware, BeanFactoryAware, ITestBean, IOt @@ -310,6 +322,7 @@ public class TestBean implements BeanNameAware, BeanFactoryAware, ITestBean, IOt
this.doctor = doctor;
}
@Override
public INestedTestBean getLawyer() {
return lawyer;
}
@ -342,6 +355,7 @@ public class TestBean implements BeanNameAware, BeanFactoryAware, ITestBean, IOt @@ -342,6 +355,7 @@ public class TestBean implements BeanNameAware, BeanFactoryAware, ITestBean, IOt
this.someBoolean = someBoolean;
}
@Override
public IndexedTestBean getNestedIndexedBean() {
return nestedIndexedBean;
}
@ -370,18 +384,21 @@ public class TestBean implements BeanNameAware, BeanFactoryAware, ITestBean, IOt @@ -370,18 +384,21 @@ public class TestBean implements BeanNameAware, BeanFactoryAware, ITestBean, IOt
/**
* @see ITestBean#exceptional(Throwable)
*/
@Override
public void exceptional(Throwable t) throws Throwable {
if (t != null) {
throw t;
}
}
@Override
public void unreliableFileOperation() throws IOException {
throw new IOException();
}
/**
* @see ITestBean#returnsThis()
*/
@Override
public Object returnsThis() {
return this;
}
@ -389,9 +406,11 @@ public class TestBean implements BeanNameAware, BeanFactoryAware, ITestBean, IOt @@ -389,9 +406,11 @@ public class TestBean implements BeanNameAware, BeanFactoryAware, ITestBean, IOt
/**
* @see IOther#absquatulate()
*/
@Override
public void absquatulate() {
}
@Override
public int haveBirthday() {
return age++;
}
@ -421,6 +440,7 @@ public class TestBean implements BeanNameAware, BeanFactoryAware, ITestBean, IOt @@ -421,6 +440,7 @@ public class TestBean implements BeanNameAware, BeanFactoryAware, ITestBean, IOt
return this.age;
}
@Override
public int compareTo(Object other) {
if (this.name != null && other instanceof TestBean) {
return this.name.compareTo(((TestBean) other).getName());

1
spring-context-support/src/test/java/org/springframework/beans/NestedTestBean.java

@ -37,6 +37,7 @@ public class NestedTestBean implements INestedTestBean { @@ -37,6 +37,7 @@ public class NestedTestBean implements INestedTestBean {
this.company = (company != null ? company : "");
}
@Override
public String getCompany() {
return company;
}

20
spring-context-support/src/test/java/org/springframework/beans/TestBean.java

@ -137,6 +137,7 @@ public class TestBean implements BeanNameAware, BeanFactoryAware, ITestBean, IOt @@ -137,6 +137,7 @@ public class TestBean implements BeanNameAware, BeanFactoryAware, ITestBean, IOt
}
@Override
public void setBeanName(String beanName) {
this.beanName = beanName;
}
@ -145,6 +146,7 @@ public class TestBean implements BeanNameAware, BeanFactoryAware, ITestBean, IOt @@ -145,6 +146,7 @@ public class TestBean implements BeanNameAware, BeanFactoryAware, ITestBean, IOt
return beanName;
}
@Override
public void setBeanFactory(BeanFactory beanFactory) {
this.beanFactory = beanFactory;
}
@ -161,10 +163,12 @@ public class TestBean implements BeanNameAware, BeanFactoryAware, ITestBean, IOt @@ -161,10 +163,12 @@ public class TestBean implements BeanNameAware, BeanFactoryAware, ITestBean, IOt
return postProcessed;
}
@Override
public String getName() {
return name;
}
@Override
public void setName(String name) {
this.name = name;
}
@ -180,10 +184,12 @@ public class TestBean implements BeanNameAware, BeanFactoryAware, ITestBean, IOt @@ -180,10 +184,12 @@ public class TestBean implements BeanNameAware, BeanFactoryAware, ITestBean, IOt
}
}
@Override
public int getAge() {
return age;
}
@Override
public void setAge(int age) {
this.age = age;
}
@ -196,14 +202,17 @@ public class TestBean implements BeanNameAware, BeanFactoryAware, ITestBean, IOt @@ -196,14 +202,17 @@ public class TestBean implements BeanNameAware, BeanFactoryAware, ITestBean, IOt
this.jedi = jedi;
}
@Override
public ITestBean getSpouse() {
return (spouses != null ? spouses[0] : null);
}
@Override
public void setSpouse(ITestBean spouse) {
this.spouses = new ITestBean[] {spouse};
}
@Override
public ITestBean[] getSpouses() {
return spouses;
}
@ -230,10 +239,12 @@ public class TestBean implements BeanNameAware, BeanFactoryAware, ITestBean, IOt @@ -230,10 +239,12 @@ public class TestBean implements BeanNameAware, BeanFactoryAware, ITestBean, IOt
this.country = country;
}
@Override
public String[] getStringArray() {
return stringArray;
}
@Override
public void setStringArray(String[] stringArray) {
this.stringArray = stringArray;
}
@ -302,6 +313,7 @@ public class TestBean implements BeanNameAware, BeanFactoryAware, ITestBean, IOt @@ -302,6 +313,7 @@ public class TestBean implements BeanNameAware, BeanFactoryAware, ITestBean, IOt
this.someProperties = someProperties;
}
@Override
public INestedTestBean getDoctor() {
return doctor;
}
@ -310,6 +322,7 @@ public class TestBean implements BeanNameAware, BeanFactoryAware, ITestBean, IOt @@ -310,6 +322,7 @@ public class TestBean implements BeanNameAware, BeanFactoryAware, ITestBean, IOt
this.doctor = doctor;
}
@Override
public INestedTestBean getLawyer() {
return lawyer;
}
@ -342,6 +355,7 @@ public class TestBean implements BeanNameAware, BeanFactoryAware, ITestBean, IOt @@ -342,6 +355,7 @@ public class TestBean implements BeanNameAware, BeanFactoryAware, ITestBean, IOt
this.someBoolean = someBoolean;
}
@Override
public IndexedTestBean getNestedIndexedBean() {
return nestedIndexedBean;
}
@ -370,18 +384,21 @@ public class TestBean implements BeanNameAware, BeanFactoryAware, ITestBean, IOt @@ -370,18 +384,21 @@ public class TestBean implements BeanNameAware, BeanFactoryAware, ITestBean, IOt
/**
* @see org.springframework.beans.ITestBean#exceptional(Throwable)
*/
@Override
public void exceptional(Throwable t) throws Throwable {
if (t != null) {
throw t;
}
}
@Override
public void unreliableFileOperation() throws IOException {
throw new IOException();
}
/**
* @see org.springframework.beans.ITestBean#returnsThis()
*/
@Override
public Object returnsThis() {
return this;
}
@ -389,9 +406,11 @@ public class TestBean implements BeanNameAware, BeanFactoryAware, ITestBean, IOt @@ -389,9 +406,11 @@ public class TestBean implements BeanNameAware, BeanFactoryAware, ITestBean, IOt
/**
* @see org.springframework.beans.IOther#absquatulate()
*/
@Override
public void absquatulate() {
}
@Override
public int haveBirthday() {
return age++;
}
@ -421,6 +440,7 @@ public class TestBean implements BeanNameAware, BeanFactoryAware, ITestBean, IOt @@ -421,6 +440,7 @@ public class TestBean implements BeanNameAware, BeanFactoryAware, ITestBean, IOt
return this.age;
}
@Override
public int compareTo(Object other) {
if (this.name != null && other instanceof TestBean) {
return this.name.compareTo(((TestBean) other).getName());

3
spring-context-support/src/test/java/org/springframework/cache/ehcache/EhCacheSupportTests.java vendored

@ -188,6 +188,7 @@ public class EhCacheSupportTests extends TestCase { @@ -188,6 +188,7 @@ public class EhCacheSupportTests extends TestCase {
cacheFb.setCacheManager(cm);
cacheFb.setCacheName("myCache1");
cacheFb.setCacheEntryFactory(new CacheEntryFactory() {
@Override
public Object createEntry(Object key) throws Exception {
return key;
}
@ -212,9 +213,11 @@ public class EhCacheSupportTests extends TestCase { @@ -212,9 +213,11 @@ public class EhCacheSupportTests extends TestCase {
cacheFb.setCacheManager(cm);
cacheFb.setCacheName("myCache1");
cacheFb.setCacheEntryFactory(new UpdatingCacheEntryFactory() {
@Override
public Object createEntry(Object key) throws Exception {
return key;
}
@Override
public void updateEntryValue(Object key, Object value) throws Exception {
}
});

1
spring-context-support/src/test/java/org/springframework/mail/javamail/InternetAddressEditorTests.java

@ -30,6 +30,7 @@ public class InternetAddressEditorTests extends TestCase { @@ -30,6 +30,7 @@ public class InternetAddressEditorTests extends TestCase {
private InternetAddressEditor editor;
@Override
protected void setUp() {
editor = new InternetAddressEditor();
}

4
spring-context-support/src/test/java/org/springframework/mail/javamail/JavaMailSenderTests.java

@ -170,6 +170,7 @@ public class JavaMailSenderTests extends TestCase { @@ -170,6 +170,7 @@ public class JavaMailSenderTests extends TestCase {
final List<Message> messages = new ArrayList<Message>();
MimeMessagePreparator preparator = new MimeMessagePreparator() {
@Override
public void prepare(MimeMessage mimeMessage) throws MessagingException {
mimeMessage.setRecipient(Message.RecipientType.TO, new InternetAddress("you@mail.org"));
messages.add(mimeMessage);
@ -194,12 +195,14 @@ public class JavaMailSenderTests extends TestCase { @@ -194,12 +195,14 @@ public class JavaMailSenderTests extends TestCase {
final List<Message> messages = new ArrayList<Message>();
MimeMessagePreparator preparator1 = new MimeMessagePreparator() {
@Override
public void prepare(MimeMessage mimeMessage) throws MessagingException {
mimeMessage.setRecipient(Message.RecipientType.TO, new InternetAddress("he@mail.org"));
messages.add(mimeMessage);
}
};
MimeMessagePreparator preparator2 = new MimeMessagePreparator() {
@Override
public void prepare(MimeMessage mimeMessage) throws MessagingException {
mimeMessage.setRecipient(Message.RecipientType.TO, new InternetAddress("she@mail.org"));
messages.add(mimeMessage);
@ -300,6 +303,7 @@ public class JavaMailSenderTests extends TestCase { @@ -300,6 +303,7 @@ public class JavaMailSenderTests extends TestCase {
public void testJavaMailSenderWithParseExceptionOnMimeMessagePreparator() {
MockJavaMailSender sender = new MockJavaMailSender();
MimeMessagePreparator preparator = new MimeMessagePreparator() {
@Override
public void prepare(MimeMessage mimeMessage) throws MessagingException {
mimeMessage.setFrom(new InternetAddress(""));
}

28
spring-context-support/src/test/java/org/springframework/scheduling/quartz/QuartzSupportTests.java

@ -154,6 +154,7 @@ public class QuartzSupportTests { @@ -154,6 +154,7 @@ public class QuartzSupportTests {
schedulerControl.replay();
SchedulerFactoryBean schedulerFactoryBean = new SchedulerFactoryBean() {
@Override
protected Scheduler createScheduler(SchedulerFactory schedulerFactory, String schedulerName) {
return scheduler;
}
@ -248,6 +249,7 @@ public class QuartzSupportTests { @@ -248,6 +249,7 @@ public class QuartzSupportTests {
schedulerControl.replay();
SchedulerFactoryBean schedulerFactoryBean = new SchedulerFactoryBean() {
@Override
protected Scheduler createScheduler(SchedulerFactory schedulerFactory, String schedulerName) {
return scheduler;
}
@ -346,6 +348,7 @@ public class QuartzSupportTests { @@ -346,6 +348,7 @@ public class QuartzSupportTests {
schedulerControl.replay();
SchedulerFactoryBean schedulerFactoryBean = new SchedulerFactoryBean() {
@Override
protected Scheduler createScheduler(SchedulerFactory schedulerFactory, String schedulerName) {
return scheduler;
}
@ -401,6 +404,7 @@ public class QuartzSupportTests { @@ -401,6 +404,7 @@ public class QuartzSupportTests {
schedulerControl.replay();
SchedulerFactoryBean schedulerFactoryBean = new SchedulerFactoryBean() {
@Override
protected Scheduler createScheduler(SchedulerFactory schedulerFactory, String schedulerName) {
return scheduler;
}
@ -570,6 +574,7 @@ public class QuartzSupportTests { @@ -570,6 +574,7 @@ public class QuartzSupportTests {
schedulerControl.replay();
SchedulerFactoryBean schedulerFactoryBean = new SchedulerFactoryBean() {
@Override
protected Scheduler createScheduler(SchedulerFactory schedulerFactory, String schedulerName) {
return scheduler;
}
@ -605,6 +610,7 @@ public class QuartzSupportTests { @@ -605,6 +610,7 @@ public class QuartzSupportTests {
schedulerControl.replay();
SchedulerFactoryBean schedulerFactoryBean = new SchedulerFactoryBean() {
@Override
protected Scheduler createScheduler(SchedulerFactory schedulerFactory, String schedulerName) {
return scheduler;
}
@ -1040,30 +1046,39 @@ public class QuartzSupportTests { @@ -1040,30 +1046,39 @@ public class QuartzSupportTests {
private static class TestSchedulerListener implements SchedulerListener {
@Override
public void jobScheduled(Trigger trigger) {
}
@Override
public void jobUnscheduled(String triggerName, String triggerGroup) {
}
@Override
public void triggerFinalized(Trigger trigger) {
}
@Override
public void triggersPaused(String triggerName, String triggerGroup) {
}
@Override
public void triggersResumed(String triggerName, String triggerGroup) {
}
@Override
public void jobsPaused(String jobName, String jobGroup) {
}
@Override
public void jobsResumed(String jobName, String jobGroup) {
}
@Override
public void schedulerError(String msg, SchedulerException cause) {
}
@Override
public void schedulerShutdown() {
}
}
@ -1071,16 +1086,20 @@ public class QuartzSupportTests { @@ -1071,16 +1086,20 @@ public class QuartzSupportTests {
private static class TestJobListener implements JobListener {
@Override
public String getName() {
return null;
}
@Override
public void jobToBeExecuted(JobExecutionContext context) {
}
@Override
public void jobExecutionVetoed(JobExecutionContext context) {
}
@Override
public void jobWasExecuted(JobExecutionContext context, JobExecutionException jobException) {
}
}
@ -1088,20 +1107,25 @@ public class QuartzSupportTests { @@ -1088,20 +1107,25 @@ public class QuartzSupportTests {
private static class TestTriggerListener implements TriggerListener {
@Override
public String getName() {
return null;
}
@Override
public void triggerFired(Trigger trigger, JobExecutionContext context) {
}
@Override
public boolean vetoJobExecution(Trigger trigger, JobExecutionContext context) {
return false;
}
@Override
public void triggerMisfired(Trigger trigger) {
}
@Override
public void triggerComplete(Trigger trigger, JobExecutionContext context, int triggerInstructionCode) {
}
}
@ -1111,6 +1135,7 @@ public class QuartzSupportTests { @@ -1111,6 +1135,7 @@ public class QuartzSupportTests {
private int count;
@Override
public void execute(Runnable task) {
this.count++;
task.run();
@ -1131,6 +1156,7 @@ public class QuartzSupportTests { @@ -1131,6 +1156,7 @@ public class QuartzSupportTests {
param = value;
}
@Override
public synchronized void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
count++;
}
@ -1150,6 +1176,7 @@ public class QuartzSupportTests { @@ -1150,6 +1176,7 @@ public class QuartzSupportTests {
param = value;
}
@Override
protected synchronized void executeInternal(JobExecutionContext jobExecutionContext) throws JobExecutionException {
count++;
}
@ -1169,6 +1196,7 @@ public class QuartzSupportTests { @@ -1169,6 +1196,7 @@ public class QuartzSupportTests {
param = value;
}
@Override
public void run() {
count++;
}

1
spring-context-support/src/test/java/org/springframework/ui/jasperreports/JasperReportsUtilsTests.java

@ -236,6 +236,7 @@ public class JasperReportsUtilsTests extends TestCase { @@ -236,6 +236,7 @@ public class JasperReportsUtilsTests extends TestCase {
private boolean invoked = false;
@Override
public void afterPageExport() {
this.invoked = true;
}

3
spring-context/src/test/java/example/scannable/AutowiredQualifierFooService.java

@ -45,14 +45,17 @@ public class AutowiredQualifierFooService implements FooService { @@ -45,14 +45,17 @@ public class AutowiredQualifierFooService implements FooService {
this.initCalled = true;
}
@Override
public String foo(int id) {
return this.fooDao.findFoo(id);
}
@Override
public Future<String> asyncFoo(int id) {
return new AsyncResult<String>(this.fooDao.findFoo(id));
}
@Override
public boolean isInitCalled() {
return this.initCalled;
}

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save