diff --git a/spring-context/src/test/java/org/springframework/aop/config/MethodLocatingFactoryBeanTests.java b/spring-context/src/test/java/org/springframework/aop/config/MethodLocatingFactoryBeanTests.java index 7f5d93833fc..e06876b4304 100644 --- a/spring-context/src/test/java/org/springframework/aop/config/MethodLocatingFactoryBeanTests.java +++ b/spring-context/src/test/java/org/springframework/aop/config/MethodLocatingFactoryBeanTests.java @@ -106,6 +106,7 @@ public final class MethodLocatingFactoryBeanTests { } @Test + @SuppressWarnings({ "unchecked", "rawtypes" }) public void testSunnyDayPath() throws Exception { expect((Class) beanFactory.getType(BEAN_NAME)).andReturn(String.class); replay(beanFactory); @@ -121,6 +122,7 @@ public final class MethodLocatingFactoryBeanTests { } @Test(expected=IllegalArgumentException.class) + @SuppressWarnings({ "unchecked", "rawtypes" }) public void testWhereMethodCannotBeResolved() { expect((Class) beanFactory.getType(BEAN_NAME)).andReturn(String.class); replay(beanFactory); diff --git a/spring-context/src/test/java/org/springframework/aop/framework/AbstractAopProxyTests.java b/spring-context/src/test/java/org/springframework/aop/framework/AbstractAopProxyTests.java index 79fcd4e225f..5af410a894b 100644 --- a/spring-context/src/test/java/org/springframework/aop/framework/AbstractAopProxyTests.java +++ b/spring-context/src/test/java/org/springframework/aop/framework/AbstractAopProxyTests.java @@ -120,7 +120,7 @@ public abstract class AbstractAopProxyTests { @Test public void testNoInterceptorsAndNoTarget() { - AdvisedSupport pc = new AdvisedSupport(new Class[] {ITestBean.class}); + AdvisedSupport pc = new AdvisedSupport(new Class[] {ITestBean.class}); // Add no interceptors try { AopProxy aop = createAopProxy(pc); @@ -418,7 +418,7 @@ public abstract class AbstractAopProxyTests { return s; } }; - AdvisedSupport pc = new AdvisedSupport(new Class[] {ITestBean.class}); + AdvisedSupport pc = new AdvisedSupport(new Class[] {ITestBean.class}); if (context) { pc.addAdvice(ExposeInvocationInterceptor.INSTANCE); } @@ -445,7 +445,7 @@ public abstract class AbstractAopProxyTests { TestBean raw = new OwnSpouse(); ProxyCreatorSupport pc = new ProxyCreatorSupport(); - pc.setInterfaces(new Class[] {ITestBean.class}); + pc.setInterfaces(new Class[] {ITestBean.class}); pc.setTarget(raw); ITestBean tb = (ITestBean) createProxy(pc); @@ -461,7 +461,7 @@ public abstract class AbstractAopProxyTests { throw expectedException; } }; - AdvisedSupport pc = new AdvisedSupport(new Class[] {ITestBean.class}); + AdvisedSupport pc = new AdvisedSupport(new Class[] {ITestBean.class}); pc.addAdvice(ExposeInvocationInterceptor.INSTANCE); pc.addAdvice(mi); @@ -495,7 +495,7 @@ public abstract class AbstractAopProxyTests { throw unexpectedException; } }; - AdvisedSupport pc = new AdvisedSupport(new Class[] {ITestBean.class}); + AdvisedSupport pc = new AdvisedSupport(new Class[] {ITestBean.class}); pc.addAdvice(ExposeInvocationInterceptor.INSTANCE); pc.addAdvice(mi); @@ -527,7 +527,7 @@ public abstract class AbstractAopProxyTests { throw unexpectedException; } }; - AdvisedSupport pc = new AdvisedSupport(new Class[] {ITestBean.class}); + AdvisedSupport pc = new AdvisedSupport(new Class[] {ITestBean.class}); pc.addAdvice(ExposeInvocationInterceptor.INSTANCE); pc.addAdvice(mi); @@ -555,7 +555,7 @@ public abstract class AbstractAopProxyTests { @Test public void testTargetCanGetInvocationEvenIfNoAdviceChain() throws Throwable { NeedsToSeeProxy target = new NeedsToSeeProxy(); - AdvisedSupport pc = new AdvisedSupport(new Class[] {INeedsToSeeProxy.class}); + AdvisedSupport pc = new AdvisedSupport(new Class[] {INeedsToSeeProxy.class}); pc.setTarget(target); pc.setExposeProxy(true); @@ -570,7 +570,7 @@ public abstract class AbstractAopProxyTests { public void testTargetCanGetInvocation() throws Throwable { final InvocationCheckExposedInvocationTestBean expectedTarget = new InvocationCheckExposedInvocationTestBean(); - AdvisedSupport pc = new AdvisedSupport(new Class[] {ITestBean.class, IOther.class}); + AdvisedSupport pc = new AdvisedSupport(new Class[] {ITestBean.class, IOther.class}); pc.addAdvice(ExposeInvocationInterceptor.INSTANCE); TrapTargetInterceptor tii = new TrapTargetInterceptor() { public Object invoke(MethodInvocation invocation) throws Throwable { @@ -615,7 +615,7 @@ public abstract class AbstractAopProxyTests { @Test public void testMixinWithIntroductionAdvisor() throws Throwable { TestBean tb = new TestBean(); - ProxyFactory pc = new ProxyFactory(new Class[] {ITestBean.class}); + ProxyFactory pc = new ProxyFactory(new Class[] {ITestBean.class}); pc.addAdvisor(new LockMixinAdvisor()); pc.setTarget(tb); @@ -625,7 +625,7 @@ public abstract class AbstractAopProxyTests { @Test public void testMixinWithIntroductionInfo() throws Throwable { TestBean tb = new TestBean(); - ProxyFactory pc = new ProxyFactory(new Class[] {ITestBean.class}); + ProxyFactory pc = new ProxyFactory(new Class[] {ITestBean.class}); // We don't use an IntroductionAdvisor, we can just add an advice that implements IntroductionInfo pc.addAdvice(new LockMixin()); pc.setTarget(tb); @@ -664,7 +664,7 @@ public abstract class AbstractAopProxyTests { @Test public void testReplaceArgument() throws Throwable { TestBean tb = new TestBean(); - ProxyFactory pc = new ProxyFactory(new Class[] {ITestBean.class}); + ProxyFactory pc = new ProxyFactory(new Class[] {ITestBean.class}); pc.setTarget(tb); pc.addAdvisor(new StringSetterNullReplacementAdvice()); @@ -952,7 +952,7 @@ public abstract class AbstractAopProxyTests { public void testProxyConfigString() { TestBean target = new TestBean(); ProxyFactory pc = new ProxyFactory(target); - pc.setInterfaces(new Class[] {ITestBean.class}); + pc.setInterfaces(new Class[] {ITestBean.class}); pc.addAdvice(new NopInterceptor()); MethodBeforeAdvice mba = new CountingBeforeAdvice(); Advisor advisor = new DefaultPointcutAdvisor(new NameMatchMethodPointcut(), mba); @@ -968,7 +968,7 @@ public abstract class AbstractAopProxyTests { public void testCanPreventCastToAdvisedUsingOpaque() { TestBean target = new TestBean(); ProxyFactory pc = new ProxyFactory(target); - pc.setInterfaces(new Class[] {ITestBean.class}); + pc.setInterfaces(new Class[] {ITestBean.class}); pc.addAdvice(new NopInterceptor()); CountingBeforeAdvice mba = new CountingBeforeAdvice(); Advisor advisor = new DefaultPointcutAdvisor(new NameMatchMethodPointcut().addMethodName("setAge"), mba); @@ -1069,7 +1069,7 @@ public abstract class AbstractAopProxyTests { @Test public void testDynamicMethodPointcutThatAlwaysAppliesStatically() throws Throwable { TestBean tb = new TestBean(); - ProxyFactory pc = new ProxyFactory(new Class[] {ITestBean.class}); + ProxyFactory pc = new ProxyFactory(new Class[] {ITestBean.class}); TestDynamicPointcutAdvice dp = new TestDynamicPointcutAdvice(new NopInterceptor(), "getAge"); pc.addAdvisor(dp); pc.setTarget(tb); @@ -1085,7 +1085,7 @@ public abstract class AbstractAopProxyTests { @Test public void testDynamicMethodPointcutThatAppliesStaticallyOnlyToSetters() throws Throwable { TestBean tb = new TestBean(); - ProxyFactory pc = new ProxyFactory(new Class[] {ITestBean.class}); + ProxyFactory pc = new ProxyFactory(new Class[] {ITestBean.class}); // Could apply dynamically to getAge/setAge but not to getName TestDynamicPointcutForSettersOnly dp = new TestDynamicPointcutForSettersOnly(new NopInterceptor(), "Age"); pc.addAdvisor(dp); @@ -1107,7 +1107,7 @@ public abstract class AbstractAopProxyTests { @Test public void testStaticMethodPointcut() throws Throwable { TestBean tb = new TestBean(); - ProxyFactory pc = new ProxyFactory(new Class[] {ITestBean.class}); + ProxyFactory pc = new ProxyFactory(new Class[] {ITestBean.class}); NopInterceptor di = new NopInterceptor(); TestStaticPointcutAdvice sp = new TestStaticPointcutAdvice(di, "getAge"); pc.addAdvisor(sp); @@ -1353,7 +1353,7 @@ public abstract class AbstractAopProxyTests { return invocation.proceed(); } }; - AdvisedSupport pc = new AdvisedSupport(new Class[] {ITestBean.class}); + AdvisedSupport pc = new AdvisedSupport(new Class[] {ITestBean.class}); MapAwareMethodInterceptor mami1 = new MapAwareMethodInterceptor(new HashMap(), new HashMap()); Map firstValuesToAdd = new HashMap(); firstValuesToAdd.put("test", ""); diff --git a/spring-context/src/test/java/org/springframework/aop/framework/CglibProxyTests.java b/spring-context/src/test/java/org/springframework/aop/framework/CglibProxyTests.java index a1abd8e2fe8..a52cbe3cc07 100644 --- a/spring-context/src/test/java/org/springframework/aop/framework/CglibProxyTests.java +++ b/spring-context/src/test/java/org/springframework/aop/framework/CglibProxyTests.java @@ -87,7 +87,7 @@ public final class CglibProxyTests extends AbstractAopProxyTests implements Seri @Test public void testNoTarget() { - AdvisedSupport pc = new AdvisedSupport(new Class[]{ITestBean.class}); + AdvisedSupport pc = new AdvisedSupport(new Class[]{ITestBean.class}); pc.addAdvice(new NopInterceptor()); try { AopProxy aop = createAopProxy(pc); @@ -104,7 +104,7 @@ public final class CglibProxyTests extends AbstractAopProxyTests implements Seri ProtectedMethodTestBean bean = new ProtectedMethodTestBean(); mockTargetSource.setTarget(bean); - AdvisedSupport as = new AdvisedSupport(new Class[]{}); + AdvisedSupport as = new AdvisedSupport(new Class[]{}); as.setTargetSource(mockTargetSource); as.addAdvice(new NopInterceptor()); AopProxy aop = new CglibAopProxy(as); @@ -158,7 +158,7 @@ public final class CglibProxyTests extends AbstractAopProxyTests implements Seri CglibTestBean bean = new CglibTestBean(); bean.setName("Rob Harrop"); - AdvisedSupport as = new AdvisedSupport(new Class[]{}); + AdvisedSupport as = new AdvisedSupport(new Class[]{}); as.setTarget(bean); as.addAdvice(new NopInterceptor()); AopProxy aop = new CglibAopProxy(as); @@ -174,7 +174,7 @@ public final class CglibProxyTests extends AbstractAopProxyTests implements Seri CglibTestBean target = new CglibTestBean(); target.setName("Rob Harrop"); - AdvisedSupport pc = new AdvisedSupport(new Class[]{}); + AdvisedSupport pc = new AdvisedSupport(new Class[]{}); pc.setFrozen(true); pc.setTarget(target); @@ -202,7 +202,7 @@ public final class CglibProxyTests extends AbstractAopProxyTests implements Seri } private ITestBean getAdvisedProxy(TestBean target) { - ProxyFactory pf = new ProxyFactory(new Class[]{ITestBean.class}); + ProxyFactory pf = new ProxyFactory(new Class[]{ITestBean.class}); pf.setProxyTargetClass(true); MethodInterceptor advice = new NopInterceptor(); @@ -241,7 +241,7 @@ public final class CglibProxyTests extends AbstractAopProxyTests implements Seri } private ITestBean getIntroductionAdvisorProxy(TestBean target) { - ProxyFactory pf = new ProxyFactory(new Class[]{ITestBean.class}); + ProxyFactory pf = new ProxyFactory(new Class[]{ITestBean.class}); pf.setProxyTargetClass(true); pf.addAdvisor(new LockMixinAdvisor()); @@ -258,11 +258,11 @@ public final class CglibProxyTests extends AbstractAopProxyTests implements Seri target.reset(); mockTargetSource.setTarget(target); - AdvisedSupport pc = new AdvisedSupport(new Class[]{}); + AdvisedSupport pc = new AdvisedSupport(new Class[]{}); pc.setTargetSource(mockTargetSource); CglibAopProxy aop = new CglibAopProxy(pc); aop.setConstructorArguments(new Object[] {"Rob Harrop", new Integer(22)}, - new Class[] {String.class, int.class}); + new Class[] {String.class, int.class}); NoArgCtorTestBean proxy = (NoArgCtorTestBean) aop.getProxy(); proxy = (NoArgCtorTestBean) aop.getProxy(); @@ -275,7 +275,7 @@ public final class CglibProxyTests extends AbstractAopProxyTests implements Seri ITestBean target = new TestBean(); mockTargetSource.setTarget(target); - AdvisedSupport as = new AdvisedSupport(new Class[]{}); + AdvisedSupport as = new AdvisedSupport(new Class[]{}); as.setTargetSource(mockTargetSource); as.addAdvice(new NopInterceptor()); CglibAopProxy cglib = new CglibAopProxy(as); @@ -283,7 +283,7 @@ public final class CglibProxyTests extends AbstractAopProxyTests implements Seri ITestBean proxy1 = (ITestBean) cglib.getProxy(); mockTargetSource.setTarget(proxy1); - as = new AdvisedSupport(new Class[]{}); + as = new AdvisedSupport(new Class[]{}); as.setTargetSource(mockTargetSource); as.addAdvice(new NopInterceptor()); cglib = new CglibAopProxy(as); @@ -296,7 +296,7 @@ public final class CglibProxyTests extends AbstractAopProxyTests implements Seri ITestBean target = new TestBean(); mockTargetSource.setTarget(target); - AdvisedSupport as = new AdvisedSupport(new Class[]{}); + AdvisedSupport as = new AdvisedSupport(new Class[]{}); as.setTargetSource(mockTargetSource); as.addAdvice(new NopInterceptor()); as.addInterface(Serializable.class); @@ -305,7 +305,7 @@ public final class CglibProxyTests extends AbstractAopProxyTests implements Seri ITestBean proxy1 = (ITestBean) cglib.getProxy(); mockTargetSource.setTarget(proxy1); - as = new AdvisedSupport(new Class[]{}); + as = new AdvisedSupport(new Class[]{}); as.setTargetSource(mockTargetSource); as.addAdvice(new NopInterceptor()); cglib = new CglibAopProxy(as); @@ -319,7 +319,7 @@ public final class CglibProxyTests extends AbstractAopProxyTests implements Seri ExceptionThrower bean = new ExceptionThrower(); mockTargetSource.setTarget(bean); - AdvisedSupport as = new AdvisedSupport(new Class[]{}); + AdvisedSupport as = new AdvisedSupport(new Class[]{}); as.setTargetSource(mockTargetSource); as.addAdvice(new NopInterceptor()); AopProxy aop = new CglibAopProxy(as); diff --git a/spring-context/src/test/java/org/springframework/aop/framework/JdkDynamicProxyTests.java b/spring-context/src/test/java/org/springframework/aop/framework/JdkDynamicProxyTests.java index 422517273f6..b845070078f 100644 --- a/spring-context/src/test/java/org/springframework/aop/framework/JdkDynamicProxyTests.java +++ b/spring-context/src/test/java/org/springframework/aop/framework/JdkDynamicProxyTests.java @@ -66,7 +66,7 @@ public final class JdkDynamicProxyTests extends AbstractAopProxyTests implements public void testProxyIsJustInterface() throws Throwable { TestBean raw = new TestBean(); raw.setAge(32); - AdvisedSupport pc = new AdvisedSupport(new Class[] {ITestBean.class}); + AdvisedSupport pc = new AdvisedSupport(new Class[] {ITestBean.class}); pc.setTarget(raw); JdkDynamicAopProxy aop = new JdkDynamicAopProxy(pc); @@ -80,7 +80,7 @@ public final class JdkDynamicProxyTests extends AbstractAopProxyTests implements int age = 25; MethodInterceptor mi = createMock(MethodInterceptor.class); - AdvisedSupport pc = new AdvisedSupport(new Class[] { ITestBean.class }); + AdvisedSupport pc = new AdvisedSupport(new Class[] { ITestBean.class }); pc.addAdvice(mi); AopProxy aop = createAopProxy(pc); @@ -101,7 +101,7 @@ public final class JdkDynamicProxyTests extends AbstractAopProxyTests implements } }; - AdvisedSupport pc = new AdvisedSupport(new Class[] { ITestBean.class, IOther.class }); + AdvisedSupport pc = new AdvisedSupport(new Class[] { ITestBean.class, IOther.class }); pc.addAdvice(ExposeInvocationInterceptor.INSTANCE); TrapTargetInterceptor tii = new TrapTargetInterceptor() { public Object invoke(MethodInvocation invocation) throws Throwable { @@ -130,7 +130,7 @@ public final class JdkDynamicProxyTests extends AbstractAopProxyTests implements public void testProxyNotWrappedIfIncompatible() { FooBar bean = new FooBar(); ProxyCreatorSupport as = new ProxyCreatorSupport(); - as.setInterfaces(new Class[] {Foo.class}); + as.setInterfaces(new Class[] {Foo.class}); as.setTarget(bean); Foo proxy = (Foo) createProxy(as); @@ -140,7 +140,7 @@ public final class JdkDynamicProxyTests extends AbstractAopProxyTests implements } public void testEqualsAndHashCodeDefined() throws Exception { - AdvisedSupport as = new AdvisedSupport(new Class[]{Named.class}); + AdvisedSupport as = new AdvisedSupport(new Class[]{Named.class}); as.setTarget(new Person()); JdkDynamicAopProxy aopProxy = new JdkDynamicAopProxy(as); Named proxy = (Named) aopProxy.getProxy(); diff --git a/spring-context/src/test/java/org/springframework/aop/framework/ProxyFactoryBeanTests.java b/spring-context/src/test/java/org/springframework/aop/framework/ProxyFactoryBeanTests.java index eb5f420b034..6c255751b4d 100644 --- a/spring-context/src/test/java/org/springframework/aop/framework/ProxyFactoryBeanTests.java +++ b/spring-context/src/test/java/org/springframework/aop/framework/ProxyFactoryBeanTests.java @@ -539,7 +539,7 @@ public final class ProxyFactoryBeanTests { // 2 globals + 2 explicit assertEquals("Have 2 globals and 2 explicit advisors", 3, pfb.getAdvisors().length); - ApplicationListener l = (ApplicationListener) factory.getBean("validGlobals"); + ApplicationListener l = (ApplicationListener) factory.getBean("validGlobals"); agi = (AddedGlobalInterface) l; assertTrue(agi.globalsAdded() == -1); @@ -760,7 +760,7 @@ public final class ProxyFactoryBeanTests { } public Class[] getInterfaces() { - return new Class[] { AddedGlobalInterface.class }; + return new Class[] { AddedGlobalInterface.class }; } public boolean isPerInstance() { diff --git a/spring-context/src/test/java/org/springframework/aop/scope/ScopedProxyTests.java b/spring-context/src/test/java/org/springframework/aop/scope/ScopedProxyTests.java index 6448a2d82bc..56b60673948 100644 --- a/spring-context/src/test/java/org/springframework/aop/scope/ScopedProxyTests.java +++ b/spring-context/src/test/java/org/springframework/aop/scope/ScopedProxyTests.java @@ -126,7 +126,7 @@ public class ScopedProxyTests { assertTrue(scope.getMap().containsKey("scopedTarget.scopedList")); assertEquals(ArrayList.class, scope.getMap().get("scopedTarget.scopedList").getClass()); - ArrayList deserialized = (ArrayList) SerializationTestUtils.serializeAndDeserialize(tb.getFriends()); + ArrayList deserialized = (ArrayList) SerializationTestUtils.serializeAndDeserialize(tb.getFriends()); assertNotNull(deserialized); assertTrue(AopUtils.isCglibProxy(deserialized)); assertTrue(deserialized.contains("myFriend")); diff --git a/spring-context/src/test/java/org/springframework/beans/IndexedTestBean.java b/spring-context/src/test/java/org/springframework/beans/IndexedTestBean.java index ddb091770ee..e44bac1740b 100644 --- a/spring-context/src/test/java/org/springframework/beans/IndexedTestBean.java +++ b/spring-context/src/test/java/org/springframework/beans/IndexedTestBean.java @@ -34,17 +34,17 @@ public class IndexedTestBean { private TestBean[] array; - private Collection collection; + private Collection collection; - private List list; + private List list; - private Set set; + private Set set; - private SortedSet sortedSet; + private SortedSet sortedSet; - private Map map; + private Map map; - private SortedMap sortedMap; + private SortedMap sortedMap; public IndexedTestBean() { @@ -69,17 +69,17 @@ public class IndexedTestBean { TestBean tbX = new TestBean("nameX", 0); TestBean tbY = new TestBean("nameY", 0); this.array = new TestBean[] {tb0, tb1}; - this.list = new ArrayList(); + this.list = new ArrayList<>(); this.list.add(tb2); this.list.add(tb3); - this.set = new TreeSet(); + this.set = new TreeSet<>(); this.set.add(tb6); this.set.add(tb7); - this.map = new HashMap(); + this.map = new HashMap<>(); this.map.put("key1", tb4); this.map.put("key2", tb5); this.map.put("key.3", tb5); - List list = new ArrayList(); + List list = new ArrayList<>(); list.add(tbX); list.add(tbY); this.map.put("key4", list); @@ -94,51 +94,52 @@ public class IndexedTestBean { this.array = array; } - public Collection getCollection() { + public Collection getCollection() { return collection; } - public void setCollection(Collection collection) { + public void setCollection(Collection collection) { this.collection = collection; } - public List getList() { + public List getList() { return list; } - public void setList(List list) { + public void setList(List list) { this.list = list; } - public Set getSet() { + public Set getSet() { return set; } + @SuppressWarnings({ "rawtypes", "unchecked" }) public void setSet(Set set) { this.set = set; } - public SortedSet getSortedSet() { + public SortedSet getSortedSet() { return sortedSet; } - public void setSortedSet(SortedSet sortedSet) { + public void setSortedSet(SortedSet sortedSet) { this.sortedSet = sortedSet; } - public Map getMap() { + public Map getMap() { return map; } - public void setMap(Map map) { + public void setMap(Map map) { this.map = map; } - public SortedMap getSortedMap() { + public SortedMap getSortedMap() { return sortedMap; } - public void setSortedMap(SortedMap sortedMap) { + public void setSortedMap(SortedMap sortedMap) { this.sortedMap = sortedMap; } diff --git a/spring-context/src/test/java/org/springframework/beans/TestBean.java b/spring-context/src/test/java/org/springframework/beans/TestBean.java index 7842bbfeacf..b93bf96be31 100644 --- a/spring-context/src/test/java/org/springframework/beans/TestBean.java +++ b/spring-context/src/test/java/org/springframework/beans/TestBean.java @@ -40,7 +40,7 @@ import org.springframework.util.ObjectUtils; * @author Juergen Hoeller * @since 15 April 2001 */ -public class TestBean implements BeanNameAware, BeanFactoryAware, ITestBean, IOther, Comparable { +public class TestBean implements BeanNameAware, BeanFactoryAware, ITestBean, IOther, Comparable { private String beanName; @@ -70,13 +70,13 @@ public class TestBean implements BeanNameAware, BeanFactoryAware, ITestBean, IOt private Float myFloat = new Float(0.0); - private Collection friends = new LinkedList(); + private Collection friends = new LinkedList<>(); - private Set someSet = new HashSet(); + private Set someSet = new HashSet<>(); - private Map someMap = new HashMap(); + private Map someMap = new HashMap<>(); - private List someList = new ArrayList(); + private List someList = new ArrayList<>(); private Properties someProperties = new Properties(); @@ -94,9 +94,9 @@ public class TestBean implements BeanNameAware, BeanFactoryAware, ITestBean, IOt private Boolean someBoolean; - private List otherColours; + private List otherColours; - private List pets; + private List pets; public TestBean() { @@ -120,15 +120,15 @@ public class TestBean implements BeanNameAware, BeanFactoryAware, ITestBean, IOt this.someProperties = someProperties; } - public TestBean(List someList) { + public TestBean(List someList) { this.someList = someList; } - public TestBean(Set someSet) { + public TestBean(Set someSet) { this.someSet = someSet; } - public TestBean(Map someMap) { + public TestBean(Map someMap) { this.someMap = someMap; } @@ -262,35 +262,35 @@ public class TestBean implements BeanNameAware, BeanFactoryAware, ITestBean, IOt this.myFloat = myFloat; } - public Collection getFriends() { + public Collection getFriends() { return friends; } - public void setFriends(Collection friends) { + public void setFriends(Collection friends) { this.friends = friends; } - public Set getSomeSet() { + public Set getSomeSet() { return someSet; } - public void setSomeSet(Set someSet) { + public void setSomeSet(Set someSet) { this.someSet = someSet; } - public Map getSomeMap() { + public Map getSomeMap() { return someMap; } - public void setSomeMap(Map someMap) { + public void setSomeMap(Map someMap) { this.someMap = someMap; } - public List getSomeList() { + public List getSomeList() { return someList; } - public void setSomeList(List someList) { + public void setSomeList(List someList) { this.someList = someList; } @@ -350,19 +350,19 @@ public class TestBean implements BeanNameAware, BeanFactoryAware, ITestBean, IOt this.nestedIndexedBean = nestedIndexedBean; } - public List getOtherColours() { + public List getOtherColours() { return otherColours; } - public void setOtherColours(List otherColours) { + public void setOtherColours(List otherColours) { this.otherColours = otherColours; } - public List getPets() { + public List getPets() { return pets; } - public void setPets(List pets) { + public void setPets(List pets) { this.pets = pets; } diff --git a/spring-context/src/test/java/org/springframework/beans/factory/DummyFactory.java b/spring-context/src/test/java/org/springframework/beans/factory/DummyFactory.java index c5ee4d060b7..b9999baa5e6 100644 --- a/spring-context/src/test/java/org/springframework/beans/factory/DummyFactory.java +++ b/spring-context/src/test/java/org/springframework/beans/factory/DummyFactory.java @@ -32,7 +32,7 @@ import org.springframework.beans.factory.config.AutowireCapableBeanFactory; * @since 10.03.2003 */ public class DummyFactory - implements FactoryBean, BeanNameAware, BeanFactoryAware, InitializingBean, DisposableBean { + implements FactoryBean, BeanNameAware, BeanFactoryAware, InitializingBean, DisposableBean { public static final String SINGLETON_NAME = "Factory singleton"; @@ -158,7 +158,7 @@ public class DummyFactory } } - public Class getObjectType() { + public Class getObjectType() { return TestBean.class; } diff --git a/spring-context/src/test/java/org/springframework/beans/factory/HasMap.java b/spring-context/src/test/java/org/springframework/beans/factory/HasMap.java index 361746b32a2..1c1708eca5c 100644 --- a/spring-context/src/test/java/org/springframework/beans/factory/HasMap.java +++ b/spring-context/src/test/java/org/springframework/beans/factory/HasMap.java @@ -28,34 +28,34 @@ import java.util.Set; */ public class HasMap { - private Map map; + private Map map; - private Set set; + private Set set; private Properties props; private Object[] objectArray; - private Class[] classArray; + private Class[] classArray; private Integer[] intArray; private HasMap() { } - public Map getMap() { + public Map getMap() { return map; } - public void setMap(Map map) { + public void setMap(Map map) { this.map = map; } - public Set getSet() { + public Set getSet() { return set; } - public void setSet(Set set) { + public void setSet(Set set) { this.set = set; } @@ -75,11 +75,11 @@ public class HasMap { this.objectArray = objectArray; } - public Class[] getClassArray() { + public Class[] getClassArray() { return classArray; } - public void setClassArray(Class[] classArray) { + public void setClassArray(Class[] classArray) { this.classArray = classArray; } diff --git a/spring-context/src/test/java/org/springframework/beans/factory/access/TestBean.java b/spring-context/src/test/java/org/springframework/beans/factory/access/TestBean.java index 3a77af2f711..39fdf5be5b8 100644 --- a/spring-context/src/test/java/org/springframework/beans/factory/access/TestBean.java +++ b/spring-context/src/test/java/org/springframework/beans/factory/access/TestBean.java @@ -27,7 +27,7 @@ public class TestBean { private String name; - private List list; + private List list; private Object objRef; @@ -48,14 +48,14 @@ public class TestBean { /** * @return Returns the list. */ - public List getList() { + public List getList() { return list; } /** * @param list The list to set. */ - public void setList(List list) { + public void setList(List list) { this.list = list; } diff --git a/spring-context/src/test/java/org/springframework/beans/factory/config/SimpleMapScope.java b/spring-context/src/test/java/org/springframework/beans/factory/config/SimpleMapScope.java index b149254bfd7..9ae909d7b71 100644 --- a/spring-context/src/test/java/org/springframework/beans/factory/config/SimpleMapScope.java +++ b/spring-context/src/test/java/org/springframework/beans/factory/config/SimpleMapScope.java @@ -31,20 +31,20 @@ import org.springframework.beans.factory.ObjectFactory; @SuppressWarnings("serial") public class SimpleMapScope implements Scope, Serializable { - private final Map map = new HashMap(); + private final Map map = new HashMap(); - private final List callbacks = new LinkedList(); + private final List callbacks = new LinkedList(); public SimpleMapScope() { } - public final Map getMap() { + public final Map getMap() { return this.map; } - public Object get(String name, ObjectFactory objectFactory) { + public Object get(String name, ObjectFactory objectFactory) { synchronized (this.map) { Object scopedObject = this.map.get(name); if (scopedObject == null) { diff --git a/spring-context/src/test/java/org/springframework/beans/factory/parsing/CollectingReaderEventListener.java b/spring-context/src/test/java/org/springframework/beans/factory/parsing/CollectingReaderEventListener.java index 74d6b48540e..8da9a81a6f8 100644 --- a/spring-context/src/test/java/org/springframework/beans/factory/parsing/CollectingReaderEventListener.java +++ b/spring-context/src/test/java/org/springframework/beans/factory/parsing/CollectingReaderEventListener.java @@ -31,20 +31,20 @@ import org.springframework.core.CollectionFactory; */ public class CollectingReaderEventListener implements ReaderEventListener { - private final List defaults = new LinkedList(); + private final List defaults = new LinkedList(); - private final Map componentDefinitions = CollectionFactory.createLinkedMapIfPossible(8); + private final Map componentDefinitions = CollectionFactory.createLinkedMapIfPossible(8); - private final Map aliasMap = CollectionFactory.createLinkedMapIfPossible(8); + private final Map> aliasMap = CollectionFactory.createLinkedMapIfPossible(8); - private final List imports = new LinkedList(); + private final List imports = new LinkedList(); public void defaultsRegistered(DefaultsDefinition defaultsDefinition) { this.defaults.add(defaultsDefinition); } - public List getDefaults() { + public List getDefaults() { return Collections.unmodifiableList(this.defaults); } @@ -53,25 +53,25 @@ public class CollectingReaderEventListener implements ReaderEventListener { } public ComponentDefinition getComponentDefinition(String name) { - return (ComponentDefinition) this.componentDefinitions.get(name); + return this.componentDefinitions.get(name); } public ComponentDefinition[] getComponentDefinitions() { - Collection collection = this.componentDefinitions.values(); - return (ComponentDefinition[]) collection.toArray(new ComponentDefinition[collection.size()]); + Collection collection = this.componentDefinitions.values(); + return collection.toArray(new ComponentDefinition[collection.size()]); } public void aliasRegistered(AliasDefinition aliasDefinition) { - List aliases = (List) this.aliasMap.get(aliasDefinition.getBeanName()); + List aliases = this.aliasMap.get(aliasDefinition.getBeanName()); if(aliases == null) { - aliases = new ArrayList(); + aliases = new ArrayList(); this.aliasMap.put(aliasDefinition.getBeanName(), aliases); } aliases.add(aliasDefinition); } - public List getAliases(String beanName) { - List aliases = (List) this.aliasMap.get(beanName); + public List getAliases(String beanName) { + List aliases = this.aliasMap.get(beanName); return aliases == null ? null : Collections.unmodifiableList(aliases); } @@ -79,7 +79,7 @@ public class CollectingReaderEventListener implements ReaderEventListener { this.imports.add(importDefinition); } - public List getImports() { + public List getImports() { return Collections.unmodifiableList(this.imports); } diff --git a/spring-context/src/test/java/org/springframework/context/BeanThatListens.java b/spring-context/src/test/java/org/springframework/context/BeanThatListens.java index 9ab3f8ea40d..3bda3d37230 100644 --- a/spring-context/src/test/java/org/springframework/context/BeanThatListens.java +++ b/spring-context/src/test/java/org/springframework/context/BeanThatListens.java @@ -24,7 +24,7 @@ import java.util.Map; * @author Thomas Risberg * @author Juergen Hoeller */ -public class BeanThatListens implements ApplicationListener { +public class BeanThatListens implements ApplicationListener { private BeanThatBroadcasts beanThatBroadcasts; @@ -36,7 +36,7 @@ public class BeanThatListens implements ApplicationListener { public BeanThatListens(BeanThatBroadcasts beanThatBroadcasts) { this.beanThatBroadcasts = beanThatBroadcasts; - Map beans = beanThatBroadcasts.applicationContext.getBeansOfType(BeanThatListens.class); + Map beans = beanThatBroadcasts.applicationContext.getBeansOfType(BeanThatListens.class); if (!beans.isEmpty()) { throw new IllegalStateException("Shouldn't have found any BeanThatListens instances"); } diff --git a/spring-context/src/test/java/org/springframework/context/TestListener.java b/spring-context/src/test/java/org/springframework/context/TestListener.java index b9f57f73087..834439484c9 100644 --- a/spring-context/src/test/java/org/springframework/context/TestListener.java +++ b/spring-context/src/test/java/org/springframework/context/TestListener.java @@ -22,7 +22,7 @@ package org.springframework.context; * @author Rod Johnson * @since January 21, 2001 */ -public class TestListener implements ApplicationListener { +public class TestListener implements ApplicationListener { private int eventCount; diff --git a/spring-context/src/test/java/org/springframework/context/annotation/CommonAnnotationBeanPostProcessorTests.java b/spring-context/src/test/java/org/springframework/context/annotation/CommonAnnotationBeanPostProcessorTests.java index daacc42cd57..b4135bf6468 100644 --- a/spring-context/src/test/java/org/springframework/context/annotation/CommonAnnotationBeanPostProcessorTests.java +++ b/spring-context/src/test/java/org/springframework/context/annotation/CommonAnnotationBeanPostProcessorTests.java @@ -206,7 +206,7 @@ public class CommonAnnotationBeanPostProcessorTests { bf.registerBeanDefinition("testBean4", new RootBeanDefinition(TestBean.class, false)); bf.registerResolvableDependency(BeanFactory.class, bf); - bf.registerResolvableDependency(INestedTestBean.class, new ObjectFactory() { + bf.registerResolvableDependency(INestedTestBean.class, new ObjectFactory() { public Object getObject() throws BeansException { return new NestedTestBean(); } diff --git a/spring-context/src/test/java/org/springframework/context/annotation/SimpleConfigTests.java b/spring-context/src/test/java/org/springframework/context/annotation/SimpleConfigTests.java index c07ded41548..176aee5c32d 100644 --- a/spring-context/src/test/java/org/springframework/context/annotation/SimpleConfigTests.java +++ b/spring-context/src/test/java/org/springframework/context/annotation/SimpleConfigTests.java @@ -42,7 +42,7 @@ public class SimpleConfigTests { String value = fooService.foo(1); assertEquals("bar", value); - Future future = fooService.asyncFoo(1); + Future future = fooService.asyncFoo(1); assertTrue(future instanceof FutureTask); assertEquals("bar", future.get()); diff --git a/spring-context/src/test/java/org/springframework/context/annotation/configuration/ConfigurationClassProcessingTests.java b/spring-context/src/test/java/org/springframework/context/annotation/configuration/ConfigurationClassProcessingTests.java index 11004182c8b..8073f92b831 100644 --- a/spring-context/src/test/java/org/springframework/context/annotation/configuration/ConfigurationClassProcessingTests.java +++ b/spring-context/src/test/java/org/springframework/context/annotation/configuration/ConfigurationClassProcessingTests.java @@ -230,7 +230,7 @@ public class ConfigurationClassProcessingTests { public @Bean Object stringBean() { return "foo"; } - public @Bean FactoryBean factoryBean() { + public @Bean FactoryBean factoryBean() { ListFactoryBean fb = new ListFactoryBean(); fb.setSourceList(Arrays.asList("element1", "element2")); return fb; diff --git a/spring-context/src/test/java/org/springframework/context/event/ApplicationContextEventTests.java b/spring-context/src/test/java/org/springframework/context/event/ApplicationContextEventTests.java index 789fb09defc..24dec9ad54d 100644 --- a/spring-context/src/test/java/org/springframework/context/event/ApplicationContextEventTests.java +++ b/spring-context/src/test/java/org/springframework/context/event/ApplicationContextEventTests.java @@ -47,7 +47,8 @@ public class ApplicationContextEventTests { @Test public void simpleApplicationEventMulticaster() { - ApplicationListener listener = EasyMock.createMock(ApplicationListener.class); + @SuppressWarnings("unchecked") + ApplicationListener listener = mock(ApplicationListener.class); ApplicationEvent evt = new ContextClosedEvent(new StaticApplicationContext()); listener.onApplicationEvent(evt); @@ -73,11 +74,12 @@ public class ApplicationContextEventTests { } @Test + @SuppressWarnings("unchecked") public void proxiedListeners() { MyOrderedListener1 listener1 = new MyOrderedListener1(); MyOrderedListener2 listener2 = new MyOrderedListener2(listener1); - ApplicationListener proxy1 = (ApplicationListener) new ProxyFactory(listener1).getProxy(); - ApplicationListener proxy2 = (ApplicationListener) new ProxyFactory(listener2).getProxy(); + ApplicationListener proxy1 = (ApplicationListener) new ProxyFactory(listener1).getProxy(); + ApplicationListener proxy2 = (ApplicationListener) new ProxyFactory(listener2).getProxy(); SimpleApplicationEventMulticaster smc = new SimpleApplicationEventMulticaster(); smc.addApplicationListener(proxy1); @@ -208,7 +210,7 @@ public class ApplicationContextEventTests { } - public static class MyOrderedListener1 implements ApplicationListener, Ordered { + public static class MyOrderedListener1 implements ApplicationListener, Ordered { public final Set seenEvents = new HashSet(); @@ -248,7 +250,7 @@ public class ApplicationContextEventTests { } - public static class MyNonSingletonListener implements ApplicationListener { + public static class MyNonSingletonListener implements ApplicationListener { public static final Set seenEvents = new HashSet(); diff --git a/spring-context/src/test/java/org/springframework/context/event/EventPublicationInterceptorTests.java b/spring-context/src/test/java/org/springframework/context/event/EventPublicationInterceptorTests.java index d8bc82ee111..4e1f90468cf 100644 --- a/spring-context/src/test/java/org/springframework/context/event/EventPublicationInterceptorTests.java +++ b/spring-context/src/test/java/org/springframework/context/event/EventPublicationInterceptorTests.java @@ -138,13 +138,13 @@ public class EventPublicationInterceptorTests { } - public static class FactoryBeanTestListener extends TestListener implements FactoryBean { + public static class FactoryBeanTestListener extends TestListener implements FactoryBean { public Object getObject() throws Exception { return "test"; } - public Class getObjectType() { + public Class getObjectType() { return String.class; } diff --git a/spring-context/src/test/java/org/springframework/context/event/LifecycleEventTests.java b/spring-context/src/test/java/org/springframework/context/event/LifecycleEventTests.java index d5cc8f790f0..b1bbb815acb 100644 --- a/spring-context/src/test/java/org/springframework/context/event/LifecycleEventTests.java +++ b/spring-context/src/test/java/org/springframework/context/event/LifecycleEventTests.java @@ -63,7 +63,7 @@ public class LifecycleEventTests extends TestCase { } - private static class LifecycleListener implements ApplicationListener { + private static class LifecycleListener implements ApplicationListener { private ApplicationContext context; diff --git a/spring-context/src/test/java/org/springframework/context/expression/ApplicationContextExpressionTests.java b/spring-context/src/test/java/org/springframework/context/expression/ApplicationContextExpressionTests.java index 393e71d5d54..cfd70979e98 100644 --- a/spring-context/src/test/java/org/springframework/context/expression/ApplicationContextExpressionTests.java +++ b/spring-context/src/test/java/org/springframework/context/expression/ApplicationContextExpressionTests.java @@ -57,7 +57,7 @@ public class ApplicationContextExpressionTests { AnnotationConfigUtils.registerAnnotationConfigProcessors(ac); ac.getBeanFactory().registerScope("myScope", new Scope() { - public Object get(String name, ObjectFactory objectFactory) { + public Object get(String name, ObjectFactory objectFactory) { return objectFactory.getObject(); } public Object remove(String name) { diff --git a/spring-context/src/test/java/org/springframework/context/support/ConversionServiceFactoryBeanTests.java b/spring-context/src/test/java/org/springframework/context/support/ConversionServiceFactoryBeanTests.java index 5a779f0d3a5..34588e19a7a 100644 --- a/spring-context/src/test/java/org/springframework/context/support/ConversionServiceFactoryBeanTests.java +++ b/spring-context/src/test/java/org/springframework/context/support/ConversionServiceFactoryBeanTests.java @@ -61,6 +61,7 @@ public class ConversionServiceFactoryBeanTests { converters.add(new ConverterFactory() { public Converter getConverter(Class targetType) { return new Converter () { + @SuppressWarnings("unchecked") public T convert(String source) { return (T) new Bar(); } @@ -103,7 +104,7 @@ public class ConversionServiceFactoryBeanTests { doTestConversionServiceInApplicationContext("conversionServiceWithResourceOverriding.xml", FileSystemResource.class); } - private void doTestConversionServiceInApplicationContext(String fileName, Class resourceClass) { + private void doTestConversionServiceInApplicationContext(String fileName, Class resourceClass) { ApplicationContext ctx = new ClassPathXmlApplicationContext(fileName, getClass()); ResourceTestBean tb = ctx.getBean("resourceTestBean", ResourceTestBean.class); assertTrue(resourceClass.isInstance(tb.getResource())); @@ -128,7 +129,7 @@ public class ConversionServiceFactoryBeanTests { public static class ComplexConstructorArgument { - public ComplexConstructorArgument(Map map) { + public ComplexConstructorArgument(Map> map) { assertTrue(!map.isEmpty()); assertTrue(map.keySet().iterator().next() instanceof String); assertTrue(map.values().iterator().next() instanceof Class); diff --git a/spring-context/src/test/java/org/springframework/context/support/DefaultLifecycleProcessorTests.java b/spring-context/src/test/java/org/springframework/context/support/DefaultLifecycleProcessorTests.java index 61615a2b591..a561e2cbf38 100644 --- a/spring-context/src/test/java/org/springframework/context/support/DefaultLifecycleProcessorTests.java +++ b/spring-context/src/test/java/org/springframework/context/support/DefaultLifecycleProcessorTests.java @@ -692,7 +692,7 @@ public class DefaultLifecycleProcessorTests { } - public static class DummySmartLifecycleFactoryBean implements FactoryBean, SmartLifecycle { + public static class DummySmartLifecycleFactoryBean implements FactoryBean, SmartLifecycle { public boolean running = false; @@ -702,7 +702,7 @@ public class DefaultLifecycleProcessorTests { return this.bean; } - public Class getObjectType() { + public Class getObjectType() { return DummySmartLifecycleBean.class; } diff --git a/spring-context/src/test/java/org/springframework/context/support/FactoryBeanAndApplicationListener.java b/spring-context/src/test/java/org/springframework/context/support/FactoryBeanAndApplicationListener.java index b0a90824d44..a545e69e688 100644 --- a/spring-context/src/test/java/org/springframework/context/support/FactoryBeanAndApplicationListener.java +++ b/spring-context/src/test/java/org/springframework/context/support/FactoryBeanAndApplicationListener.java @@ -8,13 +8,13 @@ import org.springframework.context.ApplicationListener; * @author Juergen Hoeller * @since 06.10.2004 */ -public class FactoryBeanAndApplicationListener implements FactoryBean, ApplicationListener { +public class FactoryBeanAndApplicationListener implements FactoryBean, ApplicationListener { - public Object getObject() throws Exception { + public String getObject() throws Exception { return ""; } - public Class getObjectType() { + public Class getObjectType() { return String.class; } diff --git a/spring-context/src/test/java/org/springframework/context/support/ResourceBundleMessageSourceTests.java b/spring-context/src/test/java/org/springframework/context/support/ResourceBundleMessageSourceTests.java index 8a462c0425b..7e45ce98985 100644 --- a/spring-context/src/test/java/org/springframework/context/support/ResourceBundleMessageSourceTests.java +++ b/spring-context/src/test/java/org/springframework/context/support/ResourceBundleMessageSourceTests.java @@ -115,8 +115,8 @@ public class ResourceBundleMessageSourceTests extends TestCase { if (alwaysUseMessageFormat) { pvs.add("alwaysUseMessageFormat", Boolean.TRUE); } - Class clazz = reloadable ? - (Class) ReloadableResourceBundleMessageSource.class : ResourceBundleMessageSource.class; + Class clazz = reloadable ? + (Class) ReloadableResourceBundleMessageSource.class : ResourceBundleMessageSource.class; ac.registerSingleton("messageSource", clazz, pvs); ac.refresh(); diff --git a/spring-context/src/test/java/org/springframework/context/support/Spr7283Tests.java b/spring-context/src/test/java/org/springframework/context/support/Spr7283Tests.java index d734c34f0a7..73c189e36e5 100644 --- a/spring-context/src/test/java/org/springframework/context/support/Spr7283Tests.java +++ b/spring-context/src/test/java/org/springframework/context/support/Spr7283Tests.java @@ -30,7 +30,7 @@ public class Spr7283Tests { @Test public void testListWithInconsistentElementType() { ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext("spr7283.xml", getClass()); - List list = ctx.getBean("list", List.class); + List list = ctx.getBean("list", List.class); assertEquals(2, list.size()); assertTrue(list.get(0) instanceof A); assertTrue(list.get(1) instanceof B); diff --git a/spring-context/src/test/java/org/springframework/context/support/StaticApplicationContextMulticasterTests.java b/spring-context/src/test/java/org/springframework/context/support/StaticApplicationContextMulticasterTests.java index 089072fb3c8..9ac74335896 100644 --- a/spring-context/src/test/java/org/springframework/context/support/StaticApplicationContextMulticasterTests.java +++ b/spring-context/src/test/java/org/springframework/context/support/StaticApplicationContextMulticasterTests.java @@ -45,7 +45,7 @@ public class StaticApplicationContextMulticasterTests extends AbstractApplicatio /** Run for each test */ protected ConfigurableApplicationContext createContext() throws Exception { StaticApplicationContext parent = new StaticApplicationContext(); - Map m = new HashMap(); + Map m = new HashMap(); m.put("name", "Roderick"); parent.registerPrototype("rod", TestBean.class, new MutablePropertyValues(m)); m.put("name", "Albert"); diff --git a/spring-context/src/test/java/org/springframework/context/support/StaticApplicationContextTests.java b/spring-context/src/test/java/org/springframework/context/support/StaticApplicationContextTests.java index 431325062ed..2dba7fc9eac 100644 --- a/spring-context/src/test/java/org/springframework/context/support/StaticApplicationContextTests.java +++ b/spring-context/src/test/java/org/springframework/context/support/StaticApplicationContextTests.java @@ -41,7 +41,7 @@ public class StaticApplicationContextTests extends AbstractApplicationContextTes /** Run for each test */ protected ConfigurableApplicationContext createContext() throws Exception { StaticApplicationContext parent = new StaticApplicationContext(); - Map m = new HashMap(); + Map m = new HashMap(); m.put("name", "Roderick"); parent.registerPrototype("rod", TestBean.class, new MutablePropertyValues(m)); m.put("name", "Albert"); diff --git a/spring-context/src/test/java/org/springframework/context/support/StaticMessageSourceTests.java b/spring-context/src/test/java/org/springframework/context/support/StaticMessageSourceTests.java index 47e72fb9116..73d0cab6517 100644 --- a/spring-context/src/test/java/org/springframework/context/support/StaticMessageSourceTests.java +++ b/spring-context/src/test/java/org/springframework/context/support/StaticMessageSourceTests.java @@ -198,7 +198,7 @@ public class StaticMessageSourceTests extends AbstractApplicationContextTests { protected ConfigurableApplicationContext createContext() throws Exception { StaticApplicationContext parent = new StaticApplicationContext(); - Map m = new HashMap(); + Map m = new HashMap(); m.put("name", "Roderick"); parent.registerPrototype("rod", org.springframework.beans.TestBean.class, new MutablePropertyValues(m)); m.put("name", "Albert"); @@ -221,7 +221,7 @@ public class StaticMessageSourceTests extends AbstractApplicationContextTests { sac.addListener(listener); StaticMessageSource messageSource = sac.getStaticMessageSource(); - Map usMessages = new HashMap(3); + Map usMessages = new HashMap(3); usMessages.put("message.format.example1", MSG_TXT1_US); usMessages.put("message.format.example2", MSG_TXT2_US); usMessages.put("message.format.example3", MSG_TXT3_US); diff --git a/spring-context/src/test/java/org/springframework/ejb/access/LocalSlsbInvokerInterceptorTests.java b/spring-context/src/test/java/org/springframework/ejb/access/LocalSlsbInvokerInterceptorTests.java index 11a20f3cd6e..bcfc34c71b9 100644 --- a/spring-context/src/test/java/org/springframework/ejb/access/LocalSlsbInvokerInterceptorTests.java +++ b/spring-context/src/test/java/org/springframework/ejb/access/LocalSlsbInvokerInterceptorTests.java @@ -90,7 +90,7 @@ public class LocalSlsbInvokerInterceptorTests { LocalSlsbInvokerInterceptor si = configuredInterceptor(mockContext, jndiName); - ProxyFactory pf = new ProxyFactory(new Class[] { BusinessMethods.class } ); + ProxyFactory pf = new ProxyFactory(new Class[] { BusinessMethods.class } ); pf.addAdvice(si); BusinessMethods target = (BusinessMethods) pf.getProxy(); @@ -113,7 +113,7 @@ public class LocalSlsbInvokerInterceptorTests { LocalSlsbInvokerInterceptor si = configuredInterceptor(mockContext, jndiName); - ProxyFactory pf = new ProxyFactory(new Class[] { BusinessMethods.class } ); + ProxyFactory pf = new ProxyFactory(new Class[] { BusinessMethods.class } ); pf.addAdvice(si); BusinessMethods target = (BusinessMethods) pf.getProxy(); @@ -133,7 +133,7 @@ public class LocalSlsbInvokerInterceptorTests { LocalSlsbInvokerInterceptor si = configuredInterceptor(mockContext, jndiName); - ProxyFactory pf = new ProxyFactory(new Class[] { LocalInterfaceWithBusinessMethods.class } ); + ProxyFactory pf = new ProxyFactory(new Class[] { LocalInterfaceWithBusinessMethods.class } ); pf.addAdvice(si); LocalInterfaceWithBusinessMethods target = (LocalInterfaceWithBusinessMethods) pf.getProxy(); diff --git a/spring-context/src/test/java/org/springframework/ejb/access/SimpleRemoteSlsbInvokerInterceptorTests.java b/spring-context/src/test/java/org/springframework/ejb/access/SimpleRemoteSlsbInvokerInterceptorTests.java index 4d921eafcba..a48935c47c2 100644 --- a/spring-context/src/test/java/org/springframework/ejb/access/SimpleRemoteSlsbInvokerInterceptorTests.java +++ b/spring-context/src/test/java/org/springframework/ejb/access/SimpleRemoteSlsbInvokerInterceptorTests.java @@ -79,7 +79,7 @@ public class SimpleRemoteSlsbInvokerInterceptorTests { protected Object configuredProxy(SimpleRemoteSlsbInvokerInterceptor si, Class ifc) throws NamingException { si.afterPropertiesSet(); - ProxyFactory pf = new ProxyFactory(new Class[] {ifc}); + ProxyFactory pf = new ProxyFactory(new Class[] {ifc}); pf.addAdvice(si); return pf.getProxy(); } diff --git a/spring-context/src/test/java/org/springframework/jmx/export/MBeanExporterTests.java b/spring-context/src/test/java/org/springframework/jmx/export/MBeanExporterTests.java index 95c610e11fb..85865af76fc 100644 --- a/spring-context/src/test/java/org/springframework/jmx/export/MBeanExporterTests.java +++ b/spring-context/src/test/java/org/springframework/jmx/export/MBeanExporterTests.java @@ -238,7 +238,7 @@ public final class MBeanExporterTests extends AbstractMBeanServerTests { ProxyFactory factory = new ProxyFactory(); factory.setTarget(bean); factory.addAdvice(new NopInterceptor()); - factory.setInterfaces(new Class[] { IJmxTestBean.class }); + factory.setInterfaces(new Class[] { IJmxTestBean.class }); IJmxTestBean proxy = (IJmxTestBean) factory.getProxy(); String name = "bean:mmm=whatever"; diff --git a/spring-context/src/test/java/org/springframework/jmx/export/assembler/AbstractMetadataAssemblerTests.java b/spring-context/src/test/java/org/springframework/jmx/export/assembler/AbstractMetadataAssemblerTests.java index 9100215b83c..93735097c67 100644 --- a/spring-context/src/test/java/org/springframework/jmx/export/assembler/AbstractMetadataAssemblerTests.java +++ b/spring-context/src/test/java/org/springframework/jmx/export/assembler/AbstractMetadataAssemblerTests.java @@ -158,7 +158,7 @@ public abstract class AbstractMetadataAssemblerTests extends AbstractJmxAssemble String objectName = "spring:bean=test,proxy=true"; - Map beans = new HashMap(); + Map beans = new HashMap(); beans.put(objectName, proxy); exporter.setBeans(beans); exporter.afterPropertiesSet(); diff --git a/spring-context/src/test/java/org/springframework/jmx/export/assembler/InterfaceBasedMBeanInfoAssemblerCustomTests.java b/spring-context/src/test/java/org/springframework/jmx/export/assembler/InterfaceBasedMBeanInfoAssemblerCustomTests.java index 2e48d506107..4be8a6cc92f 100644 --- a/spring-context/src/test/java/org/springframework/jmx/export/assembler/InterfaceBasedMBeanInfoAssemblerCustomTests.java +++ b/spring-context/src/test/java/org/springframework/jmx/export/assembler/InterfaceBasedMBeanInfoAssemblerCustomTests.java @@ -40,7 +40,7 @@ public class InterfaceBasedMBeanInfoAssemblerCustomTests extends AbstractJmxAsse protected MBeanInfoAssembler getAssembler() { InterfaceBasedMBeanInfoAssembler assembler = new InterfaceBasedMBeanInfoAssembler(); - assembler.setManagedInterfaces(new Class[] {ICustomJmxBean.class}); + assembler.setManagedInterfaces(new Class[] {ICustomJmxBean.class}); return assembler; } diff --git a/spring-context/src/test/java/org/springframework/jmx/export/assembler/InterfaceBasedMBeanInfoAssemblerMappedTests.java b/spring-context/src/test/java/org/springframework/jmx/export/assembler/InterfaceBasedMBeanInfoAssemblerMappedTests.java index 666f877b807..a0681cc398a 100644 --- a/spring-context/src/test/java/org/springframework/jmx/export/assembler/InterfaceBasedMBeanInfoAssemblerMappedTests.java +++ b/spring-context/src/test/java/org/springframework/jmx/export/assembler/InterfaceBasedMBeanInfoAssemblerMappedTests.java @@ -60,7 +60,7 @@ public class InterfaceBasedMBeanInfoAssemblerMappedTests extends AbstractJmxAsse public void ignoreTestWithFallThrough() throws Exception { InterfaceBasedMBeanInfoAssembler assembler = getWithMapping("foobar", "org.springframework.jmx.export.assembler.ICustomJmxBean"); - assembler.setManagedInterfaces(new Class[] {IAdditionalTestMethods.class}); + assembler.setManagedInterfaces(new Class[] {IAdditionalTestMethods.class}); ModelMBeanInfo inf = assembler.getMBeanInfo(getBean(), getObjectName()); MBeanAttributeInfo attr = inf.getAttribute("NickName"); diff --git a/spring-context/src/test/java/org/springframework/remoting/rmi/RmiSupportTests.java b/spring-context/src/test/java/org/springframework/remoting/rmi/RmiSupportTests.java index aebf7d8e419..dbb46d53859 100644 --- a/spring-context/src/test/java/org/springframework/remoting/rmi/RmiSupportTests.java +++ b/spring-context/src/test/java/org/springframework/remoting/rmi/RmiSupportTests.java @@ -88,7 +88,7 @@ public class RmiSupportTests extends TestCase { doTestRmiProxyFactoryBeanWithException(UnmarshalException.class); } - private void doTestRmiProxyFactoryBeanWithException(Class exceptionClass) throws Exception { + private void doTestRmiProxyFactoryBeanWithException(Class exceptionClass) throws Exception { CountingRmiProxyFactoryBean factory = new CountingRmiProxyFactoryBean(); factory.setServiceInterface(IRemoteBean.class); factory.setServiceUrl("rmi://localhost:1090/test"); @@ -130,7 +130,7 @@ public class RmiSupportTests extends TestCase { doTestRmiProxyFactoryBeanWithExceptionAndRefresh(StubNotFoundException.class); } - private void doTestRmiProxyFactoryBeanWithExceptionAndRefresh(Class exceptionClass) throws Exception { + private void doTestRmiProxyFactoryBeanWithExceptionAndRefresh(Class exceptionClass) throws Exception { CountingRmiProxyFactoryBean factory = new CountingRmiProxyFactoryBean(); factory.setServiceInterface(IRemoteBean.class); factory.setServiceUrl("rmi://localhost:1090/test"); @@ -217,7 +217,7 @@ public class RmiSupportTests extends TestCase { } private void doTestRmiProxyFactoryBeanWithBusinessInterfaceAndException( - Class rmiExceptionClass, Class springExceptionClass) throws Exception { + Class rmiExceptionClass, Class springExceptionClass) throws Exception { CountingRmiProxyFactoryBean factory = new CountingRmiProxyFactoryBean(); factory.setServiceInterface(IBusinessBean.class); @@ -272,7 +272,7 @@ public class RmiSupportTests extends TestCase { } private void doTestRmiProxyFactoryBeanWithBusinessInterfaceAndExceptionAndRefresh( - Class rmiExceptionClass, Class springExceptionClass) throws Exception { + Class rmiExceptionClass, Class springExceptionClass) throws Exception { CountingRmiProxyFactoryBean factory = new CountingRmiProxyFactoryBean(); factory.setServiceInterface(IBusinessBean.class); @@ -319,7 +319,7 @@ public class RmiSupportTests extends TestCase { // let's see if the remote invocation object works final RemoteBean rb = new RemoteBean(); - final Method setNameMethod = rb.getClass().getDeclaredMethod("setName", new Class[] {String.class}); + final Method setNameMethod = rb.getClass().getDeclaredMethod("setName", new Class[] {String.class}); MethodInvocation mi = new MethodInvocation() { public Method getMethod() { @@ -351,10 +351,10 @@ public class RmiSupportTests extends TestCase { assertEquals("bla", inv.getArguments()[0]); inv.setMethodName("setName"); assertEquals("setName", inv.getMethodName()); - inv.setParameterTypes(new Class[] {String.class}); + inv.setParameterTypes(new Class[] {String.class}); assertEquals(String.class, inv.getParameterTypes()[0]); - inv = new RemoteInvocation("setName", new Class[] {String.class}, new Object[] {"bla"}); + inv = new RemoteInvocation("setName", new Class[] {String.class}, new Object[] {"bla"}); assertEquals("bla", inv.getArguments()[0]); assertEquals("setName", inv.getMethodName()); assertEquals(String.class, inv.getParameterTypes()[0]); @@ -436,8 +436,8 @@ public class RmiSupportTests extends TestCase { if (nam != null && nam.endsWith("Exception")) { RemoteException rex = null; try { - Class exClass = Class.forName(nam); - Constructor ctor = exClass.getConstructor(new Class[] {String.class}); + Class exClass = Class.forName(nam); + Constructor ctor = exClass.getConstructor(new Class[] {String.class}); rex = (RemoteException) ctor.newInstance(new Object[] {"myMessage"}); } catch (Exception ex) { diff --git a/spring-context/src/test/java/org/springframework/scheduling/timer/TimerSupportTests.java b/spring-context/src/test/java/org/springframework/scheduling/timer/TimerSupportTests.java index 5886a912eae..2659b23576b 100644 --- a/spring-context/src/test/java/org/springframework/scheduling/timer/TimerSupportTests.java +++ b/spring-context/src/test/java/org/springframework/scheduling/timer/TimerSupportTests.java @@ -48,7 +48,7 @@ public class TimerSupportTests extends TestCase { tasks[1] = new ScheduledTimerTask(timerTask1, 10, 20, true); tasks[2] = new ScheduledTimerTask(timerTask2, 20); - final List success = new ArrayList(3); + final List success = new ArrayList(3); final Timer timer = new Timer(true) { public void schedule(TimerTask task, long delay, long period) { if (task == timerTask0 && delay == 0 && period == 10) { diff --git a/spring-context/src/test/java/org/springframework/scripting/bsh/BshScriptFactoryTests.java b/spring-context/src/test/java/org/springframework/scripting/bsh/BshScriptFactoryTests.java index 9dfbf55a77f..90582292d41 100644 --- a/spring-context/src/test/java/org/springframework/scripting/bsh/BshScriptFactoryTests.java +++ b/spring-context/src/test/java/org/springframework/scripting/bsh/BshScriptFactoryTests.java @@ -199,9 +199,9 @@ public class BshScriptFactoryTests extends TestCase { mock.replay(); BshScriptFactory factory = new BshScriptFactory( ScriptFactoryPostProcessor.INLINE_SCRIPT_PREFIX + badScript, - new Class[] {Messenger.class}); + new Class[] {Messenger.class}); try { - Messenger messenger = (Messenger) factory.getScriptedObject(script, new Class[]{Messenger.class}); + Messenger messenger = (Messenger) factory.getScriptedObject(script, new Class[]{Messenger.class}); messenger.getMessage(); fail("Must have thrown a BshScriptUtils.BshExecutionException."); } @@ -212,7 +212,7 @@ public class BshScriptFactoryTests extends TestCase { public void testCtorWithNullScriptSourceLocator() throws Exception { try { - new BshScriptFactory(null, new Class[] {Messenger.class}); + new BshScriptFactory(null, new Class[] {Messenger.class}); fail("Must have thrown exception by this point."); } catch (IllegalArgumentException expected) { @@ -221,7 +221,7 @@ public class BshScriptFactoryTests extends TestCase { public void testCtorWithEmptyScriptSourceLocator() throws Exception { try { - new BshScriptFactory("", new Class[] {Messenger.class}); + new BshScriptFactory("", new Class[] {Messenger.class}); fail("Must have thrown exception by this point."); } catch (IllegalArgumentException expected) { @@ -230,7 +230,7 @@ public class BshScriptFactoryTests extends TestCase { public void testCtorWithWhitespacedScriptSourceLocator() throws Exception { try { - new BshScriptFactory("\n ", new Class[] {Messenger.class}); + new BshScriptFactory("\n ", new Class[] {Messenger.class}); fail("Must have thrown exception by this point."); } catch (IllegalArgumentException expected) { @@ -241,7 +241,7 @@ public class BshScriptFactoryTests extends TestCase { ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext("bsh-with-xsd.xml", getClass()); TestBean testBean = (TestBean) ctx.getBean("testBean"); - Collection beanNames = Arrays.asList(ctx.getBeanNamesForType(Messenger.class)); + Collection beanNames = Arrays.asList(ctx.getBeanNamesForType(Messenger.class)); assertTrue(beanNames.contains("messenger")); assertTrue(beanNames.contains("messengerImpl")); assertTrue(beanNames.contains("messengerInstance")); @@ -262,7 +262,7 @@ public class BshScriptFactoryTests extends TestCase { TestBeanAwareMessenger messengerByName = (TestBeanAwareMessenger) ctx.getBean("messengerByName"); assertEquals(testBean, messengerByName.getTestBean()); - Collection beans = ctx.getBeansOfType(Messenger.class).values(); + Collection beans = ctx.getBeansOfType(Messenger.class).values(); assertTrue(beans.contains(messenger)); assertTrue(beans.contains(messengerImpl)); assertTrue(beans.contains(messengerInstance)); diff --git a/spring-context/src/test/java/org/springframework/scripting/groovy/GroovyClassLoadingTests.java b/spring-context/src/test/java/org/springframework/scripting/groovy/GroovyClassLoadingTests.java index 530559a6b47..132d9211c05 100644 --- a/spring-context/src/test/java/org/springframework/scripting/groovy/GroovyClassLoadingTests.java +++ b/spring-context/src/test/java/org/springframework/scripting/groovy/GroovyClassLoadingTests.java @@ -34,12 +34,12 @@ public class GroovyClassLoadingTests extends TestCase { StaticApplicationContext context = new StaticApplicationContext(); GroovyClassLoader gcl = new GroovyClassLoader(); - Class class1 = gcl.parseClass("class TestBean { def myMethod() { \"foo\" } }"); - Class class2 = gcl.parseClass("class TestBean { def myMethod() { \"bar\" } }"); + Class class1 = gcl.parseClass("class TestBean { def myMethod() { \"foo\" } }"); + Class class2 = gcl.parseClass("class TestBean { def myMethod() { \"bar\" } }"); context.registerBeanDefinition("testBean", new RootBeanDefinition(class1)); Object testBean1 = context.getBean("testBean"); - Method method1 = class1.getDeclaredMethod("myMethod", new Class[0]); + Method method1 = class1.getDeclaredMethod("myMethod", new Class[0]); Object result1 = ReflectionUtils.invokeMethod(method1, testBean1); assertEquals("foo", (String) result1); @@ -48,7 +48,7 @@ public class GroovyClassLoadingTests extends TestCase { context.registerBeanDefinition("testBean", new RootBeanDefinition(class2)); Object testBean2 = context.getBean("testBean"); - Method method2 = class2.getDeclaredMethod("myMethod", new Class[0]); + Method method2 = class2.getDeclaredMethod("myMethod", new Class[0]); Object result2 = ReflectionUtils.invokeMethod(method2, testBean2); assertEquals("bar", (String) result2); } diff --git a/spring-context/src/test/java/org/springframework/scripting/groovy/GroovyScriptFactoryTests.java b/spring-context/src/test/java/org/springframework/scripting/groovy/GroovyScriptFactoryTests.java index d43f90950b8..763827a05a0 100644 --- a/spring-context/src/test/java/org/springframework/scripting/groovy/GroovyScriptFactoryTests.java +++ b/spring-context/src/test/java/org/springframework/scripting/groovy/GroovyScriptFactoryTests.java @@ -201,7 +201,7 @@ public class GroovyScriptFactoryTests { GroovyScriptFactory factory = new GroovyScriptFactory(ScriptFactoryPostProcessor.INLINE_SCRIPT_PREFIX + badScript); try { - factory.getScriptedObject(script, new Class[] {}); + factory.getScriptedObject(script, new Class[] {}); fail("Must have thrown a ScriptCompilationException (no public no-arg ctor in scripted class)."); } catch (ScriptCompilationException expected) { assertTrue(expected.contains(InstantiationException.class)); @@ -219,7 +219,7 @@ public class GroovyScriptFactoryTests { GroovyScriptFactory factory = new GroovyScriptFactory(ScriptFactoryPostProcessor.INLINE_SCRIPT_PREFIX + badScript); try { - factory.getScriptedObject(script, new Class[] {}); + factory.getScriptedObject(script, new Class[] {}); fail("Must have thrown a ScriptCompilationException (no oublic no-arg ctor in scripted class)."); } catch (ScriptCompilationException expected) { assertTrue(expected.contains(IllegalAccessException.class)); @@ -402,7 +402,7 @@ public class GroovyScriptFactoryTests { @Test public void testAnonymousScriptDetected() throws Exception { ApplicationContext ctx = new ClassPathXmlApplicationContext("groovy-with-xsd.xml", getClass()); - Map beans = ctx.getBeansOfType(Messenger.class); + Map beans = ctx.getBeansOfType(Messenger.class); assertEquals(4, beans.size()); } diff --git a/spring-context/src/test/java/org/springframework/scripting/jruby/JRubyScriptFactoryTests.java b/spring-context/src/test/java/org/springframework/scripting/jruby/JRubyScriptFactoryTests.java index 63de6c42074..cc7e1ce392f 100644 --- a/spring-context/src/test/java/org/springframework/scripting/jruby/JRubyScriptFactoryTests.java +++ b/spring-context/src/test/java/org/springframework/scripting/jruby/JRubyScriptFactoryTests.java @@ -94,7 +94,7 @@ public class JRubyScriptFactoryTests extends TestCase { public void testCtorWithNullScriptSourceLocator() throws Exception { try { - new JRubyScriptFactory(null, new Class[]{Messenger.class}); + new JRubyScriptFactory(null, new Class[]{Messenger.class}); fail("Must have thrown exception by this point."); } catch (IllegalArgumentException expected) { @@ -103,7 +103,7 @@ public class JRubyScriptFactoryTests extends TestCase { public void testCtorWithEmptyScriptSourceLocator() throws Exception { try { - new JRubyScriptFactory("", new Class[]{Messenger.class}); + new JRubyScriptFactory("", new Class[]{Messenger.class}); fail("Must have thrown exception by this point."); } catch (IllegalArgumentException expected) { @@ -112,7 +112,7 @@ public class JRubyScriptFactoryTests extends TestCase { public void testCtorWithWhitespacedScriptSourceLocator() throws Exception { try { - new JRubyScriptFactory("\n ", new Class[]{Messenger.class}); + new JRubyScriptFactory("\n ", new Class[]{Messenger.class}); fail("Must have thrown exception by this point."); } catch (IllegalArgumentException expected) { @@ -130,7 +130,7 @@ public class JRubyScriptFactoryTests extends TestCase { public void testCtorWithEmptyScriptInterfacesArray() throws Exception { try { - new JRubyScriptFactory(RUBY_SCRIPT_SOURCE_LOCATOR, new Class[]{}); + new JRubyScriptFactory(RUBY_SCRIPT_SOURCE_LOCATOR, new Class[]{}); fail("Must have thrown exception by this point."); } catch (IllegalArgumentException expected) { @@ -250,14 +250,14 @@ public class JRubyScriptFactoryTests extends TestCase { assertEquals("2", lol[1][0]); assertEquals("3", lol[2][0]); - Map singleValueMap = adder.toMap("key", "value"); + Map singleValueMap = adder.toMap("key", "value"); assertNotNull(singleValueMap); assertEquals(1, singleValueMap.size()); assertEquals("key", singleValueMap.keySet().iterator().next()); assertEquals("value", singleValueMap.values().iterator().next()); String[] expectedStrings = new String[]{"1", "2", "3"}; - Map map = adder.toMap("key", expectedStrings); + Map map = adder.toMap("key", expectedStrings); assertNotNull(map); assertEquals(1, map.size()); assertEquals("key", map.keySet().iterator().next()); diff --git a/spring-context/src/test/java/org/springframework/scripting/jruby/WrapperAdder.java b/spring-context/src/test/java/org/springframework/scripting/jruby/WrapperAdder.java index 2656c8a60e2..3e0589c7b32 100644 --- a/spring-context/src/test/java/org/springframework/scripting/jruby/WrapperAdder.java +++ b/spring-context/src/test/java/org/springframework/scripting/jruby/WrapperAdder.java @@ -47,6 +47,6 @@ public interface WrapperAdder { String[][] createListOfLists(String one, String second, String third); - Map toMap(String key, Object value); + Map toMap(String key, Object value); } diff --git a/spring-context/src/test/java/org/springframework/ui/ModelMapTests.java b/spring-context/src/test/java/org/springframework/ui/ModelMapTests.java index 0478ed29096..336fe78e678 100644 --- a/spring-context/src/test/java/org/springframework/ui/ModelMapTests.java +++ b/spring-context/src/test/java/org/springframework/ui/ModelMapTests.java @@ -276,7 +276,7 @@ public final class ModelMapTests { ModelMap map = new ModelMap(); Object proxy = Proxy.newProxyInstance( getClass().getClassLoader(), - new Class[] {Map.class}, + new Class[] {Map.class}, new InvocationHandler() { public Object invoke(Object proxy, Method method, Object[] args) { return "proxy"; diff --git a/spring-context/src/test/java/org/springframework/validation/DataBinderFieldAccessTests.java b/spring-context/src/test/java/org/springframework/validation/DataBinderFieldAccessTests.java index 96d4b6fb0cb..b1ba9804d28 100644 --- a/spring-context/src/test/java/org/springframework/validation/DataBinderFieldAccessTests.java +++ b/spring-context/src/test/java/org/springframework/validation/DataBinderFieldAccessTests.java @@ -50,7 +50,7 @@ public class DataBinderFieldAccessTests extends TestCase { assertTrue("changed name correctly", rod.getName().equals("Rod")); assertTrue("changed age correctly", rod.getAge() == 32); - Map m = binder.getBindingResult().getModel(); + Map m = binder.getBindingResult().getModel(); assertTrue("There is one element in map", m.size() == 2); FieldAccessBean tb = (FieldAccessBean) m.get("person"); assertTrue("Same object", tb.equals(rod)); @@ -92,7 +92,7 @@ public class DataBinderFieldAccessTests extends TestCase { assertTrue("changed name correctly", rod.getName().equals("Rod")); //assertTrue("changed age correctly", rod.getAge() == 32); - Map map = binder.getBindingResult().getModel(); + Map map = binder.getBindingResult().getModel(); //assertTrue("There are 3 element in map", m.size() == 1); FieldAccessBean tb = (FieldAccessBean) map.get("person"); assertTrue("Same object", tb.equals(rod)); @@ -136,7 +136,7 @@ public class DataBinderFieldAccessTests extends TestCase { assertTrue("changed name correctly", rod.getName().equals("Rod")); //assertTrue("changed age correctly", rod.getAge() == 32); - Map model = binder.getBindingResult().getModel(); + Map model = binder.getBindingResult().getModel(); //assertTrue("There are 3 element in map", m.size() == 1); FieldAccessBean tb = (FieldAccessBean) model.get("person"); assertTrue("Same object", tb.equals(rod)); diff --git a/spring-context/src/test/java/org/springframework/validation/DataBinderTests.java b/spring-context/src/test/java/org/springframework/validation/DataBinderTests.java index ea9fd94b115..c9f12660a17 100644 --- a/spring-context/src/test/java/org/springframework/validation/DataBinderTests.java +++ b/spring-context/src/test/java/org/springframework/validation/DataBinderTests.java @@ -80,7 +80,7 @@ public class DataBinderTests extends TestCase { assertTrue("changed name correctly", rod.getName().equals("Rod")); assertTrue("changed age correctly", rod.getAge() == 32); - Map map = binder.getBindingResult().getModel(); + Map map = binder.getBindingResult().getModel(); assertTrue("There is one element in map", map.size() == 2); TestBean tb = (TestBean) map.get("person"); assertTrue("Same object", tb.equals(rod)); @@ -190,7 +190,7 @@ public class DataBinderTests extends TestCase { assertTrue("changed name correctly", rod.getName().equals("Rod")); //assertTrue("changed age correctly", rod.getAge() == 32); - Map map = binder.getBindingResult().getModel(); + Map map = binder.getBindingResult().getModel(); //assertTrue("There are 3 element in map", m.size() == 1); TestBean tb = (TestBean) map.get("person"); assertTrue("Same object", tb.equals(rod)); @@ -284,7 +284,7 @@ public class DataBinderTests extends TestCase { assertTrue("changed name correctly", rod.getName().equals("Rod")); //assertTrue("changed age correctly", rod.getAge() == 32); - Map model = binder.getBindingResult().getModel(); + Map model = binder.getBindingResult().getModel(); //assertTrue("There are 3 element in map", m.size() == 1); TestBean tb = (TestBean) model.get("person"); assertTrue("Same object", tb.equals(rod)); @@ -1177,8 +1177,8 @@ public class DataBinderTests extends TestCase { pvs.add("array[0].nestedIndexedBean.list[0].name", "test1"); pvs.add("array[1].nestedIndexedBean.list[1].name", "test2"); binder.bind(pvs); - assertEquals("listtest1", ((TestBean) tb.getArray()[0].getNestedIndexedBean().getList().get(0)).getName()); - assertEquals("listtest2", ((TestBean) tb.getArray()[1].getNestedIndexedBean().getList().get(1)).getName()); + assertEquals("listtest1", tb.getArray()[0].getNestedIndexedBean().getList().get(0).getName()); + assertEquals("listtest2", tb.getArray()[1].getNestedIndexedBean().getList().get(1).getName()); assertEquals("test1", binder.getBindingResult().getFieldValue("array[0].nestedIndexedBean.list[0].name")); assertEquals("test2", binder.getBindingResult().getFieldValue("array[1].nestedIndexedBean.list[1].name")); } @@ -1200,8 +1200,8 @@ public class DataBinderTests extends TestCase { pvs.add("array[0].nestedIndexedBean.list[0].name", "test1"); pvs.add("array[1].nestedIndexedBean.list[1].name", "test2"); binder.bind(pvs); - assertEquals("listtest1", ((TestBean) tb.getArray()[0].getNestedIndexedBean().getList().get(0)).getName()); - assertEquals("test2", ((TestBean) tb.getArray()[1].getNestedIndexedBean().getList().get(1)).getName()); + assertEquals("listtest1", tb.getArray()[0].getNestedIndexedBean().getList().get(0).getName()); + assertEquals("test2", tb.getArray()[1].getNestedIndexedBean().getList().get(1).getName()); assertEquals("test1", binder.getBindingResult().getFieldValue("array[0].nestedIndexedBean.list[0].name")); assertEquals("test2", binder.getBindingResult().getFieldValue("array[1].nestedIndexedBean.list[1].name")); } @@ -1223,8 +1223,8 @@ public class DataBinderTests extends TestCase { pvs.add("array[0].nestedIndexedBean.list[0].name", "test1"); pvs.add("array[1].nestedIndexedBean.list[1].name", "test2"); binder.bind(pvs); - assertEquals("listtest1", ((TestBean) tb.getArray()[0].getNestedIndexedBean().getList().get(0)).getName()); - assertEquals("test2", ((TestBean) tb.getArray()[1].getNestedIndexedBean().getList().get(1)).getName()); + assertEquals("listtest1", tb.getArray()[0].getNestedIndexedBean().getList().get(0).getName()); + assertEquals("test2", tb.getArray()[1].getNestedIndexedBean().getList().get(1).getName()); assertEquals("test1", binder.getBindingResult().getFieldValue("array[0].nestedIndexedBean.list[0].name")); assertEquals("test2", binder.getBindingResult().getFieldValue("array[1].nestedIndexedBean.list[1].name")); } @@ -1647,7 +1647,7 @@ public class DataBinderTests extends TestCase { private static class TestBeanValidator implements Validator { - public boolean supports(Class clazz) { + public boolean supports(Class clazz) { return TestBean.class.isAssignableFrom(clazz); } @@ -1674,7 +1674,7 @@ public class DataBinderTests extends TestCase { private static class SpouseValidator implements Validator { - public boolean supports(Class clazz) { + public boolean supports(Class clazz) { return TestBean.class.isAssignableFrom(clazz); } diff --git a/spring-context/src/test/java/org/springframework/validation/ValidationUtilsTests.java b/spring-context/src/test/java/org/springframework/validation/ValidationUtilsTests.java index 11235906e3f..4ab4f448f4c 100644 --- a/spring-context/src/test/java/org/springframework/validation/ValidationUtilsTests.java +++ b/spring-context/src/test/java/org/springframework/validation/ValidationUtilsTests.java @@ -161,7 +161,7 @@ public class ValidationUtilsTests { private static class EmptyValidator implements Validator { - public boolean supports(Class clazz) { + public boolean supports(Class clazz) { return TestBean.class.isAssignableFrom(clazz); } @@ -173,7 +173,7 @@ public class ValidationUtilsTests { private static class EmptyOrWhitespaceValidator implements Validator { - public boolean supports(Class clazz) { + public boolean supports(Class clazz) { return TestBean.class.isAssignableFrom(clazz); } diff --git a/spring-context/src/test/java/org/springframework/validation/beanvalidation/ValidatorFactoryTests.java b/spring-context/src/test/java/org/springframework/validation/beanvalidation/ValidatorFactoryTests.java index dbfe0b7d1a8..41f500d93ef 100644 --- a/spring-context/src/test/java/org/springframework/validation/beanvalidation/ValidatorFactoryTests.java +++ b/spring-context/src/test/java/org/springframework/validation/beanvalidation/ValidatorFactoryTests.java @@ -95,7 +95,7 @@ public class ValidatorFactoryTests { Set> result = validator.validate(person); assertEquals(1, result.size()); Iterator> iterator = result.iterator(); - ConstraintViolation cv = iterator.next(); + ConstraintViolation cv = iterator.next(); assertEquals("", cv.getPropertyPath().toString()); assertTrue(cv.getConstraintDescriptor().getAnnotation() instanceof NameAddressValid); } diff --git a/spring-core/src/test/java/org/springframework/core/ConventionsTests.java b/spring-core/src/test/java/org/springframework/core/ConventionsTests.java index ce42c75d7c2..a9fb6e6a5fb 100644 --- a/spring-core/src/test/java/org/springframework/core/ConventionsTests.java +++ b/spring-core/src/test/java/org/springframework/core/ConventionsTests.java @@ -41,15 +41,15 @@ public class ConventionsTests extends TestCase { } public void testCollections() { - List list = new ArrayList(); + List list = new ArrayList(); list.add(new TestBean()); assertEquals("Incorrect plural List form", "testBeanList", Conventions.getVariableName(list)); - Set set = new HashSet(); + Set set = new HashSet(); set.add(new TestBean()); assertEquals("Incorrect plural Set form", "testBeanList", Conventions.getVariableName(set)); - List emptyList = new ArrayList(); + List emptyList = new ArrayList(); try { Conventions.getVariableName(emptyList); fail("Should not be able to generate name for empty collection"); @@ -67,7 +67,7 @@ public class ConventionsTests extends TestCase { public void testGetQualifiedAttributeName() throws Exception { String baseName = "foo"; - Class cls = String.class; + Class cls = String.class; String desiredResult = "java.lang.String.foo"; assertEquals(desiredResult, Conventions.getQualifiedAttributeName(cls, baseName)); } diff --git a/spring-core/src/test/java/org/springframework/core/LocalVariableTableParameterNameDiscovererTests.java b/spring-core/src/test/java/org/springframework/core/LocalVariableTableParameterNameDiscovererTests.java index da27d69e71b..8a6ba96d625 100644 --- a/spring-core/src/test/java/org/springframework/core/LocalVariableTableParameterNameDiscovererTests.java +++ b/spring-core/src/test/java/org/springframework/core/LocalVariableTableParameterNameDiscovererTests.java @@ -50,14 +50,14 @@ public class LocalVariableTableParameterNameDiscovererTests extends TestCase { } public void testConsParameterNameDiscoveryNoArgs() throws NoSuchMethodException { - Constructor noArgsCons = TestBean.class.getConstructor(new Class[0]); + Constructor noArgsCons = TestBean.class.getConstructor(new Class[0]); String[] names = discoverer.getParameterNames(noArgsCons); assertNotNull("should find cons info", names); assertEquals("no argument names", 0, names.length); } public void testConsParameterNameDiscoveryArgs() throws NoSuchMethodException { - Constructor twoArgCons = TestBean.class.getConstructor(new Class[] { String.class, int.class }); + Constructor twoArgCons = TestBean.class.getConstructor(new Class[] { String.class, int.class }); String[] names = discoverer.getParameterNames(twoArgCons); assertNotNull("should find cons info", names); assertEquals("one argument", 2, names.length); @@ -73,7 +73,7 @@ public class LocalVariableTableParameterNameDiscovererTests extends TestCase { } public void testOverloadedStaticMethod() throws Exception { - Class clazz = this.getClass(); + Class clazz = this.getClass(); Method m1 = clazz.getMethod("staticMethod", new Class[] { Long.TYPE, Long.TYPE }); String[] names = discoverer.getParameterNames(m1); @@ -92,7 +92,7 @@ public class LocalVariableTableParameterNameDiscovererTests extends TestCase { } public void testOverloadedStaticMethodInInnerClass() throws Exception { - Class clazz = InnerClass.class; + Class clazz = InnerClass.class; Method m1 = clazz.getMethod("staticMethod", new Class[] { Long.TYPE }); String[] names = discoverer.getParameterNames(m1); @@ -109,7 +109,7 @@ public class LocalVariableTableParameterNameDiscovererTests extends TestCase { } public void testOverloadedMethod() throws Exception { - Class clazz = this.getClass(); + Class clazz = this.getClass(); Method m1 = clazz.getMethod("instanceMethod", new Class[] { Double.TYPE, Double.TYPE }); String[] names = discoverer.getParameterNames(m1); @@ -128,7 +128,7 @@ public class LocalVariableTableParameterNameDiscovererTests extends TestCase { } public void testOverloadedMethodInInnerClass() throws Exception { - Class clazz = InnerClass.class; + Class clazz = InnerClass.class; Method m1 = clazz.getMethod("instanceMethod", new Class[] { String.class }); String[] names = discoverer.getParameterNames(m1); @@ -145,9 +145,9 @@ public class LocalVariableTableParameterNameDiscovererTests extends TestCase { } public void testGenerifiedClass() throws Exception { - Class clazz = GenerifiedClass.class; + Class clazz = (Class)GenerifiedClass.class; - Constructor ctor = clazz.getDeclaredConstructor(Object.class); + Constructor ctor = clazz.getDeclaredConstructor(Object.class); String[] names = discoverer.getParameterNames(ctor); assertEquals(1, names.length); assertEquals("key", names[0]); @@ -199,7 +199,7 @@ public class LocalVariableTableParameterNameDiscovererTests extends TestCase { @Ignore public void ignore_testClassesWithoutDebugSymbols() throws Exception { // JDK classes don't have debug information (usually) - Class clazz = Component.class; + Class clazz = Component.class; String methodName = "list"; Method m = clazz.getMethod(methodName); @@ -275,9 +275,6 @@ public class LocalVariableTableParameterNameDiscovererTests extends TestCase { public static class GenerifiedClass { private static long date; - private K key; - private V value; - static { // some custom static bloc or date = new Date().getTime(); @@ -292,8 +289,6 @@ public class LocalVariableTableParameterNameDiscovererTests extends TestCase { } public GenerifiedClass(K key, V value) { - this.key = key; - this.value = value; } public static

long generifiedStaticMethod(P param) { diff --git a/spring-core/src/test/java/org/springframework/util/AssertTests.java b/spring-core/src/test/java/org/springframework/util/AssertTests.java index 2fe76022f0c..59cf2a92613 100644 --- a/spring-core/src/test/java/org/springframework/util/AssertTests.java +++ b/spring-core/src/test/java/org/springframework/util/AssertTests.java @@ -38,7 +38,7 @@ public class AssertTests { @Test(expected = IllegalArgumentException.class) public void instanceOf() { - final Set set = new HashSet(); + final Set set = new HashSet(); Assert.isInstanceOf(HashSet.class, set); Assert.isInstanceOf(HashMap.class, set); } @@ -105,12 +105,12 @@ public class AssertTests { @Test(expected = IllegalArgumentException.class) public void assertNotEmptyWithNullCollectionThrowsException() throws Exception { - Assert.notEmpty((Collection) null); + Assert.notEmpty((Collection) null); } @Test(expected = IllegalArgumentException.class) public void assertNotEmptyWithEmptyCollectionThrowsException() throws Exception { - Assert.notEmpty(new ArrayList()); + Assert.notEmpty(new ArrayList()); } @Test @@ -122,12 +122,12 @@ public class AssertTests { @Test(expected = IllegalArgumentException.class) public void assertNotEmptyWithNullMapThrowsException() throws Exception { - Assert.notEmpty((Map) null); + Assert.notEmpty((Map) null); } @Test(expected = IllegalArgumentException.class) public void assertNotEmptyWithEmptyMapThrowsException() throws Exception { - Assert.notEmpty(new HashMap()); + Assert.notEmpty(new HashMap()); } @Test diff --git a/spring-core/src/test/java/org/springframework/util/AutoPopulatingListTests.java b/spring-core/src/test/java/org/springframework/util/AutoPopulatingListTests.java index cca9da12e61..d7bdd36e41b 100644 --- a/spring-core/src/test/java/org/springframework/util/AutoPopulatingListTests.java +++ b/spring-core/src/test/java/org/springframework/util/AutoPopulatingListTests.java @@ -30,22 +30,22 @@ import org.springframework.beans.TestBean; public class AutoPopulatingListTests extends TestCase { public void testWithClass() throws Exception { - doTestWithClass(new AutoPopulatingList(TestBean.class)); + doTestWithClass(new AutoPopulatingList(TestBean.class)); } public void testWithClassAndUserSuppliedBackingList() throws Exception { - doTestWithClass(new AutoPopulatingList(new LinkedList(), TestBean.class)); + doTestWithClass(new AutoPopulatingList(new LinkedList(), TestBean.class)); } public void testWithElementFactory() throws Exception { - doTestWithElementFactory(new AutoPopulatingList(new MockElementFactory())); + doTestWithElementFactory(new AutoPopulatingList(new MockElementFactory())); } public void testWithElementFactoryAndUserSuppliedBackingList() throws Exception { - doTestWithElementFactory(new AutoPopulatingList(new LinkedList(), new MockElementFactory())); + doTestWithElementFactory(new AutoPopulatingList(new LinkedList(), new MockElementFactory())); } - private void doTestWithClass(AutoPopulatingList list) { + private void doTestWithClass(AutoPopulatingList list) { Object lastElement = null; for (int x = 0; x < 10; x++) { Object element = list.get(x); @@ -66,7 +66,7 @@ public class AutoPopulatingListTests extends TestCase { assertTrue(list.get(20) instanceof TestBean); } - private void doTestWithElementFactory(AutoPopulatingList list) { + private void doTestWithElementFactory(AutoPopulatingList list) { doTestWithClass(list); for(int x = 0; x < list.size(); x++) { @@ -78,7 +78,7 @@ public class AutoPopulatingListTests extends TestCase { } public void testSerialization() throws Exception { - AutoPopulatingList list = new AutoPopulatingList(TestBean.class); + AutoPopulatingList list = new AutoPopulatingList(TestBean.class); Assert.assertEquals(list, SerializationTestUtils.serializeAndDeserialize(list)); } diff --git a/spring-core/src/test/java/org/springframework/util/CollectionUtilsTests.java b/spring-core/src/test/java/org/springframework/util/CollectionUtilsTests.java index 820755a0917..fea68d8ed2c 100644 --- a/spring-core/src/test/java/org/springframework/util/CollectionUtilsTests.java +++ b/spring-core/src/test/java/org/springframework/util/CollectionUtilsTests.java @@ -40,16 +40,16 @@ public class CollectionUtilsTests { @Test public void testIsEmpty() { - assertTrue(CollectionUtils.isEmpty((Set) null)); - assertTrue(CollectionUtils.isEmpty((Map) null)); - assertTrue(CollectionUtils.isEmpty(new HashMap())); - assertTrue(CollectionUtils.isEmpty(new HashSet())); + assertTrue(CollectionUtils.isEmpty((Set) null)); + assertTrue(CollectionUtils.isEmpty((Map) null)); + assertTrue(CollectionUtils.isEmpty(new HashMap())); + assertTrue(CollectionUtils.isEmpty(new HashSet())); - List list = new LinkedList(); + List list = new LinkedList(); list.add(new Object()); assertFalse(CollectionUtils.isEmpty(list)); - Map map = new HashMap(); + Map map = new HashMap(); map.put("foo", "bar"); assertFalse(CollectionUtils.isEmpty(map)); } @@ -57,7 +57,7 @@ public class CollectionUtilsTests { @Test public void testMergeArrayIntoCollection() { Object[] arr = new Object[] {"value1", "value2"}; - List list = new LinkedList(); + List> list = new LinkedList>(); list.add("value3"); CollectionUtils.mergeArrayIntoCollection(arr, list); @@ -69,7 +69,7 @@ public class CollectionUtilsTests { @Test public void testMergePrimitiveArrayIntoCollection() { int[] arr = new int[] {1, 2}; - List list = new LinkedList(); + List> list = new LinkedList>(); list.add(new Integer(3)); CollectionUtils.mergeArrayIntoCollection(arr, list); @@ -86,7 +86,7 @@ public class CollectionUtilsTests { props.setProperty("prop2", "value2"); props.put("prop3", new Integer(3)); - Map map = new HashMap(); + Map map = new HashMap(); map.put("prop4", "value4"); CollectionUtils.mergePropertiesIntoMap(props, map); @@ -98,28 +98,28 @@ public class CollectionUtilsTests { @Test public void testContains() { - assertFalse(CollectionUtils.contains((Iterator) null, "myElement")); - assertFalse(CollectionUtils.contains((Enumeration) null, "myElement")); - assertFalse(CollectionUtils.contains(new LinkedList().iterator(), "myElement")); - assertFalse(CollectionUtils.contains(new Hashtable().keys(), "myElement")); + assertFalse(CollectionUtils.contains((Iterator) null, "myElement")); + assertFalse(CollectionUtils.contains((Enumeration) null, "myElement")); + assertFalse(CollectionUtils.contains(new LinkedList().iterator(), "myElement")); + assertFalse(CollectionUtils.contains(new Hashtable().keys(), "myElement")); - List list = new LinkedList(); + List list = new LinkedList(); list.add("myElement"); assertTrue(CollectionUtils.contains(list.iterator(), "myElement")); - Hashtable ht = new Hashtable(); + Hashtable ht = new Hashtable(); ht.put("myElement", "myValue"); assertTrue(CollectionUtils.contains(ht.keys(), "myElement")); } @Test public void testContainsAny() throws Exception { - List source = new ArrayList(); + List source = new ArrayList(); source.add("abc"); source.add("def"); source.add("ghi"); - List candidates = new ArrayList(); + List candidates = new ArrayList(); candidates.add("xyz"); candidates.add("def"); candidates.add("abc"); @@ -139,7 +139,7 @@ public class CollectionUtilsTests { @Test public void testContainsInstanceWithInstancesThatAreEqualButDistinct() throws Exception { - List list = new ArrayList(); + List list = new ArrayList(); list.add(new Instance("fiona")); assertFalse("Must return false if instance is not in the supplied Collection argument", CollectionUtils.containsInstance(list, new Instance("fiona"))); @@ -147,7 +147,7 @@ public class CollectionUtilsTests { @Test public void testContainsInstanceWithSameInstance() throws Exception { - List list = new ArrayList(); + List list = new ArrayList(); list.add(new Instance("apple")); Instance instance = new Instance("fiona"); list.add(instance); @@ -157,7 +157,7 @@ public class CollectionUtilsTests { @Test public void testContainsInstanceWithNullInstance() throws Exception { - List list = new ArrayList(); + List list = new ArrayList(); list.add(new Instance("apple")); list.add(new Instance("fiona")); assertFalse("Must return false if null instance is supplied", @@ -166,12 +166,12 @@ public class CollectionUtilsTests { @Test public void testFindFirstMatch() throws Exception { - List source = new ArrayList(); + List source = new ArrayList(); source.add("abc"); source.add("def"); source.add("ghi"); - List candidates = new ArrayList(); + List candidates = new ArrayList(); candidates.add("xyz"); candidates.add("def"); candidates.add("abc"); @@ -181,35 +181,35 @@ public class CollectionUtilsTests { @Test public void testHasUniqueObject() { - List list = new LinkedList(); + List list = new LinkedList(); list.add("myElement"); list.add("myOtherElement"); assertFalse(CollectionUtils.hasUniqueObject(list)); - list = new LinkedList(); + list = new LinkedList(); list.add("myElement"); assertTrue(CollectionUtils.hasUniqueObject(list)); - list = new LinkedList(); + list = new LinkedList(); list.add("myElement"); list.add(null); assertFalse(CollectionUtils.hasUniqueObject(list)); - list = new LinkedList(); + list = new LinkedList(); list.add(null); list.add("myElement"); assertFalse(CollectionUtils.hasUniqueObject(list)); - list = new LinkedList(); + list = new LinkedList(); list.add(null); list.add(null); assertTrue(CollectionUtils.hasUniqueObject(list)); - list = new LinkedList(); + list = new LinkedList(); list.add(null); assertTrue(CollectionUtils.hasUniqueObject(list)); - list = new LinkedList(); + list = new LinkedList(); assertFalse(CollectionUtils.hasUniqueObject(list)); } diff --git a/spring-core/src/test/java/org/springframework/util/MethodInvokerTests.java b/spring-core/src/test/java/org/springframework/util/MethodInvokerTests.java index 955d788c746..bb9e5700fee 100644 --- a/spring-core/src/test/java/org/springframework/util/MethodInvokerTests.java +++ b/spring-core/src/test/java/org/springframework/util/MethodInvokerTests.java @@ -43,14 +43,14 @@ public class MethodInvokerTests extends TestCase { mi = new MethodInvoker(); mi.setTargetClass(TestClass1.class); mi.setTargetMethod("supertypes"); - mi.setArguments(new Object[] {new ArrayList(), new ArrayList(), "hello"}); + mi.setArguments(new Object[] {new ArrayList<>(), new ArrayList<>(), "hello"}); mi.prepare(); assertEquals("hello", mi.invoke()); mi = new MethodInvoker(); mi.setTargetClass(TestClass1.class); mi.setTargetMethod("supertypes2"); - mi.setArguments(new Object[] {new ArrayList(), new ArrayList(), "hello", "bogus"}); + mi.setArguments(new Object[] {new ArrayList<>(), new ArrayList<>(), "hello", "bogus"}); mi.prepare(); assertEquals("hello", mi.invoke()); @@ -58,7 +58,7 @@ public class MethodInvokerTests extends TestCase { mi = new MethodInvoker(); mi.setTargetClass(TestClass1.class); mi.setTargetMethod("supertypes2"); - mi.setArguments(new Object[] {new ArrayList(), new ArrayList(), "hello", Boolean.TRUE}); + mi.setArguments(new Object[] {new ArrayList<>(), new ArrayList<>(), "hello", Boolean.TRUE}); try { mi.prepare(); fail("Shouldn't have matched without argument conversion"); @@ -169,23 +169,23 @@ public class MethodInvokerTests extends TestCase { public static void intArguments(int[] arg) { } - public static String supertypes(Collection c, Integer i) { + public static String supertypes(Collection c, Integer i) { return i.toString(); } - public static String supertypes(Collection c, List l, String s) { + public static String supertypes(Collection c, List l, String s) { return s; } - public static String supertypes2(Collection c, List l, Integer i) { + public static String supertypes2(Collection c, List l, Integer i) { return i.toString(); } - public static String supertypes2(Collection c, List l, String s, Integer i) { + public static String supertypes2(Collection c, List l, String s, Integer i) { return s; } - public static String supertypes2(Collection c, List l, String s, String s2) { + public static String supertypes2(Collection c, List l, String s, String s2) { return s; } }