Browse Source

Merge branch 'cleanup-3.2.x' into 3.2.x

* cleanup-3.2.x:
  Fix unnecessary @SupressWarnings annotations
  Fix Javadoc warnings
  Fix unused local variable warnings
  Fix unused type compiler warnings
  Fix 'is already an instance of type' warnings
pull/229/head
Phillip Webb 12 years ago
parent
commit
aac6b913d6
  1. 4
      spring-aop/src/test/java/org/springframework/aop/aspectj/AspectJExpressionPointcutTests.java
  2. 2
      spring-aop/src/test/java/org/springframework/aop/aspectj/TigerAspectJExpressionPointcutTests.java
  3. 20
      spring-aop/src/test/java/org/springframework/aop/aspectj/annotation/AbstractAspectJAdvisorFactoryTests.java
  4. 2
      spring-aop/src/test/java/org/springframework/aop/framework/adapter/ThrowsAdviceInterceptorTests.java
  5. 4
      spring-aop/src/test/java/org/springframework/aop/support/DelegatingIntroductionInterceptorTests.java
  6. 2
      spring-aspects/src/main/java/org/springframework/transaction/aspectj/AbstractTransactionAspect.aj
  7. 14
      spring-aspects/src/test/java/org/springframework/beans/factory/aspectj/AbstractBeanConfigurerTests.java
  8. 4
      spring-beans/src/main/java/org/springframework/beans/ExtendedBeanInfo.java
  9. 4
      spring-beans/src/test/java/org/springframework/beans/BeanUtilsTests.java
  10. 35
      spring-beans/src/test/java/org/springframework/beans/BeanWrapperAutoGrowingTests.java
  11. 3
      spring-beans/src/test/java/org/springframework/beans/BeanWrapperGenericsTests.java
  12. 10
      spring-beans/src/test/java/org/springframework/beans/BeanWrapperTests.java
  13. 3
      spring-beans/src/test/java/org/springframework/beans/ConcurrentBeanWrapperTests.java
  14. 1
      spring-beans/src/test/java/org/springframework/beans/ExtendedBeanInfoTests.java
  15. 5
      spring-beans/src/test/java/org/springframework/beans/factory/DefaultListableBeanFactoryTests.java
  16. 3
      spring-beans/src/test/java/org/springframework/beans/factory/config/CustomScopeConfigurerTests.java
  17. 2
      spring-beans/src/test/java/org/springframework/beans/factory/config/PropertyResourceConfigurerTests.java
  18. 4
      spring-beans/src/test/java/org/springframework/beans/factory/parsing/CustomProblemReporterTests.java
  19. 4
      spring-beans/src/test/java/org/springframework/beans/factory/support/QualifierAnnotationAutowireBeanFactoryTests.java
  20. 9
      spring-beans/src/test/java/org/springframework/beans/factory/support/security/CallbacksSecurityTests.java
  21. 9
      spring-beans/src/test/java/org/springframework/beans/factory/xml/AbstractBeanFactoryTests.java
  22. 2
      spring-beans/src/test/java/org/springframework/beans/factory/xml/FactoryMethods.java
  23. 4
      spring-beans/src/test/java/org/springframework/beans/propertyeditors/CustomCollectionEditorTests.java
  24. 3
      spring-beans/src/test/java/org/springframework/beans/propertyeditors/CustomEditorTests.java
  25. 3
      spring-beans/src/test/java/org/springframework/beans/support/PropertyComparatorTests.java
  26. 1
      spring-context/src/main/java/org/springframework/context/event/SimpleApplicationEventMulticaster.java
  27. 1
      spring-context/src/test/java/example/scannable/FooServiceImpl.java
  28. 3
      spring-context/src/test/java/org/springframework/aop/framework/CglibProxyTests.java
  29. 3
      spring-context/src/test/java/org/springframework/beans/factory/support/InjectAnnotationAutowireContextTests.java
  30. 5
      spring-context/src/test/java/org/springframework/beans/factory/xml/QualifierAnnotationTests.java
  31. 3
      spring-context/src/test/java/org/springframework/beans/factory/xml/XmlBeanFactoryTestTypes.java
  32. 1
      spring-context/src/test/java/org/springframework/context/annotation/AnnotationConfigApplicationContextTests.java
  33. 2
      spring-context/src/test/java/org/springframework/context/annotation/BeanMethodPolymorphismTests.java
  34. 1
      spring-context/src/test/java/org/springframework/context/annotation/CommonAnnotationBeanPostProcessorTests.java
  35. 5
      spring-context/src/test/java/org/springframework/context/annotation/ComponentScanParserBeanDefinitionDefaultsTests.java
  36. 1
      spring-context/src/test/java/org/springframework/context/annotation/configuration/BeanAnnotationAttributePropagationTests.java
  37. 6
      spring-context/src/test/java/org/springframework/context/annotation/configuration/ConfigurationClassProcessingTests.java
  38. 5
      spring-context/src/test/java/org/springframework/context/support/ConversionServiceFactoryBeanTests.java
  39. 1
      spring-context/src/test/java/org/springframework/format/support/FormattingConversionServiceFactoryBeanTests.java
  40. 1
      spring-context/src/test/java/org/springframework/format/support/FormattingConversionServiceTests.java
  41. 1
      spring-context/src/test/java/org/springframework/instrument/classloading/glassfish/GlassFishLoadTimeWeaverTests.java
  42. 4
      spring-context/src/test/java/org/springframework/jmx/JmxTestBean.java
  43. 4
      spring-context/src/test/java/org/springframework/jmx/export/assembler/AbstractJmxAssemblerTests.java
  44. 6
      spring-context/src/test/java/org/springframework/jmx/export/assembler/InterfaceBasedMBeanInfoAssemblerMappedTests.java
  45. 1
      spring-context/src/test/java/org/springframework/scheduling/annotation/EnableAsyncTests.java
  46. 5
      spring-context/src/test/java/org/springframework/scheduling/timer/TimerSupportTests.java
  47. 3
      spring-context/src/test/java/org/springframework/validation/DataBinderTests.java
  48. 3
      spring-core/src/main/java/org/springframework/core/io/support/PathMatchingResourcePatternResolver.java
  49. 10
      spring-core/src/main/java/org/springframework/util/ObjectUtils.java
  50. 3
      spring-core/src/test/java/org/springframework/core/BridgeMethodResolverTests.java
  51. 1
      spring-core/src/test/java/org/springframework/core/convert/support/GenericConversionServiceTests.java
  52. 7
      spring-core/src/test/java/org/springframework/core/enums/LabeledEnumTests.java
  53. 6
      spring-core/src/test/java/org/springframework/core/type/AnnotationTypeFilterTests.java
  54. 4
      spring-core/src/test/java/org/springframework/core/type/AssignableTypeFilterTests.java
  55. 2
      spring-core/src/test/java/org/springframework/core/type/CachingMetadataReaderLeakTest.java
  56. 8
      spring-core/src/test/java/org/springframework/util/ClassUtilsTests.java
  57. 3
      spring-core/src/test/java/org/springframework/util/MethodInvokerTests.java
  58. 6
      spring-core/src/test/java/org/springframework/util/StopWatchTests.java
  59. 8
      spring-expression/src/test/java/org/springframework/expression/spel/MapAccessTests.java
  60. 5
      spring-expression/src/test/java/org/springframework/expression/spel/SpelDocumentationTests.java
  61. 5
      spring-expression/src/test/java/org/springframework/expression/spel/SpelReproTests.java
  62. 12
      spring-jdbc/src/main/java/org/springframework/jdbc/core/metadata/GenericTableMetaDataProvider.java
  63. 6
      spring-jdbc/src/main/java/org/springframework/jdbc/datasource/DataSourceTransactionManager.java
  64. 1
      spring-jdbc/src/main/java/org/springframework/jdbc/datasource/embedded/EmbeddedDatabaseFactory.java
  65. 2
      spring-jdbc/src/test/java/org/springframework/jdbc/core/namedparam/BeanPropertySqlParameterSourceTests.java
  66. 3
      spring-jdbc/src/test/java/org/springframework/jdbc/support/SQLStateExceptionTranslatorTests.java
  67. 8
      spring-jms/src/test/java/org/springframework/jms/core/JmsTemplate102Tests.java
  68. 18
      spring-jms/src/test/java/org/springframework/jms/core/JmsTemplateTests.java
  69. 6
      spring-jms/src/test/java/org/springframework/jms/listener/endpoint/DefaultJmsActivationSpecFactoryTests.java
  70. 1
      spring-orm/src/main/java/org/springframework/orm/jdo/JdoTemplate.java
  71. 1
      spring-orm/src/test/java/org/springframework/orm/jdo/JdoInterceptorTests.java
  72. 3
      spring-orm/src/test/java/org/springframework/orm/jpa/ApplicationManagedEntityManagerIntegrationTests.java
  73. 1
      spring-orm/src/test/java/org/springframework/orm/jpa/JpaInterceptorTests.java
  74. 4
      spring-oxm/src/test/java/org/springframework/oxm/jaxb/Jaxb2MarshallerTests.java
  75. 1
      spring-test-mvc/src/main/java/org/springframework/test/web/servlet/result/FlashAttributeResultMatchers.java
  76. 4
      spring-test/src/main/java/org/springframework/test/jpa/AbstractJpaTests.java
  77. 2
      spring-tx/src/test/java/org/springframework/transaction/interceptor/AbstractTransactionAspectTests.java
  78. 3
      spring-tx/src/test/java/org/springframework/transaction/interceptor/BeanFactoryTransactionTests.java
  79. 4
      spring-web/src/main/java/org/springframework/web/util/UriTemplate.java
  80. 4
      spring-web/src/test/java/org/springframework/http/client/StreamingSimpleHttpRequestFactoryTests.java
  81. 1
      spring-web/src/test/java/org/springframework/http/converter/FormHttpMessageConverterTests.java
  82. 6
      spring-web/src/test/java/org/springframework/web/method/annotation/InitBinderDataBinderFactoryTests.java
  83. 3
      spring-web/src/test/java/org/springframework/web/method/annotation/ModelAttributeMethodProcessorTests.java
  84. 10
      spring-web/src/test/java/org/springframework/web/multipart/commons/CommonsMultipartResolverTests.java
  85. 2
      spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/annotation/ResponseStatusExceptionResolverTests.java
  86. 24
      spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/annotation/ServletAnnotationControllerTests.java
  87. 5
      spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/multiaction/MultiActionControllerTests.java
  88. 7
      spring-webmvc/src/test/java/org/springframework/web/servlet/tags/UrlTagTests.java
  89. 8
      spring-webmvc/src/test/java/org/springframework/web/servlet/view/ResourceBundleViewResolverTests.java
  90. 7
      spring-webmvc/src/test/java/org/springframework/web/servlet/view/freemarker/FreeMarkerConfigurerTests.java
  91. 19
      spring-webmvc/src/test/java/org/springframework/web/servlet/view/velocity/VelocityConfigurerTests.java
  92. 2
      src/test/java/org/springframework/aop/config/AopNamespaceHandlerScopeIntegrationTests.java
  93. 2
      src/test/java/org/springframework/aop/framework/autoproxy/AdvisorAutoProxyCreatorIntegrationTests.java
  94. 3
      src/test/java/org/springframework/context/annotation/jsr330/ClassPathBeanDefinitionScannerJsr330ScopeIntegrationTests.java

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

@ -309,10 +309,6 @@ public final class AspectJExpressionPointcutTests { @@ -309,10 +309,6 @@ public final class AspectJExpressionPointcutTests {
assertTrue("Expression should match TestBean class", classFilter.matches(TestBean.class));
}
private void assertDoesNotMatchStringClass(ClassFilter classFilter) {
assertFalse("Expression should not match String class", classFilter.matches(String.class));
}
@Test
public void testWithUnsupportedPointcutPrimitive() throws Exception {
String expression = "call(int org.springframework.tests.sample.beans.TestBean.getAge())";

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

@ -89,6 +89,8 @@ public final class TigerAspectJExpressionPointcutTests { @@ -89,6 +89,8 @@ public final class TigerAspectJExpressionPointcutTests {
@Test
public void testMatchVarargs() throws SecurityException, NoSuchMethodException {
@SuppressWarnings("unused")
class MyTemplate {
public int queryForInt(String sql, Object... params) {
return 0;

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

@ -15,7 +15,14 @@ @@ -15,7 +15,14 @@
*/
package org.springframework.aop.aspectj.annotation;
import static org.junit.Assert.*;
import static org.hamcrest.Matchers.instanceOf;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotSame;
import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import java.io.FileNotFoundException;
import java.lang.annotation.Retention;
@ -39,9 +46,7 @@ import org.aspectj.lang.annotation.DeclareParents; @@ -39,9 +46,7 @@ import org.aspectj.lang.annotation.DeclareParents;
import org.aspectj.lang.annotation.DeclarePrecedence;
import org.aspectj.lang.annotation.Pointcut;
import org.aspectj.lang.reflect.MethodSignature;
import org.junit.Test;
import org.springframework.aop.Advisor;
import org.springframework.aop.aspectj.annotation.ReflectiveAspectJAdvisorFactory.SyntheticInstantiationAdvisor;
import org.springframework.aop.framework.Advised;
@ -52,14 +57,14 @@ import org.springframework.aop.support.AopUtils; @@ -52,14 +57,14 @@ import org.springframework.aop.support.AopUtils;
import org.springframework.core.OrderComparator;
import org.springframework.core.Ordered;
import org.springframework.core.annotation.Order;
import org.springframework.tests.sample.beans.ITestBean;
import org.springframework.tests.sample.beans.TestBean;
import org.springframework.util.ObjectUtils;
import test.aop.DefaultLockable;
import test.aop.Lockable;
import test.aop.PerTargetAspect;
import test.aop.TwoAdviceAspect;
import org.springframework.tests.sample.beans.ITestBean;
import org.springframework.tests.sample.beans.TestBean;
/**
* Abstract tests for AspectJAdvisorFactory.
@ -385,7 +390,7 @@ public abstract class AbstractAspectJAdvisorFactoryTests { @@ -385,7 +390,7 @@ public abstract class AbstractAspectJAdvisorFactoryTests {
CannotBeUnlocked.class
),
CannotBeUnlocked.class);
assertTrue(proxy instanceof Lockable);
assertThat(proxy, instanceOf(Lockable.class));
Lockable lockable = proxy;
assertTrue("Already locked", lockable.locked());
lockable.lock();
@ -399,7 +404,6 @@ public abstract class AbstractAspectJAdvisorFactoryTests { @@ -399,7 +404,6 @@ public abstract class AbstractAspectJAdvisorFactoryTests {
}
}
@SuppressWarnings("unchecked")
@Test
public void testIntroductionOnTargetExcludedByTypePattern() {
LinkedList target = new LinkedList();
@ -442,7 +446,7 @@ public abstract class AbstractAspectJAdvisorFactoryTests { @@ -442,7 +446,7 @@ public abstract class AbstractAspectJAdvisorFactoryTests {
Modifiable modifiable = (Modifiable) createProxy(target,
advisors,
ITestBean.class);
assertTrue(modifiable instanceof Modifiable);
assertThat(modifiable, instanceOf(Modifiable.class));
Lockable lockable = (Lockable) modifiable;
assertFalse(lockable.locked());

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

@ -144,7 +144,7 @@ public final class ThrowsAdviceInterceptorTests { @@ -144,7 +144,7 @@ public final class ThrowsAdviceInterceptorTests {
}
@SuppressWarnings("serial")
private static class MyThrowsHandler extends MethodCounter implements ThrowsAdvice {
static class MyThrowsHandler extends MethodCounter implements ThrowsAdvice {
// Full method signature
public void afterThrowing(Method m, Object[] args, Object target, IOException ex) {
count("ioException");

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

@ -16,8 +16,10 @@ @@ -16,8 +16,10 @@
package org.springframework.aop.support;
import static org.hamcrest.Matchers.instanceOf;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
import static org.mockito.BDDMockito.given;
import static org.mockito.Mockito.mock;
@ -157,7 +159,7 @@ public final class DelegatingIntroductionInterceptorTests { @@ -157,7 +159,7 @@ public final class DelegatingIntroductionInterceptorTests {
//assertTrue(Arrays.binarySearch(pf.getProxiedInterfaces(), TimeStamped.class) != -1);
TimeStamped ts = (TimeStamped) pf.getProxy();
assertTrue(ts instanceof TimeStamped);
assertThat(ts, instanceOf(TimeStamped.class));
// Shoulnd't proxy framework interfaces
assertTrue(!(ts instanceof MethodInterceptor));
assertTrue(!(ts instanceof IntroductionInterceptor));

2
spring-aspects/src/main/java/org/springframework/transaction/aspectj/AbstractTransactionAspect.aj

@ -60,7 +60,7 @@ public abstract aspect AbstractTransactionAspect extends TransactionAspectSuppor @@ -60,7 +60,7 @@ public abstract aspect AbstractTransactionAspect extends TransactionAspectSuppor
before(Object txObject) : transactionalMethodExecution(txObject) {
MethodSignature methodSignature = (MethodSignature) thisJoinPoint.getSignature();
Method method = methodSignature.getMethod();
TransactionInfo txInfo = createTransactionIfNecessary(method, txObject.getClass());
createTransactionIfNecessary(method, txObject.getClass());
}
@SuppressAjWarnings("adviceDidNotMatch")

14
spring-aspects/src/test/java/org/springframework/beans/factory/aspectj/AbstractBeanConfigurerTests.java

@ -211,6 +211,7 @@ public abstract class AbstractBeanConfigurerTests extends TestCase { @@ -211,6 +211,7 @@ public abstract class AbstractBeanConfigurerTests extends TestCase {
MailClientDependencyInjectionAspect.aspectOf().setMailSender(new JavaMailSenderImpl());
Order testOrder = new Order();
Order deserializedOrder = serializeAndDeserialize(testOrder);
assertNotNull(deserializedOrder);
assertNotNull("Interface driven injection didn't occur for deserialization", testOrder.mailSender);
}
@ -304,7 +305,7 @@ public abstract class AbstractBeanConfigurerTests extends TestCase { @@ -304,7 +305,7 @@ public abstract class AbstractBeanConfigurerTests extends TestCase {
// }
// }
@SuppressWarnings("unused")
private static class ShouldNotBeConfiguredBySpring {
private String name;
@ -335,6 +336,7 @@ public abstract class AbstractBeanConfigurerTests extends TestCase { @@ -335,6 +336,7 @@ public abstract class AbstractBeanConfigurerTests extends TestCase {
@Configurable
@SuppressWarnings("unused")
private static class ShouldBeConfiguredBySpringUsingTypeNameAsBeanName {
private String name;
@ -350,6 +352,7 @@ public abstract class AbstractBeanConfigurerTests extends TestCase { @@ -350,6 +352,7 @@ public abstract class AbstractBeanConfigurerTests extends TestCase {
@Configurable(autowire=Autowire.BY_TYPE)
@SuppressWarnings("unused")
private static class ShouldBeConfiguredBySpringUsingAutowireByType {
private TestBean friend = null;
@ -365,6 +368,7 @@ public abstract class AbstractBeanConfigurerTests extends TestCase { @@ -365,6 +368,7 @@ public abstract class AbstractBeanConfigurerTests extends TestCase {
@Configurable(autowire=Autowire.BY_NAME)
@SuppressWarnings("unused")
private static class ValidAutowireByName {
private TestBean friend = null;
@ -380,6 +384,7 @@ public abstract class AbstractBeanConfigurerTests extends TestCase { @@ -380,6 +384,7 @@ public abstract class AbstractBeanConfigurerTests extends TestCase {
@Configurable(autowire=Autowire.BY_NAME, dependencyCheck=true)
@SuppressWarnings("unused")
private static class InvalidAutowireByName {
private TestBean friend;
@ -393,7 +398,7 @@ public abstract class AbstractBeanConfigurerTests extends TestCase { @@ -393,7 +398,7 @@ public abstract class AbstractBeanConfigurerTests extends TestCase {
}
}
@SuppressWarnings("unused")
private static class ArbitraryExistingPojo {
private TestBean friend;
@ -426,6 +431,7 @@ public abstract class AbstractBeanConfigurerTests extends TestCase { @@ -426,6 +431,7 @@ public abstract class AbstractBeanConfigurerTests extends TestCase {
@Configurable
@SuppressWarnings("unused")
private static class BaseBean {
public int setterCount;
@ -447,7 +453,7 @@ public abstract class AbstractBeanConfigurerTests extends TestCase { @@ -447,7 +453,7 @@ public abstract class AbstractBeanConfigurerTests extends TestCase {
}
@Configurable
@SuppressWarnings("serial")
@SuppressWarnings({"serial", "unused"})
private static class BaseSerializableBean implements Serializable {
public int setterCount;
@ -467,6 +473,7 @@ public abstract class AbstractBeanConfigurerTests extends TestCase { @@ -467,6 +473,7 @@ public abstract class AbstractBeanConfigurerTests extends TestCase {
@Aspect
@SuppressWarnings("unused")
private static class WireArbitraryExistingPojo extends AbstractBeanConfigurerAspect {
@Pointcut("initialization(ArbitraryExistingPojo.new(..)) && this(beanInstance)")
@ -477,6 +484,7 @@ public abstract class AbstractBeanConfigurerTests extends TestCase { @@ -477,6 +484,7 @@ public abstract class AbstractBeanConfigurerTests extends TestCase {
@Aspect
@SuppressWarnings("unused")
private static class AspectThatWillNotBeUsed extends AbstractBeanConfigurerAspect {
@Pointcut("initialization(ClassThatWillNotActuallyBeWired.new(..)) && this(beanInstance)")

4
spring-beans/src/main/java/org/springframework/beans/ExtendedBeanInfo.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2012 the original author or authors.
* Copyright 2002-2013 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -56,7 +56,7 @@ import static org.springframework.beans.PropertyDescriptorUtils.*; @@ -56,7 +56,7 @@ import static org.springframework.beans.PropertyDescriptorUtils.*;
* this.foo = foo;
* return this;
* }
* }</pre>
* }}</pre>
* The standard JavaBeans {@code Introspector} will discover the {@code getFoo} read
* method, but will bypass the {@code #setFoo(Foo)} write method, because its non-void
* returning signature does not comply with the JavaBeans specification.

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

@ -267,6 +267,7 @@ public final class BeanUtilsTests { @@ -267,6 +267,7 @@ public final class BeanUtilsTests {
}
@SuppressWarnings("unused")
private static class NameAndSpecialProperty {
private String name;
@ -291,6 +292,7 @@ public final class BeanUtilsTests { @@ -291,6 +292,7 @@ public final class BeanUtilsTests {
}
@SuppressWarnings("unused")
private static class ContainerBean {
private ContainedBean[] containedBeans;
@ -305,6 +307,7 @@ public final class BeanUtilsTests { @@ -305,6 +307,7 @@ public final class BeanUtilsTests {
}
@SuppressWarnings("unused")
private static class ContainedBean {
private String name;
@ -319,6 +322,7 @@ public final class BeanUtilsTests { @@ -319,6 +322,7 @@ public final class BeanUtilsTests {
}
@SuppressWarnings("unused")
private static class MethodSignatureBean {
public void doSomething() {

35
spring-beans/src/test/java/org/springframework/beans/BeanWrapperAutoGrowingTests.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2012 the original author or authors.
* Copyright 2002-2013 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -22,6 +22,7 @@ import java.util.Map; @@ -22,6 +22,7 @@ import java.util.Map;
import org.junit.Before;
import org.junit.Test;
import static org.hamcrest.Matchers.instanceOf;
import static org.junit.Assert.*;
/**
@ -59,7 +60,7 @@ public class BeanWrapperAutoGrowingTests { @@ -59,7 +60,7 @@ public class BeanWrapperAutoGrowingTests {
public void getPropertyValueAutoGrowArray() {
assertNotNull(wrapper.getPropertyValue("array[0]"));
assertEquals(1, bean.getArray().length);
assertTrue(bean.getArray()[0] instanceof Bean);
assertThat(bean.getArray()[0], instanceOf(Bean.class));
}
@Test
@ -72,11 +73,11 @@ public class BeanWrapperAutoGrowingTests { @@ -72,11 +73,11 @@ public class BeanWrapperAutoGrowingTests {
public void getPropertyValueAutoGrowArrayBySeveralElements() {
assertNotNull(wrapper.getPropertyValue("array[4]"));
assertEquals(5, bean.getArray().length);
assertTrue(bean.getArray()[0] instanceof Bean);
assertTrue(bean.getArray()[1] instanceof Bean);
assertTrue(bean.getArray()[2] instanceof Bean);
assertTrue(bean.getArray()[3] instanceof Bean);
assertTrue(bean.getArray()[4] instanceof Bean);
assertThat(bean.getArray()[0], instanceOf(Bean.class));
assertThat(bean.getArray()[1], instanceOf(Bean.class));
assertThat(bean.getArray()[2], instanceOf(Bean.class));
assertThat(bean.getArray()[3], instanceOf(Bean.class));
assertThat(bean.getArray()[4], instanceOf(Bean.class));
assertNotNull(wrapper.getPropertyValue("array[0]"));
assertNotNull(wrapper.getPropertyValue("array[1]"));
assertNotNull(wrapper.getPropertyValue("array[2]"));
@ -87,14 +88,14 @@ public class BeanWrapperAutoGrowingTests { @@ -87,14 +88,14 @@ public class BeanWrapperAutoGrowingTests {
public void getPropertyValueAutoGrowMultiDimensionalArray() {
assertNotNull(wrapper.getPropertyValue("multiArray[0][0]"));
assertEquals(1, bean.getMultiArray()[0].length);
assertTrue(bean.getMultiArray()[0][0] instanceof Bean);
assertThat(bean.getMultiArray()[0][0], instanceOf(Bean.class));
}
@Test
public void getPropertyValueAutoGrowList() {
assertNotNull(wrapper.getPropertyValue("list[0]"));
assertEquals(1, bean.getList().size());
assertTrue(bean.getList().get(0) instanceof Bean);
assertThat(bean.getList().get(0), instanceOf(Bean.class));
}
@Test
@ -107,11 +108,11 @@ public class BeanWrapperAutoGrowingTests { @@ -107,11 +108,11 @@ public class BeanWrapperAutoGrowingTests {
public void getPropertyValueAutoGrowListBySeveralElements() {
assertNotNull(wrapper.getPropertyValue("list[4]"));
assertEquals(5, bean.getList().size());
assertTrue(bean.getList().get(0) instanceof Bean);
assertTrue(bean.getList().get(1) instanceof Bean);
assertTrue(bean.getList().get(2) instanceof Bean);
assertTrue(bean.getList().get(3) instanceof Bean);
assertTrue(bean.getList().get(4) instanceof Bean);
assertThat(bean.getList().get(0), instanceOf(Bean.class));
assertThat(bean.getList().get(1), instanceOf(Bean.class));
assertThat(bean.getList().get(2), instanceOf(Bean.class));
assertThat(bean.getList().get(3), instanceOf(Bean.class));
assertThat(bean.getList().get(4), instanceOf(Bean.class));
assertNotNull(wrapper.getPropertyValue("list[0]"));
assertNotNull(wrapper.getPropertyValue("list[1]"));
assertNotNull(wrapper.getPropertyValue("list[2]"));
@ -135,7 +136,7 @@ public class BeanWrapperAutoGrowingTests { @@ -135,7 +136,7 @@ public class BeanWrapperAutoGrowingTests {
public void getPropertyValueAutoGrowMultiDimensionalList() {
assertNotNull(wrapper.getPropertyValue("multiList[0][0]"));
assertEquals(1, bean.getMultiList().get(0).size());
assertTrue(bean.getMultiList().get(0).get(0) instanceof Bean);
assertThat(bean.getMultiList().get(0).get(0), instanceOf(Bean.class));
}
@Test(expected=InvalidPropertyException.class)
@ -146,13 +147,13 @@ public class BeanWrapperAutoGrowingTests { @@ -146,13 +147,13 @@ public class BeanWrapperAutoGrowingTests {
@Test
public void setPropertyValueAutoGrowMap() {
wrapper.setPropertyValue("map[A]", new Bean());
assertTrue(bean.getMap().get("A") instanceof Bean);
assertThat(bean.getMap().get("A"), instanceOf(Bean.class));
}
@Test
public void setNestedPropertyValueAutoGrowMap() {
wrapper.setPropertyValue("map[A].nested", new Bean());
assertTrue(bean.getMap().get("A").getNested() instanceof Bean);
assertThat(bean.getMap().get("A").getNested(), instanceOf(Bean.class));
}

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

@ -157,7 +157,6 @@ public class BeanWrapperGenericsTests { @@ -157,7 +157,6 @@ public class BeanWrapperGenericsTests {
GenericBean<?> gb = new GenericBean<Object>();
BeanWrapper bw = new BeanWrapperImpl(gb);
bw.registerCustomEditor(Number.class, new CustomNumberEditor(Integer.class, false));
@SuppressWarnings("unchecked")
Map<String, Collection> input = new HashMap<String, Collection>();
HashSet<Integer> value1 = new HashSet<Integer>();
value1.add(new Integer(1));
@ -497,6 +496,7 @@ public class BeanWrapperGenericsTests { @@ -497,6 +496,7 @@ public class BeanWrapperGenericsTests {
}
@SuppressWarnings("unused")
private static class NestedGenericCollectionBean extends BaseGenericCollectionBean {
private Map<String, Integer> mapOfInteger;
@ -544,6 +544,7 @@ public class BeanWrapperGenericsTests { @@ -544,6 +544,7 @@ public class BeanWrapperGenericsTests {
}
@SuppressWarnings("unused")
private static class ComplexMapHolder {
private Map<List<Integer>, List<Long>> genericMap;

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

@ -1569,6 +1569,7 @@ public final class BeanWrapperTests { @@ -1569,6 +1569,7 @@ public final class BeanWrapperTests {
}
@SuppressWarnings("unused")
private static class Foo {
private List list;
@ -1598,6 +1599,7 @@ public final class BeanWrapperTests { @@ -1598,6 +1599,7 @@ public final class BeanWrapperTests {
}
@SuppressWarnings("unused")
private static class NoRead {
public void setAge(int age) {
@ -1605,6 +1607,7 @@ public final class BeanWrapperTests { @@ -1605,6 +1607,7 @@ public final class BeanWrapperTests {
}
@SuppressWarnings("unused")
private static class EnumTester {
private Autowire autowire;
@ -1619,6 +1622,7 @@ public final class BeanWrapperTests { @@ -1619,6 +1622,7 @@ public final class BeanWrapperTests {
}
@SuppressWarnings("unused")
private static class PropsTester {
private Properties props;
@ -1647,6 +1651,7 @@ public final class BeanWrapperTests { @@ -1647,6 +1651,7 @@ public final class BeanWrapperTests {
}
@SuppressWarnings("unused")
private static class GetterBean {
private String name;
@ -1664,6 +1669,7 @@ public final class BeanWrapperTests { @@ -1664,6 +1669,7 @@ public final class BeanWrapperTests {
}
@SuppressWarnings("unused")
private static class ThrowsException {
public void doSomething(Throwable t) throws Throwable {
@ -1672,6 +1678,7 @@ public final class BeanWrapperTests { @@ -1672,6 +1678,7 @@ public final class BeanWrapperTests {
}
@SuppressWarnings("unused")
private static class PrimitiveArrayBean {
private int[] array;
@ -1686,6 +1693,7 @@ public final class BeanWrapperTests { @@ -1686,6 +1693,7 @@ public final class BeanWrapperTests {
}
@SuppressWarnings("unused")
private static class NumberPropertyBean {
private byte myPrimitiveByte;
@ -1804,6 +1812,7 @@ public final class BeanWrapperTests { @@ -1804,6 +1812,7 @@ public final class BeanWrapperTests {
}
@SuppressWarnings("unused")
private static class IntelliBean {
public void setName(String name) {}
@ -1818,6 +1827,7 @@ public final class BeanWrapperTests { @@ -1818,6 +1827,7 @@ public final class BeanWrapperTests {
}
@SuppressWarnings("unused")
private static class Employee extends TestBean {
private String co;

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

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2012 the original author or authors.
* Copyright 2002-2013 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -135,6 +135,7 @@ public final class ConcurrentBeanWrapperTests { @@ -135,6 +135,7 @@ public final class ConcurrentBeanWrapperTests {
}
@SuppressWarnings("unused")
private static class TestBean {
private Properties properties;

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

@ -974,7 +974,6 @@ public class ExtendedBeanInfoTests { @@ -974,7 +974,6 @@ public class ExtendedBeanInfoTests {
}
static class WithStaticWriteMethod {
@SuppressWarnings("unused")
public static void setProp1(String prop1) {
}
}

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

@ -2200,7 +2200,6 @@ public class DefaultListableBeanFactoryTests { @@ -2200,7 +2200,6 @@ public class DefaultListableBeanFactoryTests {
doTestFieldSettingWithInstantiationAwarePostProcessor(true);
}
@SuppressWarnings("unchecked")
private void doTestFieldSettingWithInstantiationAwarePostProcessor(final boolean skipPropertyPopulation) {
DefaultListableBeanFactory lbf = new DefaultListableBeanFactory();
RootBeanDefinition bd = new RootBeanDefinition(TestBean.class);
@ -2334,6 +2333,7 @@ public class DefaultListableBeanFactoryTests { @@ -2334,6 +2333,7 @@ public class DefaultListableBeanFactoryTests {
this.spouse = spouse;
}
@SuppressWarnings("unused")
private ConstructorDependency(TestBean spouse, TestBean otherSpouse) {
throw new IllegalArgumentException("Should never be called");
}
@ -2560,6 +2560,7 @@ public class DefaultListableBeanFactoryTests { @@ -2560,6 +2560,7 @@ public class DefaultListableBeanFactoryTests {
/**
* Bean with a dependency on a {@link FactoryBean}.
*/
@SuppressWarnings("unused")
private static class FactoryBeanDependentBean {
private FactoryBean<?> factoryBean;
@ -2646,6 +2647,7 @@ public class DefaultListableBeanFactoryTests { @@ -2646,6 +2647,7 @@ public class DefaultListableBeanFactoryTests {
}
@SuppressWarnings("unused")
private static class TestSecuredBean {
private String userName;
@ -2675,6 +2677,7 @@ public class DefaultListableBeanFactoryTests { @@ -2675,6 +2677,7 @@ public class DefaultListableBeanFactoryTests {
}
}
@SuppressWarnings("unused")
private static class KnowsIfInstantiated {
private static boolean instantiated;

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

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2012 the original author or authors.
* Copyright 2002-2013 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -45,7 +45,6 @@ public final class CustomScopeConfigurerTests { @@ -45,7 +45,6 @@ public final class CustomScopeConfigurerTests {
@Test
public void testWithNoScopes() throws Exception {
Scope scope = mock(Scope.class);
CustomScopeConfigurer figurer = new CustomScopeConfigurer();
figurer.postProcessBeanFactory(factory);
}

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

@ -17,6 +17,7 @@ @@ -17,6 +17,7 @@
package org.springframework.beans.factory.config;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertTrue;
@ -644,6 +645,7 @@ public final class PropertyResourceConfigurerTests { @@ -644,6 +645,7 @@ public final class PropertyResourceConfigurerTests {
ppc.postProcessBeanFactory(factory);
TestBean tb = (TestBean) factory.getBean("tb");
assertNotNull(tb);
assertEquals(0, factory.getAliases("tb").length);
}

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

@ -91,10 +91,6 @@ public final class CustomProblemReporterTests { @@ -91,10 +91,6 @@ public final class CustomProblemReporterTests {
System.out.println(problem);
this.warnings.add(problem);
}
public Problem[] getWarnings() {
return this.warnings.toArray(new Problem[this.warnings.size()]);
}
}
}

4
spring-beans/src/test/java/org/springframework/beans/factory/support/QualifierAnnotationAutowireBeanFactoryTests.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2012 the original author or authors.
* Copyright 2002-2013 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -208,6 +208,7 @@ public class QualifierAnnotationAutowireBeanFactoryTests { @@ -208,6 +208,7 @@ public class QualifierAnnotationAutowireBeanFactoryTests {
}
@SuppressWarnings("unused")
private static class QualifiedTestBean {
@TestQualifier
@ -226,6 +227,7 @@ public class QualifierAnnotationAutowireBeanFactoryTests { @@ -226,6 +227,7 @@ public class QualifierAnnotationAutowireBeanFactoryTests {
}
@SuppressWarnings("unused")
private static class Person {
private String name;

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

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2012 the original author or authors.
* Copyright 2002-2013 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -75,6 +75,7 @@ public class CallbacksSecurityTests { @@ -75,6 +75,7 @@ public class CallbacksSecurityTests {
private DefaultListableBeanFactory beanFactory;
private SecurityContextProvider provider;
@SuppressWarnings("unused")
private static class NonPrivilegedBean {
private String expectedName;
@ -117,6 +118,7 @@ public class CallbacksSecurityTests { @@ -117,6 +118,7 @@ public class CallbacksSecurityTests {
}
}
@SuppressWarnings("unused")
private static class NonPrivilegedSpringCallbacksBean implements
InitializingBean, DisposableBean, BeanClassLoaderAware,
BeanFactoryAware, BeanNameAware {
@ -161,6 +163,7 @@ public class CallbacksSecurityTests { @@ -161,6 +163,7 @@ public class CallbacksSecurityTests {
}
}
@SuppressWarnings("unused")
private static class NonPrivilegedFactoryBean implements SmartFactoryBean {
private String expectedName;
@ -204,6 +207,7 @@ public class CallbacksSecurityTests { @@ -204,6 +207,7 @@ public class CallbacksSecurityTests {
}
}
@SuppressWarnings("unused")
private static class NonPrivilegedFactory {
private final String expectedName;
@ -511,8 +515,7 @@ public class CallbacksSecurityTests { @@ -511,8 +515,7 @@ public class CallbacksSecurityTests {
perms.add(new AuthPermission("getSubject"));
ProtectionDomain pd = new ProtectionDomain(null, perms);
AccessControlContext acc = new AccessControlContext(
new ProtectionDomain[] { pd });
new AccessControlContext(new ProtectionDomain[] { pd });
final Subject subject = new Subject();
subject.getPrincipals().add(new TestPrincipal("user1"));

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

@ -121,7 +121,7 @@ public abstract class AbstractBeanFactoryTests extends TestCase { @@ -121,7 +121,7 @@ public abstract class AbstractBeanFactoryTests extends TestCase {
public void testGetInstanceByNonmatchingClass() {
try {
Object o = getBeanFactory().getBean("rod", BeanFactory.class);
getBeanFactory().getBean("rod", BeanFactory.class);
fail("Rod bean is not of type BeanFactory; getBeanInstance(rod, BeanFactory.class) should throw BeanNotOfRequiredTypeException");
}
catch (BeanNotOfRequiredTypeException ex) {
@ -155,7 +155,7 @@ public abstract class AbstractBeanFactoryTests extends TestCase { @@ -155,7 +155,7 @@ public abstract class AbstractBeanFactoryTests extends TestCase {
public void testGetSharedInstanceByNonmatchingClass() {
try {
Object o = getBeanFactory().getBean("rod", BeanFactory.class);
getBeanFactory().getBean("rod", BeanFactory.class);
fail("Rod bean is not of type BeanFactory; getBeanInstance(rod, BeanFactory.class) should throw BeanNotOfRequiredTypeException");
}
catch (BeanNotOfRequiredTypeException ex) {
@ -199,7 +199,7 @@ public abstract class AbstractBeanFactoryTests extends TestCase { @@ -199,7 +199,7 @@ public abstract class AbstractBeanFactoryTests extends TestCase {
public void testNotThere() {
assertFalse(getBeanFactory().containsBean("Mr Squiggle"));
try {
Object o = getBeanFactory().getBean("Mr Squiggle");
getBeanFactory().getBean("Mr Squiggle");
fail("Can't find missing bean");
}
catch (BeansException ex) {
@ -223,7 +223,7 @@ public abstract class AbstractBeanFactoryTests extends TestCase { @@ -223,7 +223,7 @@ public abstract class AbstractBeanFactoryTests extends TestCase {
public void xtestTypeMismatch() {
try {
Object o = getBeanFactory().getBean("typeMismatch");
getBeanFactory().getBean("typeMismatch");
fail("Shouldn't succeed with type mismatch");
}
catch (BeanCreationException wex) {
@ -278,6 +278,7 @@ public abstract class AbstractBeanFactoryTests extends TestCase { @@ -278,6 +278,7 @@ public abstract class AbstractBeanFactoryTests extends TestCase {
*/
public void testFactoryIsInitialized() throws Exception {
TestBean tb = (TestBean) getBeanFactory().getBean("singletonFactory");
assertNotNull(tb);
DummyFactory factory = (DummyFactory) getBeanFactory().getBean("&singletonFactory");
assertTrue("Factory was initialized because it implemented InitializingBean", factory.wasInitialized());
}

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

@ -62,6 +62,7 @@ public class FactoryMethods { @@ -62,6 +62,7 @@ public class FactoryMethods {
return new FactoryMethods(tb, null, num);
}
@SuppressWarnings("unused")
private static List listInstance() {
return Collections.EMPTY_LIST;
}
@ -99,6 +100,7 @@ public class FactoryMethods { @@ -99,6 +100,7 @@ public class FactoryMethods {
return this.tb;
}
@SuppressWarnings("unused")
private TestBean privateGetTestBean() {
return this.tb;
}

4
spring-beans/src/test/java/org/springframework/beans/propertyeditors/CustomCollectionEditorTests.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2006 the original author or authors.
* Copyright 2002-2013 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -85,7 +85,7 @@ public final class CustomCollectionEditorTests { @@ -85,7 +85,7 @@ public final class CustomCollectionEditorTests {
}
@SuppressWarnings("serial")
@SuppressWarnings({ "serial", "unused" })
private static final class CollectionTypeWithNoNoArgCtor extends ArrayList<Object> {
public CollectionTypeWithNoNoArgCtor(String anArg) {
}

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

@ -1506,6 +1506,7 @@ public class CustomEditorTests { @@ -1506,6 +1506,7 @@ public class CustomEditorTests {
}
@SuppressWarnings("unused")
private static class PrimitiveArrayBean {
private byte[] byteArray;
@ -1530,6 +1531,7 @@ public class CustomEditorTests { @@ -1530,6 +1531,7 @@ public class CustomEditorTests {
}
@SuppressWarnings("unused")
private static class CharBean {
private char myChar;
@ -1554,6 +1556,7 @@ public class CustomEditorTests { @@ -1554,6 +1556,7 @@ public class CustomEditorTests {
}
@SuppressWarnings("unused")
private static class OldCollectionsBean {
private Vector<?> vector;

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

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2012 the original author or authors.
* Copyright 2002-2013 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -96,6 +96,7 @@ public class PropertyComparatorTests { @@ -96,6 +96,7 @@ public class PropertyComparatorTests {
}
@SuppressWarnings("unused")
private static class Dog implements Comparable<Object> {
private String nickName;

1
spring-context/src/main/java/org/springframework/context/event/SimpleApplicationEventMulticaster.java

@ -87,7 +87,6 @@ public class SimpleApplicationEventMulticaster extends AbstractApplicationEventM @@ -87,7 +87,6 @@ public class SimpleApplicationEventMulticaster extends AbstractApplicationEventM
Executor executor = getTaskExecutor();
if (executor != null) {
executor.execute(new Runnable() {
@SuppressWarnings("unchecked")
public void run() {
listener.onApplicationEvent(event);
}

1
spring-context/src/test/java/example/scannable/FooServiceImpl.java

@ -65,7 +65,6 @@ public class FooServiceImpl implements FooService { @@ -65,7 +65,6 @@ public class FooServiceImpl implements FooService {
private boolean initCalled = false;
@SuppressWarnings("unused")
@PostConstruct
private void init() {
if (this.initCalled) {

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

@ -137,10 +137,13 @@ public final class CglibProxyTests extends AbstractAopProxyTests implements Seri @@ -137,10 +137,13 @@ public final class CglibProxyTests extends AbstractAopProxyTests implements Seri
@Test
public void testCglibProxyingGivesMeaningfulExceptionIfAskedToProxyNonvisibleClass() {
@SuppressWarnings("unused")
class YouCantSeeThis {
void hidden() {
}
}
YouCantSeeThis mine = new YouCantSeeThis();
try {
ProxyFactory pf = new ProxyFactory(mine);

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

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2012 the original author or authors.
* Copyright 2002-2013 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -608,6 +608,7 @@ public class InjectAnnotationAutowireContextTests { @@ -608,6 +608,7 @@ public class InjectAnnotationAutowireContextTests {
}
@SuppressWarnings("unused")
private static class QualifiedFieldWithBaseQualifierDefaultValueTestBean {
@Inject

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

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2012 the original author or authors.
* Copyright 2002-2013 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -199,6 +199,7 @@ public final class QualifierAnnotationTests { @@ -199,6 +199,7 @@ public final class QualifierAnnotationTests {
}
@SuppressWarnings("unused")
private static class NonQualifiedTestBean {
@Autowired
@ -305,6 +306,7 @@ public final class QualifierAnnotationTests { @@ -305,6 +306,7 @@ public final class QualifierAnnotationTests {
}
@SuppressWarnings("unused")
private static class QualifiedByAttributesTestBean {
@Autowired @MultipleAttributeQualifier(name="moe", age=42)
@ -323,6 +325,7 @@ public final class QualifierAnnotationTests { @@ -323,6 +325,7 @@ public final class QualifierAnnotationTests {
}
@SuppressWarnings("unused")
private static class Person {
private String name;

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

@ -198,7 +198,7 @@ abstract class ConstructorInjectedOverrides { @@ -198,7 +198,7 @@ abstract class ConstructorInjectedOverrides {
* @author Juergen Hoeller
* @since 09.11.2003
*/
@SuppressWarnings("serial")
@SuppressWarnings({ "serial", "unused" })
class DerivedConstructorDependenciesBean extends ConstructorDependenciesBean {
boolean initialized;
@ -332,6 +332,7 @@ class DummyReferencer { @@ -332,6 +332,7 @@ class DummyReferencer {
* @author Rod Johnson
* @author Juergen Hoeller
*/
@SuppressWarnings("unused")
class FactoryMethods {
public static FactoryMethods nullInstance() {

1
spring-context/src/test/java/org/springframework/context/annotation/AnnotationConfigApplicationContextTests.java

@ -133,7 +133,6 @@ public class AnnotationConfigApplicationContextTests { @@ -133,7 +133,6 @@ public class AnnotationConfigApplicationContextTests {
}
}
@SuppressWarnings("unchecked")
@Test
public void getBeanByTypeAmbiguityRaisesException() {
AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(TwoTestBeanConfig.class);

2
spring-context/src/test/java/org/springframework/context/annotation/BeanMethodPolymorphismTests.java

@ -47,7 +47,7 @@ public class BeanMethodPolymorphismTests { @@ -47,7 +47,7 @@ public class BeanMethodPolymorphismTests {
@Test
public void beanMethodOverloadingWithoutInheritance() {
@SuppressWarnings({ "unused", "hiding" })
@SuppressWarnings({ "hiding" })
@Configuration class Config {
@Bean String aString() { return "na"; }
@Bean String aString(Integer dependency) { return "na"; }

1
spring-context/src/test/java/org/springframework/context/annotation/CommonAnnotationBeanPostProcessorTests.java

@ -700,6 +700,7 @@ public class CommonAnnotationBeanPostProcessorTests { @@ -700,6 +700,7 @@ public class CommonAnnotationBeanPostProcessorTests {
}
@SuppressWarnings("unused")
private static class NullFactory {
public static Object create() {

5
spring-context/src/test/java/org/springframework/context/annotation/ComponentScanParserBeanDefinitionDefaultsTests.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2007 the original author or authors.
* Copyright 2002-2013 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -214,6 +214,7 @@ public class ComponentScanParserBeanDefinitionDefaultsTests { @@ -214,6 +214,7 @@ public class ComponentScanParserBeanDefinitionDefaultsTests {
}
@SuppressWarnings("unused")
private static class DefaultsTestBean {
static int INIT_COUNT;
@ -276,6 +277,7 @@ public class ComponentScanParserBeanDefinitionDefaultsTests { @@ -276,6 +277,7 @@ public class ComponentScanParserBeanDefinitionDefaultsTests {
}
@SuppressWarnings("unused")
private static class PropertyDependencyTestBean {
private String name;
@ -290,6 +292,7 @@ public class ComponentScanParserBeanDefinitionDefaultsTests { @@ -290,6 +292,7 @@ public class ComponentScanParserBeanDefinitionDefaultsTests {
}
@SuppressWarnings("unused")
private static class ConstructorDependencyTestBean {
private String name;

1
spring-context/src/test/java/org/springframework/context/annotation/configuration/BeanAnnotationAttributePropagationTests.java

@ -41,7 +41,6 @@ import org.springframework.context.annotation.DependsOn; @@ -41,7 +41,6 @@ import org.springframework.context.annotation.DependsOn;
*
* @author Chris Beams
*/
@SuppressWarnings("unused") // for unused @Bean methods in local classes
public class BeanAnnotationAttributePropagationTests {
@Test

6
spring-context/src/test/java/org/springframework/context/annotation/configuration/ConfigurationClassProcessingTests.java

@ -272,6 +272,7 @@ public class ConfigurationClassProcessingTests { @@ -272,6 +272,7 @@ public class ConfigurationClassProcessingTests {
}
@SuppressWarnings("unused")
static class ConfigWithPostProcessor extends ConfigWithPrototypeBean {
@Value("${myProp}")
@ -280,10 +281,13 @@ public class ConfigurationClassProcessingTests { @@ -280,10 +281,13 @@ public class ConfigurationClassProcessingTests {
@Bean
public POBPP beanPostProcessor() {
return new POBPP() {
String nameSuffix = "-processed-" + myProp;
public void setNameSuffix(String nameSuffix) {
this.nameSuffix = nameSuffix;
}
@Override
public Object postProcessBeforeInitialization(Object bean, String beanName) {
if (bean instanceof ITestBean) {
@ -291,10 +295,12 @@ public class ConfigurationClassProcessingTests { @@ -291,10 +295,12 @@ public class ConfigurationClassProcessingTests {
}
return bean;
}
@Override
public Object postProcessAfterInitialization(Object bean, String beanName) {
return bean;
}
public int getOrder() {
return 0;
}

5
spring-context/src/test/java/org/springframework/context/support/ConversionServiceFactoryBeanTests.java

@ -33,6 +33,7 @@ import org.springframework.core.convert.converter.GenericConverter; @@ -33,6 +33,7 @@ import org.springframework.core.convert.converter.GenericConverter;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.FileSystemResource;
import static org.hamcrest.Matchers.instanceOf;
import static org.junit.Assert.*;
/**
@ -136,8 +137,8 @@ public class ConversionServiceFactoryBeanTests { @@ -136,8 +137,8 @@ public class ConversionServiceFactoryBeanTests {
public ComplexConstructorArgument(Map<String, Class<?>> map) {
assertTrue(!map.isEmpty());
assertTrue(map.keySet().iterator().next() instanceof String);
assertTrue(map.values().iterator().next() instanceof Class);
assertThat(map.keySet().iterator().next(), instanceOf(String.class));
assertThat(map.values().iterator().next(), instanceOf(Class.class));
}
}

1
spring-context/src/test/java/org/springframework/format/support/FormattingConversionServiceFactoryBeanTests.java

@ -130,7 +130,6 @@ public class FormattingConversionServiceFactoryBeanTests { @@ -130,7 +130,6 @@ public class FormattingConversionServiceFactoryBeanTests {
private static class TestBean {
@SuppressWarnings("unused")
@NumberFormat(style = Style.PERCENT)
private double percent;

1
spring-context/src/test/java/org/springframework/format/support/FormattingConversionServiceTests.java

@ -393,7 +393,6 @@ public class FormattingConversionServiceTests { @@ -393,7 +393,6 @@ public class FormattingConversionServiceTests {
private static class ModelWithSubclassField {
@SuppressWarnings("unused")
@org.springframework.format.annotation.DateTimeFormat(style = "S-")
public MyDate date;
}

1
spring-context/src/test/java/org/springframework/instrument/classloading/glassfish/GlassFishLoadTimeWeaverTests.java

@ -20,7 +20,6 @@ import org.junit.Ignore; @@ -20,7 +20,6 @@ import org.junit.Ignore;
// converting away from old-style EasyMock APIs was problematic with this class
// glassfish dependencies no longer on classpath
@SuppressWarnings("deprecation")
@Ignore
public class GlassFishLoadTimeWeaverTests {

4
spring-context/src/test/java/org/springframework/jmx/JmxTestBean.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2012 the original author or authors.
* Copyright 2002-2013 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
@ -138,12 +138,14 @@ public class JmxTestBean implements IJmxTestBean { @@ -138,12 +138,14 @@ public class JmxTestBean implements IJmxTestBean {
protected void someProtectedMethod() {
}
@SuppressWarnings("unused")
private void somePrivateMethod() {
}
protected void getSomething() {
}
@SuppressWarnings("unused")
private void getSomethingElse() {
}

4
spring-context/src/test/java/org/springframework/jmx/export/assembler/AbstractJmxAssemblerTests.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2012 the original author or authors.
* Copyright 2002-2013 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
@ -51,6 +51,7 @@ public abstract class AbstractJmxAssemblerTests extends AbstractJmxTests { @@ -51,6 +51,7 @@ public abstract class AbstractJmxAssemblerTests extends AbstractJmxTests {
public void testRegisterOperations() throws Exception {
IJmxTestBean bean = getBean();
assertNotNull(bean);
MBeanInfo inf = getMBeanInfo();
assertEquals("Incorrect number of operations registered",
getExpectedOperationCount(), inf.getOperations().length);
@ -58,6 +59,7 @@ public abstract class AbstractJmxAssemblerTests extends AbstractJmxTests { @@ -58,6 +59,7 @@ public abstract class AbstractJmxAssemblerTests extends AbstractJmxTests {
public void testRegisterAttributes() throws Exception {
IJmxTestBean bean = getBean();
assertNotNull(bean);
MBeanInfo inf = getMBeanInfo();
assertEquals("Incorrect number of attributes registered",
getExpectedAttributeCount(), inf.getAttributes().length);

6
spring-context/src/test/java/org/springframework/jmx/export/assembler/InterfaceBasedMBeanInfoAssemblerMappedTests.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2012 the original author or authors.
* Copyright 2002-2013 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -39,7 +39,7 @@ public class InterfaceBasedMBeanInfoAssemblerMappedTests extends AbstractJmxAsse @@ -39,7 +39,7 @@ public class InterfaceBasedMBeanInfoAssemblerMappedTests extends AbstractJmxAsse
public void testWithUnknownClass() throws Exception {
try {
InterfaceBasedMBeanInfoAssembler assembler = getWithMapping("com.foo.bar.Unknown");
getWithMapping("com.foo.bar.Unknown");
fail("Should have thrown IllegalArgumentException");
}
catch (IllegalArgumentException ex) {
@ -49,7 +49,7 @@ public class InterfaceBasedMBeanInfoAssemblerMappedTests extends AbstractJmxAsse @@ -49,7 +49,7 @@ public class InterfaceBasedMBeanInfoAssemblerMappedTests extends AbstractJmxAsse
public void testWithNonInterface() throws Exception {
try {
InterfaceBasedMBeanInfoAssembler assembler = getWithMapping("JmxTestBean");
getWithMapping("JmxTestBean");
fail("Should have thrown IllegalArgumentException");
}
catch (IllegalArgumentException ex) {

1
spring-context/src/test/java/org/springframework/scheduling/annotation/EnableAsyncTests.java

@ -74,7 +74,6 @@ public class EnableAsyncTests { @@ -74,7 +74,6 @@ public class EnableAsyncTests {
}
@SuppressWarnings("unchecked")
@Test
public void withAsyncBeanWithExecutorQualifiedByName() throws ExecutionException, InterruptedException {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();

5
spring-context/src/test/java/org/springframework/scheduling/timer/TimerSupportTests.java

@ -16,6 +16,9 @@ @@ -16,6 +16,9 @@
package org.springframework.scheduling.timer;
import static org.hamcrest.Matchers.instanceOf;
import static org.junit.Assert.assertThat;
import java.util.ArrayList;
import java.util.List;
import java.util.Timer;
@ -84,7 +87,7 @@ public class TimerSupportTests extends TestCase { @@ -84,7 +87,7 @@ public class TimerSupportTests extends TestCase {
try {
timerFactoryBean.setScheduledTimerTasks(tasks);
timerFactoryBean.afterPropertiesSet();
assertTrue(timerFactoryBean.getObject() instanceof Timer);
assertThat(timerFactoryBean.getObject(), instanceOf(Timer.class));
timerTask0.run();
timerTask1.run();
timerTask2.run();

3
spring-context/src/test/java/org/springframework/validation/DataBinderTests.java

@ -1630,6 +1630,7 @@ public class DataBinderTests extends TestCase { @@ -1630,6 +1630,7 @@ public class DataBinderTests extends TestCase {
}
@SuppressWarnings("unused")
private static class BeanWithIntegerList {
private List<Integer> integerList;
@ -1644,6 +1645,7 @@ public class DataBinderTests extends TestCase { @@ -1644,6 +1645,7 @@ public class DataBinderTests extends TestCase {
}
@SuppressWarnings("unused")
private static class Book {
private String Title;
@ -1728,6 +1730,7 @@ public class DataBinderTests extends TestCase { @@ -1728,6 +1730,7 @@ public class DataBinderTests extends TestCase {
}
@SuppressWarnings("unused")
private static class GrowingList<E> extends AbstractList<E> {
private List<E> list;

3
spring-core/src/main/java/org/springframework/core/io/support/PathMatchingResourcePatternResolver.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2012 the original author or authors.
* Copyright 2002-2013 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -658,6 +658,7 @@ public class PathMatchingResourcePatternResolver implements ResourcePatternResol @@ -658,6 +658,7 @@ public class PathMatchingResourcePatternResolver implements ResourcePatternResol
/**
* VFS visitor for path matching purposes.
*/
@SuppressWarnings("unused")
private static class PatternVirtualFileVisitor implements InvocationHandler {
private final String subPattern;

10
spring-core/src/main/java/org/springframework/util/ObjectUtils.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2012 the original author or authors.
* Copyright 2002-2013 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -481,7 +481,7 @@ public abstract class ObjectUtils { @@ -481,7 +481,7 @@ public abstract class ObjectUtils {
}
/**
* Return the same value as {@code {@link Boolean#hashCode()}}.
* Return the same value as {@link Boolean#hashCode()}}.
* @see Boolean#hashCode()
*/
public static int hashCode(boolean bool) {
@ -489,7 +489,7 @@ public abstract class ObjectUtils { @@ -489,7 +489,7 @@ public abstract class ObjectUtils {
}
/**
* Return the same value as {@code {@link Double#hashCode()}}.
* Return the same value as {@link Double#hashCode()}}.
* @see Double#hashCode()
*/
public static int hashCode(double dbl) {
@ -498,7 +498,7 @@ public abstract class ObjectUtils { @@ -498,7 +498,7 @@ public abstract class ObjectUtils {
}
/**
* Return the same value as {@code {@link Float#hashCode()}}.
* Return the same value as {@link Float#hashCode()}}.
* @see Float#hashCode()
*/
public static int hashCode(float flt) {
@ -506,7 +506,7 @@ public abstract class ObjectUtils { @@ -506,7 +506,7 @@ public abstract class ObjectUtils {
}
/**
* Return the same value as {@code {@link Long#hashCode()}}.
* Return the same value as {@link Long#hashCode()}}.
* @see Long#hashCode()
*/
public static int hashCode(long lng) {

3
spring-core/src/test/java/org/springframework/core/BridgeMethodResolverTests.java

@ -560,6 +560,7 @@ public class BridgeMethodResolverTests { @@ -560,6 +560,7 @@ public class BridgeMethodResolverTests {
}
@SuppressWarnings("unused")
private static class StringGenericParameter implements GenericParameter<String> {
@Override
@ -1163,6 +1164,7 @@ public class BridgeMethodResolverTests { @@ -1163,6 +1164,7 @@ public class BridgeMethodResolverTests {
}
@SuppressWarnings("unused")
private static class MegaMessageProducerImpl extends Other<Long, String> implements MegaMessageProducer {
public void receive(NewMegaMessageEvent event) {
@ -1198,6 +1200,7 @@ public class BridgeMethodResolverTests { @@ -1198,6 +1200,7 @@ public class BridgeMethodResolverTests {
}
@SuppressWarnings("unused")
private static abstract class AbstractImplementsInterface<D extends DomainObjectSuper> implements IGenericInterface<D> {
@Override

1
spring-core/src/test/java/org/springframework/core/convert/support/GenericConversionServiceTests.java

@ -358,7 +358,6 @@ public class GenericConversionServiceTests { @@ -358,7 +358,6 @@ public class GenericConversionServiceTests {
GenericConversionService service = new DefaultConversionService();
List<String> list1 = Arrays.asList("Foo", "Bar");
List<String> list2 = Arrays.asList("Baz", "Boop");
@SuppressWarnings("unchecked")
List<List<String>> list = Arrays.asList(list1, list2);
String result = service.convert(list, String.class);
assertNotNull(result);

7
spring-core/src/test/java/org/springframework/core/enums/LabeledEnumTests.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2012 the original author or authors.
* Copyright 2002-2013 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -104,7 +104,7 @@ public class LabeledEnumTests extends TestCase { @@ -104,7 +104,7 @@ public class LabeledEnumTests extends TestCase {
public void testDoesNotMatchWrongClass() {
try {
LabeledEnum none = StaticLabeledEnumResolver.instance().getLabeledEnumByCode(Dog.class,
StaticLabeledEnumResolver.instance().getLabeledEnumByCode(Dog.class,
new Short((short) 1));
fail("Should have failed");
}
@ -119,10 +119,11 @@ public class LabeledEnumTests extends TestCase { @@ -119,10 +119,11 @@ public class LabeledEnumTests extends TestCase {
}
@SuppressWarnings("serial")
@SuppressWarnings({ "serial", "unused" })
private static class Other extends StaticLabeledEnum {
public static final Other THING1 = new Other(1, "Thing1");
public static final Other THING2 = new Other(2, "Thing2");

6
spring-core/src/test/java/org/springframework/core/type/AnnotationTypeFilterTests.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2011 the original author or authors.
* Copyright 2002-2013 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -122,10 +122,12 @@ public class AnnotationTypeFilterTests { @@ -122,10 +122,12 @@ public class AnnotationTypeFilterTests {
}
@SuppressWarnings("unused")
private static class SomeSubClassOfSomeComponentInterface implements SomeComponentInterface {
}
@SuppressWarnings("unused")
private static class SomeSubClassOfSomeComponent extends SomeComponent {
}
@ -139,10 +141,12 @@ public class AnnotationTypeFilterTests { @@ -139,10 +141,12 @@ public class AnnotationTypeFilterTests {
}
@SuppressWarnings("unused")
private static class SomeSubclassOfSomeClassMarkedWithNonInheritedAnnotation extends SomeClassMarkedWithNonInheritedAnnotation {
}
@SuppressWarnings("unused")
private static class SomeNonCandidateClass {
}

4
spring-core/src/test/java/org/springframework/core/type/AssignableTypeFilterTests.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2012 the original author or authors.
* Copyright 2002-2013 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -81,6 +81,7 @@ public class AssignableTypeFilterTests extends TestCase { @@ -81,6 +81,7 @@ public class AssignableTypeFilterTests extends TestCase {
}
@SuppressWarnings("unused")
private static class TestInterfaceImpl implements TestInterface {
}
@ -89,6 +90,7 @@ public class AssignableTypeFilterTests extends TestCase { @@ -89,6 +90,7 @@ public class AssignableTypeFilterTests extends TestCase {
}
@SuppressWarnings("unused")
private static class SomeDaoLikeImpl extends SimpleJdbcDaoSupport implements SomeDaoLikeInterface {
}

2
spring-core/src/test/java/org/springframework/core/type/CachingMetadataReaderLeakTest.java

@ -31,7 +31,7 @@ import org.springframework.tests.Assume; @@ -31,7 +31,7 @@ import org.springframework.tests.Assume;
import org.springframework.tests.TestGroup;
/**
* Unit test checking the behaviour of {@link CachingMetadataReaderFactory under load.
* Unit test checking the behaviour of {@link CachingMetadataReaderFactory} under load.
* If the cache is not controller, this test should fail with an out of memory exception around entry
* 5k.
*

8
spring-core/src/test/java/org/springframework/util/ClassUtilsTests.java

@ -308,19 +308,25 @@ public class ClassUtilsTests extends TestCase { @@ -308,19 +308,25 @@ public class ClassUtilsTests extends TestCase {
}
}
@SuppressWarnings("unused")
private static class OverloadedMethodsClass {
public void print(String messages) {
/* no-op */
}
public void print(String[] messages) {
/* no-op */
}
}
private static class SubOverloadedMethodsClass extends OverloadedMethodsClass{
@SuppressWarnings("unused")
private static class SubOverloadedMethodsClass extends OverloadedMethodsClass {
public void print(String header, String[] messages) {
/* no-op */
}
void print(String header, String[] messages, String footer) {
/* no-op */
}

3
spring-core/src/test/java/org/springframework/util/MethodInvokerTests.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2012 the original author or authors.
* Copyright 2002-2013 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -191,6 +191,7 @@ public class MethodInvokerTests extends TestCase { @@ -191,6 +191,7 @@ public class MethodInvokerTests extends TestCase {
}
@SuppressWarnings("unused")
public static class Greeter {
// should handle Salesman (only interface)

6
spring-core/src/test/java/org/springframework/util/StopWatchTests.java

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
/*
* Copyright 2002-2012 the original author or authors.
* Copyright 2002-2013 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -34,7 +34,6 @@ public class StopWatchTests extends TestCase { @@ -34,7 +34,6 @@ public class StopWatchTests extends TestCase {
String name1 = "Task 1";
String name2 = "Task 2";
long fudgeFactor = 5L;
assertFalse(sw.isRunning());
sw.start(name1);
Thread.sleep(int1);
@ -44,6 +43,7 @@ public class StopWatchTests extends TestCase { @@ -44,6 +43,7 @@ public class StopWatchTests extends TestCase {
// TODO are timings off in JUnit? Why do these assertions sometimes fail
// under both Ant and Eclipse?
//long fudgeFactor = 5L;
//assertTrue("Unexpected timing " + sw.getTotalTime(), sw.getTotalTime() >= int1);
//assertTrue("Unexpected timing " + sw.getTotalTime(), sw.getTotalTime() <= int1 + fudgeFactor);
sw.start(name2);
@ -72,7 +72,6 @@ public class StopWatchTests extends TestCase { @@ -72,7 +72,6 @@ public class StopWatchTests extends TestCase {
String name1 = "Task 1";
String name2 = "Task 2";
long fudgeFactor = 5L;
assertFalse(sw.isRunning());
sw.start(name1);
Thread.sleep(int1);
@ -82,6 +81,7 @@ public class StopWatchTests extends TestCase { @@ -82,6 +81,7 @@ public class StopWatchTests extends TestCase {
// TODO are timings off in JUnit? Why do these assertions sometimes fail
// under both Ant and Eclipse?
//long fudgeFactor = 5L;
//assertTrue("Unexpected timing " + sw.getTotalTime(), sw.getTotalTime() >= int1);
//assertTrue("Unexpected timing " + sw.getTotalTime(), sw.getTotalTime() <= int1 + fudgeFactor);
sw.start(name2);

8
spring-expression/src/test/java/org/springframework/expression/spel/MapAccessTests.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2012 the original author or authors.
* Copyright 2002-2013 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -17,6 +17,7 @@ @@ -17,6 +17,7 @@
package org.springframework.expression.spel;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import java.util.HashMap;
import java.util.Map;
@ -83,9 +84,10 @@ public class MapAccessTests extends ExpressionTestCase { @@ -83,9 +84,10 @@ public class MapAccessTests extends ExpressionTestCase {
ExpressionParser parser = new SpelExpressionParser();
Expression exp = parser.parseExpression("testBean.properties['key2']");
String key= (String)exp.getValue(bean);
String key = (String) exp.getValue(bean);
assertNotNull(key);
}
}
public static class TestBean
{

5
spring-expression/src/test/java/org/springframework/expression/spel/SpelDocumentationTests.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2012 the original author or authors.
* Copyright 2002-2013 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -18,6 +18,7 @@ package org.springframework.expression.spel; @@ -18,6 +18,7 @@ package org.springframework.expression.spel;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
@ -213,9 +214,11 @@ public class SpelDocumentationTests extends ExpressionTestCase { @@ -213,9 +214,11 @@ public class SpelDocumentationTests extends ExpressionTestCase {
societyContext.setRootObject(new IEEE());
// Officer's Dictionary
Inventor pupin = parser.parseExpression("officers['president']").getValue(societyContext, Inventor.class);
assertNotNull(pupin);
// evaluates to "Idvor"
String city = parser.parseExpression("officers['president'].PlaceOfBirth.city").getValue(societyContext, String.class);
assertNotNull(city);
// setting values
Inventor i = parser.parseExpression("officers['advisors'][0]").getValue(societyContext,Inventor.class);

5
spring-expression/src/test/java/org/springframework/expression/spel/SpelReproTests.java

@ -19,6 +19,7 @@ package org.springframework.expression.spel; @@ -19,6 +19,7 @@ package org.springframework.expression.spel;
import static org.hamcrest.Matchers.is;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
@ -1680,6 +1681,7 @@ public class SpelReproTests extends ExpressionTestCase { @@ -1680,6 +1681,7 @@ public class SpelReproTests extends ExpressionTestCase {
ExpressionParser parser = new SpelExpressionParser();
StandardEvaluationContext evaluationContext = new StandardEvaluationContext(new BooleanHolder());
Class<?> valueType = parser.parseExpression("simpleProperty").getValueType(evaluationContext);
assertNotNull(valueType);
}
@Test
@ -1687,6 +1689,7 @@ public class SpelReproTests extends ExpressionTestCase { @@ -1687,6 +1689,7 @@ public class SpelReproTests extends ExpressionTestCase {
ExpressionParser parser = new SpelExpressionParser();
StandardEvaluationContext evaluationContext = new StandardEvaluationContext(new BooleanHolder());
Object value = parser.parseExpression("simpleProperty").getValue(evaluationContext);
assertNotNull(value);
}
@Test
@ -1694,6 +1697,7 @@ public class SpelReproTests extends ExpressionTestCase { @@ -1694,6 +1697,7 @@ public class SpelReproTests extends ExpressionTestCase {
ExpressionParser parser = new SpelExpressionParser();
StandardEvaluationContext evaluationContext = new StandardEvaluationContext(new BooleanHolder());
Class<?> valueType = parser.parseExpression("primitiveProperty").getValueType(evaluationContext);
assertNotNull(valueType);
}
@Test
@ -1701,6 +1705,7 @@ public class SpelReproTests extends ExpressionTestCase { @@ -1701,6 +1705,7 @@ public class SpelReproTests extends ExpressionTestCase {
ExpressionParser parser = new SpelExpressionParser();
StandardEvaluationContext evaluationContext = new StandardEvaluationContext(new BooleanHolder());
Object value = parser.parseExpression("primitiveProperty").getValue(evaluationContext);
assertNotNull(value);
}
@Test

12
spring-jdbc/src/main/java/org/springframework/jdbc/core/metadata/GenericTableMetaDataProvider.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2012 the original author or authors.
* Copyright 2002-2013 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -310,7 +310,6 @@ public class GenericTableMetaDataProvider implements TableMetaDataProvider { @@ -310,7 +310,6 @@ public class GenericTableMetaDataProvider implements TableMetaDataProvider {
tmd.setCatalogName(tables.getString("TABLE_CAT"));
tmd.setSchemaName(tables.getString("TABLE_SCHEM"));
tmd.setTableName(tables.getString("TABLE_NAME"));
tmd.setType(tables.getString("TABLE_TYPE"));
if (tmd.getSchemaName() == null) {
tableMeta.put(userName != null ? userName.toUpperCase() : "", tmd);
}
@ -445,7 +444,6 @@ public class GenericTableMetaDataProvider implements TableMetaDataProvider { @@ -445,7 +444,6 @@ public class GenericTableMetaDataProvider implements TableMetaDataProvider {
private String tableName;
private String type;
public void setCatalogName(String catalogName) {
this.catalogName = catalogName;
@ -470,14 +468,6 @@ public class GenericTableMetaDataProvider implements TableMetaDataProvider { @@ -470,14 +468,6 @@ public class GenericTableMetaDataProvider implements TableMetaDataProvider {
public String getTableName() {
return this.tableName;
}
public void setType(String type) {
this.type = type;
}
public String getType() {
return this.type;
}
}
}

6
spring-jdbc/src/main/java/org/springframework/jdbc/datasource/DataSourceTransactionManager.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2012 the original author or authors.
* Copyright 2002-2013 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -348,10 +348,6 @@ public class DataSourceTransactionManager extends AbstractPlatformTransactionMan @@ -348,10 +348,6 @@ public class DataSourceTransactionManager extends AbstractPlatformTransactionMan
return this.newConnectionHolder;
}
public boolean hasTransaction() {
return (getConnectionHolder() != null && getConnectionHolder().isTransactionActive());
}
public void setMustRestoreAutoCommit(boolean mustRestoreAutoCommit) {
this.mustRestoreAutoCommit = mustRestoreAutoCommit;
}

1
spring-jdbc/src/main/java/org/springframework/jdbc/datasource/embedded/EmbeddedDatabaseFactory.java

@ -205,7 +205,6 @@ public class EmbeddedDatabaseFactory { @@ -205,7 +205,6 @@ public class EmbeddedDatabaseFactory {
}
// getParentLogger() is required for JDBC 4.1 compatibility
@SuppressWarnings("unused")
public Logger getParentLogger() {
return Logger.getLogger(Logger.GLOBAL_LOGGER_NAME);
}

2
spring-jdbc/src/test/java/org/springframework/jdbc/core/namedparam/BeanPropertySqlParameterSourceTests.java

@ -81,6 +81,8 @@ public class BeanPropertySqlParameterSourceTests { @@ -81,6 +81,8 @@ public class BeanPropertySqlParameterSourceTests {
assertFalse(source.hasValue("noOp"));
}
@SuppressWarnings("unused")
private static final class NoReadableProperties {
public void setNoOp(String noOp) {

3
spring-jdbc/src/test/java/org/springframework/jdbc/support/SQLStateExceptionTranslatorTests.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2012 the original author or authors.
* Copyright 2002-2013 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -67,7 +67,6 @@ public class SQLStateExceptionTranslatorTests extends TestCase { @@ -67,7 +67,6 @@ public class SQLStateExceptionTranslatorTests extends TestCase {
* Bug 729170
*/
public void testMalformedSqlStateCodes() {
String sql = "SELECT FOO FROM BAR";
SQLException sex = new SQLException("Message", null, 1);
testMalformedSqlStateCode(sex);

8
spring-jms/src/test/java/org/springframework/jms/core/JmsTemplate102Tests.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2012 the original author or authors.
* Copyright 2002-2013 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -207,7 +207,7 @@ public class JmsTemplate102Tests extends TestCase { @@ -207,7 +207,7 @@ public class JmsTemplate102Tests extends TestCase {
template.execute(new SessionCallback() {
@Override
public Object doInJms(Session session) throws JMSException {
boolean b = session.getTransacted();
session.getTransacted();
return null;
}
});
@ -249,8 +249,8 @@ public class JmsTemplate102Tests extends TestCase { @@ -249,8 +249,8 @@ public class JmsTemplate102Tests extends TestCase {
template.execute(new ProducerCallback() {
@Override
public Object doInJms(Session session, MessageProducer producer) throws JMSException {
boolean b = session.getTransacted();
int i = producer.getPriority();
session.getTransacted();
producer.getPriority();
return null;
}
});

18
spring-jms/src/test/java/org/springframework/jms/core/JmsTemplateTests.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2012 the original author or authors.
* Copyright 2002-2013 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -190,8 +190,8 @@ public class JmsTemplateTests extends TestCase { @@ -190,8 +190,8 @@ public class JmsTemplateTests extends TestCase {
template.execute(new ProducerCallback() {
@Override
public Object doInJms(Session session, MessageProducer producer) throws JMSException {
boolean b = session.getTransacted();
int i = producer.getPriority();
session.getTransacted();
producer.getPriority();
return null;
}
});
@ -234,8 +234,8 @@ public class JmsTemplateTests extends TestCase { @@ -234,8 +234,8 @@ public class JmsTemplateTests extends TestCase {
template.execute(new ProducerCallback() {
@Override
public Object doInJms(Session session, MessageProducer producer) throws JMSException {
boolean b = session.getTransacted();
int i = producer.getPriority();
session.getTransacted();
producer.getPriority();
return null;
}
});
@ -264,7 +264,7 @@ public class JmsTemplateTests extends TestCase { @@ -264,7 +264,7 @@ public class JmsTemplateTests extends TestCase {
template.execute(new SessionCallback() {
@Override
public Object doInJms(Session session) throws JMSException {
boolean b = session.getTransacted();
session.getTransacted();
return null;
}
});
@ -303,14 +303,14 @@ public class JmsTemplateTests extends TestCase { @@ -303,14 +303,14 @@ public class JmsTemplateTests extends TestCase {
template.execute(new SessionCallback() {
@Override
public Object doInJms(Session session) throws JMSException {
boolean b = session.getTransacted();
session.getTransacted();
return null;
}
});
template.execute(new SessionCallback() {
@Override
public Object doInJms(Session session) throws JMSException {
boolean b = session.getTransacted();
session.getTransacted();
return null;
}
});
@ -321,7 +321,7 @@ public class JmsTemplateTests extends TestCase { @@ -321,7 +321,7 @@ public class JmsTemplateTests extends TestCase {
TransactionAwareConnectionFactoryProxy tacf = new TransactionAwareConnectionFactoryProxy(scf);
Connection tac = tacf.createConnection();
Session tas = tac.createSession(false, Session.AUTO_ACKNOWLEDGE);
boolean b = tas.getTransacted();
tas.getTransacted();
tas.close();
tac.close();

6
spring-jms/src/test/java/org/springframework/jms/listener/endpoint/DefaultJmsActivationSpecFactoryTests.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2012 the original author or authors.
* Copyright 2002-2013 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -20,8 +20,8 @@ import javax.jms.Destination; @@ -20,8 +20,8 @@ import javax.jms.Destination;
import javax.jms.Session;
import junit.framework.TestCase;
import org.easymock.MockControl;
import org.easymock.MockControl;
import org.springframework.jca.StubResourceAdapter;
import org.springframework.jms.StubQueue;
import org.springframework.jms.support.destination.DestinationResolver;
@ -89,6 +89,7 @@ public class DefaultJmsActivationSpecFactoryTests extends TestCase { @@ -89,6 +89,7 @@ public class DefaultJmsActivationSpecFactoryTests extends TestCase {
}
@SuppressWarnings("unused")
private static class StubActiveMQActivationSpec extends StubJmsActivationSpec {
private int maxSessions;
@ -133,6 +134,7 @@ public class DefaultJmsActivationSpecFactoryTests extends TestCase { @@ -133,6 +134,7 @@ public class DefaultJmsActivationSpecFactoryTests extends TestCase {
}
@SuppressWarnings("unused")
private static class StubWebSphereActivationSpecImpl extends StubJmsActivationSpec {
private Destination destination;

1
spring-orm/src/main/java/org/springframework/orm/jdo/JdoTemplate.java

@ -481,7 +481,6 @@ public class JdoTemplate extends JdoAccessor implements JdoOperations { @@ -481,7 +481,6 @@ public class JdoTemplate extends JdoAccessor implements JdoOperations {
public Collection find(final String queryString) throws DataAccessException {
return execute(new JdoCallback<Collection>() {
@SuppressWarnings("unchecked")
public Collection doInJdo(PersistenceManager pm) throws JDOException {
Query query = pm.newQuery(queryString);
prepareQuery(query);

1
spring-orm/src/test/java/org/springframework/orm/jdo/JdoInterceptorTests.java

@ -77,6 +77,7 @@ public class JdoInterceptorTests { @@ -77,6 +77,7 @@ public class JdoInterceptorTests {
}
@SuppressWarnings("unused")
private static class TestInvocation implements MethodInvocation {
private PersistenceManagerFactory persistenceManagerFactory;

3
spring-orm/src/test/java/org/springframework/orm/jpa/ApplicationManagedEntityManagerIntegrationTests.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2012 the original author or authors.
* Copyright 2002-2013 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -48,6 +48,7 @@ public class ApplicationManagedEntityManagerIntegrationTests extends AbstractEnt @@ -48,6 +48,7 @@ public class ApplicationManagedEntityManagerIntegrationTests extends AbstractEnt
assertTrue(Proxy.isProxyClass(em.getClass()));
Query q = em.createQuery("select p from Person as p");
List<Person> people = q.getResultList();
assertNotNull(people);
assertTrue("Should be open to start with", em.isOpen());
em.close();

1
spring-orm/src/test/java/org/springframework/orm/jpa/JpaInterceptorTests.java

@ -198,6 +198,7 @@ public class JpaInterceptorTests { @@ -198,6 +198,7 @@ public class JpaInterceptorTests {
}
@SuppressWarnings("unused")
private static class TestInvocation implements MethodInvocation {
private EntityManagerFactory entityManagerFactory;

4
spring-oxm/src/test/java/org/springframework/oxm/jaxb/Jaxb2MarshallerTests.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2012 the original author or authors.
* Copyright 2002-2013 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -311,10 +311,12 @@ public class Jaxb2MarshallerTests extends AbstractMarshallerTests { @@ -311,10 +311,12 @@ public class Jaxb2MarshallerTests extends AbstractMarshallerTests {
private String s = "Hello";
}
@SuppressWarnings("unused")
private JAXBElement<DummyRootElement> createDummyRootElement() {
return null;
}
@SuppressWarnings("unused")
private JAXBElement<DummyType> createDummyType() {
return null;
}

1
spring-test-mvc/src/main/java/org/springframework/test/web/servlet/result/FlashAttributeResultMatchers.java

@ -57,7 +57,6 @@ public class FlashAttributeResultMatchers { @@ -57,7 +57,6 @@ public class FlashAttributeResultMatchers {
*/
public <T> ResultMatcher attribute(final String name, final Object value) {
return new ResultMatcher() {
@SuppressWarnings("unchecked")
public void match(MvcResult result) throws Exception {
assertEquals("Flash attribute", value, result.getFlashMap().get(name));
}

4
spring-test/src/main/java/org/springframework/test/jpa/AbstractJpaTests.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2012 the original author or authors.
* Copyright 2002-2013 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -326,6 +326,7 @@ public abstract class AbstractJpaTests extends AbstractAnnotationAwareTransactio @@ -326,6 +326,7 @@ public abstract class AbstractJpaTests extends AbstractAnnotationAwareTransactio
private final LoadTimeWeaver ltw;
@SuppressWarnings("unused")
public LoadTimeWeaverInjectingBeanPostProcessor(LoadTimeWeaver ltw) {
this.ltw = ltw;
}
@ -346,6 +347,7 @@ public abstract class AbstractJpaTests extends AbstractAnnotationAwareTransactio @@ -346,6 +347,7 @@ public abstract class AbstractJpaTests extends AbstractAnnotationAwareTransactio
private final ClassLoader shadowingClassLoader;
@SuppressWarnings("unused")
public ShadowingLoadTimeWeaver(ClassLoader shadowingClassLoader) {
this.shadowingClassLoader = shadowingClassLoader;
}

2
spring-tx/src/test/java/org/springframework/transaction/interceptor/AbstractTransactionAspectTests.java

@ -539,7 +539,7 @@ public abstract class AbstractTransactionAspectTests extends TestCase { @@ -539,7 +539,7 @@ public abstract class AbstractTransactionAspectTests extends TestCase {
Method m = setNameMethod;
MapTransactionAttributeSource tas = new MapTransactionAttributeSource();
tas.register(m, txatt);
Method m2 = getNameMethod;
// Method m2 = getNameMethod;
// No attributes for m2
MockControl ptmControl = MockControl.createControl(PlatformTransactionManager.class);

3
spring-tx/src/test/java/org/springframework/transaction/interceptor/BeanFactoryTransactionTests.java

@ -163,6 +163,7 @@ public class BeanFactoryTransactionTests extends TestCase { @@ -163,6 +163,7 @@ public class BeanFactoryTransactionTests extends TestCase {
public void testGetBeansOfTypeWithAbstract() {
Map beansOfType = factory.getBeansOfType(ITestBean.class, true, true);
assertNotNull(beansOfType);
}
/**
@ -172,7 +173,7 @@ public class BeanFactoryTransactionTests extends TestCase { @@ -172,7 +173,7 @@ public class BeanFactoryTransactionTests extends TestCase {
try {
DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
new XmlBeanDefinitionReader(bf).loadBeanDefinitions(new ClassPathResource("noTransactionAttributeSource.xml", getClass()));
ITestBean testBean = (ITestBean) bf.getBean("noTransactionAttributeSource");
bf.getBean("noTransactionAttributeSource");
fail("Should require TransactionAttributeSource to be set");
}
catch (FatalBeanException ex) {

4
spring-web/src/main/java/org/springframework/web/util/UriTemplate.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2012 the original author or authors.
* Copyright 2002-2013 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -32,7 +32,7 @@ import org.springframework.util.Assert; @@ -32,7 +32,7 @@ import org.springframework.util.Assert;
/**
* Represents a URI template. A URI template is a URI-like String that contains variables enclosed
* by braces ({@code {}, {@code }}), which can be expanded to produce an actual URI.
* by braces ({@code {}}), which can be expanded to produce an actual URI.
*
* <p>See {@link #expand(Map)}, {@link #expand(Object[])}, and {@link #match(String)} for example usages.
*

4
spring-web/src/test/java/org/springframework/http/client/StreamingSimpleHttpRequestFactoryTests.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2012 the original author or authors.
* Copyright 2002-2013 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -81,7 +81,7 @@ public class StreamingSimpleHttpRequestFactoryTests extends AbstractHttpRequestF @@ -81,7 +81,7 @@ public class StreamingSimpleHttpRequestFactoryTests extends AbstractHttpRequestF
ClientHttpRequest request = factory.createRequest(new URI(baseUrl + "/methods/post"), HttpMethod.POST);
final int BUF_SIZE = 4096;
final int ITERATIONS = Integer.MAX_VALUE / BUF_SIZE;
final int contentLength = ITERATIONS * BUF_SIZE;
// final int contentLength = ITERATIONS * BUF_SIZE;
// request.getHeaders().setContentLength(contentLength);
OutputStream body = request.getBody();
for (int i = 0; i < ITERATIONS; i++) {

1
spring-web/src/test/java/org/springframework/http/converter/FormHttpMessageConverterTests.java

@ -72,7 +72,6 @@ public class FormHttpMessageConverterTests { @@ -72,7 +72,6 @@ public class FormHttpMessageConverterTests {
}
@Test
@SuppressWarnings("unchecked")
public void readForm() throws Exception {
String body = "name+1=value+1&name+2=value+2%2B1&name+2=value+2%2B2&name+3";
Charset iso88591 = Charset.forName("ISO-8859-1");

6
spring-web/src/test/java/org/springframework/web/method/annotation/InitBinderDataBinderFactoryTests.java

@ -140,29 +140,25 @@ public class InitBinderDataBinderFactoryTests { @@ -140,29 +140,25 @@ public class InitBinderDataBinderFactoryTests {
private static class InitBinderHandler {
@SuppressWarnings("unused")
@InitBinder
public void initBinder(WebDataBinder dataBinder) {
dataBinder.setDisallowedFields("id");
}
@SuppressWarnings("unused")
@InitBinder(value="foo")
public void initBinderWithAttributeName(WebDataBinder dataBinder) {
dataBinder.setDisallowedFields("id");
}
@SuppressWarnings("unused")
@InitBinder
public String initBinderReturnValue(WebDataBinder dataBinder) {
return "invalid";
}
@SuppressWarnings("unused")
@InitBinder
public void initBinderTypeConversion(WebDataBinder dataBinder, @RequestParam int requestParam) {
dataBinder.setDisallowedFields("requestParam-" + requestParam);
}
}
}
}

3
spring-web/src/test/java/org/springframework/web/method/annotation/ModelAttributeMethodProcessorTests.java

@ -299,7 +299,6 @@ public class ModelAttributeMethodProcessorTests { @@ -299,7 +299,6 @@ public class ModelAttributeMethodProcessorTests {
}
}
@SuppressWarnings("unused")
@ModelAttribute("modelAttrName")
private String annotatedReturnValue() {
return null;
@ -310,4 +309,4 @@ public class ModelAttributeMethodProcessorTests { @@ -310,4 +309,4 @@ public class ModelAttributeMethodProcessorTests {
return null;
}
}
}

10
spring-web/src/test/java/org/springframework/web/multipart/commons/CommonsMultipartResolverTests.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2012 the original author or authors.
* Copyright 2002-2013 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -465,19 +465,11 @@ public class CommonsMultipartResolverTests { @@ -465,19 +465,11 @@ public class CommonsMultipartResolverTests {
this.writtenFile = file;
}
public File getWrittenFile() {
return writtenFile;
}
@Override
public void delete() {
this.deleted = true;
}
public boolean isDeleted() {
return deleted;
}
@Override
public String getFieldName() {
return fieldName;

2
spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/annotation/ResponseStatusExceptionResolverTests.java

@ -63,7 +63,7 @@ public class ResponseStatusExceptionResolverTests { @@ -63,7 +63,7 @@ public class ResponseStatusExceptionResolverTests {
exceptionResolver.setMessageSource(messageSource);
StatusCodeAndReasonMessageException ex = new StatusCodeAndReasonMessageException();
ModelAndView mav = exceptionResolver.resolveException(request, response, null, ex);
exceptionResolver.resolveException(request, response, null, ex);
assertEquals("Invalid status reason", "Gone reason message", response.getErrorMessage());
}
finally {

24
spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/annotation/ServletAnnotationControllerTests.java

@ -16,6 +16,16 @@ @@ -16,6 +16,16 @@
package org.springframework.web.servlet.mvc.annotation;
import static org.hamcrest.Matchers.instanceOf;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import java.beans.PropertyEditorSupport;
import java.io.IOException;
import java.io.Serializable;
@ -43,6 +53,7 @@ import java.util.List; @@ -43,6 +53,7 @@ import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Set;
import javax.servlet.ServletConfig;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
@ -54,17 +65,12 @@ import javax.validation.constraints.NotNull; @@ -54,17 +65,12 @@ import javax.validation.constraints.NotNull;
import javax.xml.bind.annotation.XmlRootElement;
import org.junit.Test;
import org.springframework.aop.framework.autoproxy.DefaultAdvisorAutoProxyCreator;
import org.springframework.aop.interceptor.SimpleTraceInterceptor;
import org.springframework.aop.support.DefaultPointcutAdvisor;
import org.springframework.beans.BeansException;
import org.springframework.tests.sample.beans.DerivedTestBean;
import org.springframework.tests.sample.beans.GenericBean;
import org.springframework.tests.sample.beans.ITestBean;
import org.springframework.beans.PropertyEditorRegistrar;
import org.springframework.beans.PropertyEditorRegistry;
import org.springframework.tests.sample.beans.TestBean;
import org.springframework.beans.factory.BeanCreationException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
@ -96,6 +102,10 @@ import org.springframework.mock.web.test.MockServletConfig; @@ -96,6 +102,10 @@ import org.springframework.mock.web.test.MockServletConfig;
import org.springframework.mock.web.test.MockServletContext;
import org.springframework.oxm.jaxb.Jaxb2Marshaller;
import org.springframework.stereotype.Controller;
import org.springframework.tests.sample.beans.DerivedTestBean;
import org.springframework.tests.sample.beans.GenericBean;
import org.springframework.tests.sample.beans.ITestBean;
import org.springframework.tests.sample.beans.TestBean;
import org.springframework.ui.ExtendedModelMap;
import org.springframework.ui.Model;
import org.springframework.ui.ModelMap;
@ -140,8 +150,6 @@ import org.springframework.web.servlet.mvc.support.RedirectAttributes; @@ -140,8 +150,6 @@ import org.springframework.web.servlet.mvc.support.RedirectAttributes;
import org.springframework.web.servlet.view.InternalResourceViewResolver;
import org.springframework.web.util.NestedServletException;
import static org.junit.Assert.*;
/**
* @author Juergen Hoeller
* @author Sam Brannen
@ -3291,7 +3299,7 @@ public class ServletAnnotationControllerTests { @@ -3291,7 +3299,7 @@ public class ServletAnnotationControllerTests {
@RequestMapping("/integerSet")
public void processCsv(@RequestParam("content") Set<Integer> content, HttpServletResponse response) throws IOException {
assertTrue(content.iterator().next() instanceof Integer);
assertThat(content.iterator().next(), instanceOf(Integer.class));
response.getWriter().write(StringUtils.collectionToDelimitedString(content, "-"));
}
}

5
spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/multiaction/MultiActionControllerTests.java

@ -453,7 +453,7 @@ public class MultiActionControllerTests extends TestCase { @@ -453,7 +453,7 @@ public class MultiActionControllerTests extends TestCase {
MockHttpServletRequest request = new MockHttpServletRequest("GET", "/handleIllegalStateException.html");
MockHttpServletResponse response = new MockHttpServletResponse();
ModelAndView mav = mac.handleRequest(request, response);
mac.handleRequest(request, response);
assertEquals(HttpServletResponse.SC_NOT_FOUND, response.getStatus());
}
@ -524,7 +524,6 @@ public class MultiActionControllerTests extends TestCase { @@ -524,7 +524,6 @@ public class MultiActionControllerTests extends TestCase {
this.invoked.put("commandNoSession", Boolean.TRUE);
String pname = request.getParameter("name");
String page = request.getParameter("age");
// ALLOW FOR NULL
if (pname == null) {
assertTrue("name null", command.getName() == null);
@ -532,6 +531,8 @@ public class MultiActionControllerTests extends TestCase { @@ -532,6 +531,8 @@ public class MultiActionControllerTests extends TestCase {
else {
assertTrue("name param set", pname.equals(command.getName()));
}
//String page = request.getParameter("age");
// if (page == null)
// assertTrue("age default", command.getAge() == 0);
// else

7
spring-webmvc/src/test/java/org/springframework/web/servlet/tags/UrlTagTests.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2012 the original author or authors.
* Copyright 2002-2013 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -16,6 +16,9 @@ @@ -16,6 +16,9 @@
package org.springframework.web.servlet.tags;
import static org.hamcrest.Matchers.instanceOf;
import static org.junit.Assert.assertThat;
import java.lang.reflect.Method;
import java.util.HashSet;
import java.util.LinkedList;
@ -49,7 +52,7 @@ public class UrlTagTests extends AbstractTagTests { @@ -49,7 +52,7 @@ public class UrlTagTests extends AbstractTagTests {
}
public void testParamSupport() {
assertTrue(tag instanceof ParamAware);
assertThat(tag, instanceOf(ParamAware.class));
}
public void testDoStartTag() throws JspException {

8
spring-webmvc/src/test/java/org/springframework/web/servlet/view/ResourceBundleViewResolverTests.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2012 the original author or authors.
* Copyright 2002-2013 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -72,14 +72,14 @@ public class ResourceBundleViewResolverTests extends TestCase { @@ -72,14 +72,14 @@ public class ResourceBundleViewResolverTests extends TestCase {
public void testParentsAreAbstract() throws Exception {
try {
View v = rb.resolveViewName("debug.Parent", Locale.ENGLISH);
rb.resolveViewName("debug.Parent", Locale.ENGLISH);
fail("Should have thrown BeanIsAbstractException");
}
catch (BeanIsAbstractException ex) {
// expected
}
try {
View v = rb.resolveViewName("testParent", Locale.ENGLISH);
rb.resolveViewName("testParent", Locale.ENGLISH);
fail("Should have thrown BeanIsAbstractException");
}
catch (BeanIsAbstractException ex) {
@ -152,7 +152,7 @@ public class ResourceBundleViewResolverTests extends TestCase { @@ -152,7 +152,7 @@ public class ResourceBundleViewResolverTests extends TestCase {
public void testNoSuchBasename() throws Exception {
try {
rb.setBasename("weoriwoierqupowiuer");
View v = rb.resolveViewName("debugView", Locale.ENGLISH);
rb.resolveViewName("debugView", Locale.ENGLISH);
fail("No such basename: all requests should fail with exception");
}
catch (MissingResourceException ex) {

7
spring-webmvc/src/test/java/org/springframework/web/servlet/view/freemarker/FreeMarkerConfigurerTests.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2012 the original author or authors.
* Copyright 2002-2013 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -16,6 +16,9 @@ @@ -16,6 +16,9 @@
package org.springframework.web.servlet.view.freemarker;
import static org.hamcrest.Matchers.instanceOf;
import static org.junit.Assert.assertThat;
import java.io.IOException;
import java.util.HashMap;
import java.util.Properties;
@ -98,7 +101,7 @@ public class FreeMarkerConfigurerTests extends TestCase { @@ -98,7 +101,7 @@ public class FreeMarkerConfigurerTests extends TestCase {
}
});
fcfb.afterPropertiesSet();
assertTrue(fcfb.getObject() instanceof Configuration);
assertThat(fcfb.getObject(), instanceOf(Configuration.class));
Configuration fc = fcfb.getObject();
Template ft = fc.getTemplate("test");
assertEquals("test", FreeMarkerTemplateUtils.processTemplateIntoString(ft, new HashMap()));

19
spring-webmvc/src/test/java/org/springframework/web/servlet/view/velocity/VelocityConfigurerTests.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2012 the original author or authors.
* Copyright 2002-2013 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -16,6 +16,9 @@ @@ -16,6 +16,9 @@
package org.springframework.web.servlet.view.velocity;
import static org.hamcrest.Matchers.instanceOf;
import static org.junit.Assert.assertThat;
import java.io.File;
import java.io.IOException;
import java.net.MalformedURLException;
@ -25,9 +28,9 @@ import java.util.Properties; @@ -25,9 +28,9 @@ import java.util.Properties;
import java.util.Vector;
import junit.framework.TestCase;
import org.apache.velocity.app.VelocityEngine;
import org.apache.velocity.exception.VelocityException;
import org.springframework.core.io.ByteArrayResource;
import org.springframework.core.io.DescriptiveResource;
import org.springframework.core.io.FileSystemResource;
@ -68,7 +71,7 @@ public class VelocityConfigurerTests extends TestCase { @@ -68,7 +71,7 @@ public class VelocityConfigurerTests extends TestCase {
map.put("myentry", value);
vefb.setVelocityPropertiesMap(map);
vefb.afterPropertiesSet();
assertTrue(vefb.getObject() instanceof VelocityEngine);
assertThat(vefb.getObject(), instanceOf(VelocityEngine.class));
VelocityEngine ve = vefb.getObject();
assertEquals("/mydir", ve.getProperty("myprop"));
assertEquals(value, ve.getProperty("myentry"));
@ -78,7 +81,7 @@ public class VelocityConfigurerTests extends TestCase { @@ -78,7 +81,7 @@ public class VelocityConfigurerTests extends TestCase {
VelocityEngineFactoryBean vefb = new VelocityEngineFactoryBean();
vefb.setResourceLoaderPath("file:/mydir");
vefb.afterPropertiesSet();
assertTrue(vefb.getObject() instanceof VelocityEngine);
assertThat(vefb.getObject(), instanceOf(VelocityEngine.class));
VelocityEngine ve = vefb.getObject();
assertEquals(new File("/mydir").getAbsolutePath(), ve.getProperty(VelocityEngine.FILE_RESOURCE_LOADER_PATH));
}
@ -105,7 +108,7 @@ public class VelocityConfigurerTests extends TestCase { @@ -105,7 +108,7 @@ public class VelocityConfigurerTests extends TestCase {
}
});
vefb.afterPropertiesSet();
assertTrue(vefb.getObject() instanceof VelocityEngine);
assertThat(vefb.getObject(), instanceOf(VelocityEngine.class));
VelocityEngine ve = vefb.getObject();
assertEquals("test", VelocityEngineUtils.mergeTemplateIntoString(ve, "test", new HashMap()));
}
@ -114,7 +117,7 @@ public class VelocityConfigurerTests extends TestCase { @@ -114,7 +117,7 @@ public class VelocityConfigurerTests extends TestCase {
VelocityConfigurer vc = new VelocityConfigurer();
vc.setResourceLoaderPath("file:/mydir");
vc.afterPropertiesSet();
assertTrue(vc.createVelocityEngine() instanceof VelocityEngine);
assertThat(vc.createVelocityEngine(), instanceOf(VelocityEngine.class));
VelocityEngine ve = vc.createVelocityEngine();
assertEquals(new File("/mydir").getAbsolutePath(), ve.getProperty(VelocityEngine.FILE_RESOURCE_LOADER_PATH));
}
@ -123,7 +126,7 @@ public class VelocityConfigurerTests extends TestCase { @@ -123,7 +126,7 @@ public class VelocityConfigurerTests extends TestCase {
VelocityConfigurer vc = new VelocityConfigurer();
vc.setResourceLoaderPath("file:/mydir,file:/yourdir");
vc.afterPropertiesSet();
assertTrue(vc.createVelocityEngine() instanceof VelocityEngine);
assertThat(vc.createVelocityEngine(), instanceOf(VelocityEngine.class));
VelocityEngine ve = vc.createVelocityEngine();
Vector paths = new Vector();
paths.add(new File("/mydir").getAbsolutePath());
@ -149,7 +152,7 @@ public class VelocityConfigurerTests extends TestCase { @@ -149,7 +152,7 @@ public class VelocityConfigurerTests extends TestCase {
});
vc.setPreferFileSystemAccess(false);
vc.afterPropertiesSet();
assertTrue(vc.createVelocityEngine() instanceof VelocityEngine);
assertThat(vc.createVelocityEngine(), instanceOf(VelocityEngine.class));
VelocityEngine ve = vc.createVelocityEngine();
assertEquals("test", VelocityEngineUtils.mergeTemplateIntoString(ve, "test", new HashMap()));
}

2
src/test/java/org/springframework/aop/config/AopNamespaceHandlerScopeIntegrationTests.java

@ -41,7 +41,7 @@ import org.springframework.web.context.support.XmlWebApplicationContext; @@ -41,7 +41,7 @@ import org.springframework.web.context.support.XmlWebApplicationContext;
* Integration tests for scoped proxy use in conjunction with aop: namespace.
* Deemed an integration test because .web mocks and application contexts are required.
*
* @see org.springframework.aop.config.AopNamespaceHandlerTests;
* @see org.springframework.aop.config.AopNamespaceHandlerTests
*
* @author Rob Harrop
* @author Juergen Hoeller

2
src/test/java/org/springframework/aop/framework/autoproxy/AdvisorAutoProxyCreatorIntegrationTests.java

@ -44,7 +44,7 @@ import org.springframework.transaction.interceptor.TransactionInterceptor; @@ -44,7 +44,7 @@ import org.springframework.transaction.interceptor.TransactionInterceptor;
* Integration tests for auto proxy creation by advisor recognition working in
* conjunction with transaction managment resources.
*
* @see org.springframework.aop.framework.autoproxy.AdvisorAutoProxyCreatorTests;
* @see org.springframework.aop.framework.autoproxy.AdvisorAutoProxyCreatorTests
*
* @author Rod Johnson
* @author Chris Beams

3
src/test/java/org/springframework/context/annotation/jsr330/ClassPathBeanDefinitionScannerJsr330ScopeIntegrationTests.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2012 the original author or authors.
* Copyright 2002-2013 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -86,6 +86,7 @@ public class ClassPathBeanDefinitionScannerJsr330ScopeIntegrationTests { @@ -86,6 +86,7 @@ public class ClassPathBeanDefinitionScannerJsr330ScopeIntegrationTests {
public void testPrototype() {
ApplicationContext context = createContext(ScopedProxyMode.NO);
ScopedTestBean bean = (ScopedTestBean) context.getBean("prototype");
assertNotNull(bean);
assertTrue(context.isPrototype("prototype"));
assertFalse(context.isSingleton("prototype"));
}

Loading…
Cancel
Save