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
This commit is contained in:
commit
aac6b913d6
|
@ -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())";
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
|||
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;
|
|||
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 {
|
|||
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 {
|
|||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Test
|
||||
public void testIntroductionOnTargetExcludedByTypePattern() {
|
||||
LinkedList target = new LinkedList();
|
||||
|
@ -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());
|
||||
|
||||
|
|
|
@ -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");
|
||||
|
|
|
@ -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 {
|
|||
//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));
|
||||
|
|
|
@ -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")
|
||||
|
|
|
@ -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 {
|
|||
// }
|
||||
// }
|
||||
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private static class ShouldNotBeConfiguredBySpring {
|
||||
|
||||
private String name;
|
||||
|
@ -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 {
|
|||
|
||||
|
||||
@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 {
|
|||
|
||||
|
||||
@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 {
|
|||
|
||||
|
||||
@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 {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private static class ArbitraryExistingPojo {
|
||||
|
||||
private TestBean friend;
|
||||
|
@ -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 {
|
|||
}
|
||||
|
||||
@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 {
|
|||
|
||||
|
||||
@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 {
|
|||
|
||||
|
||||
@Aspect
|
||||
@SuppressWarnings("unused")
|
||||
private static class AspectThatWillNotBeUsed extends AbstractBeanConfigurerAspect {
|
||||
|
||||
@Pointcut("initialization(ClassThatWillNotActuallyBeWired.new(..)) && this(beanInstance)")
|
||||
|
|
|
@ -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.*;
|
|||
* 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.
|
||||
|
|
|
@ -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 {
|
|||
}
|
||||
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private static class ContainerBean {
|
||||
|
||||
private ContainedBean[] containedBeans;
|
||||
|
@ -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 {
|
|||
}
|
||||
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private static class MethodSignatureBean {
|
||||
|
||||
public void doSomething() {
|
||||
|
|
|
@ -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;
|
|||
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 {
|
|||
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 {
|
|||
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 {
|
|||
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 {
|
|||
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 {
|
|||
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 {
|
|||
@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));
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -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 {
|
|||
}
|
||||
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private static class NestedGenericCollectionBean extends BaseGenericCollectionBean {
|
||||
|
||||
private Map<String, Integer> mapOfInteger;
|
||||
|
@ -544,6 +544,7 @@ public class BeanWrapperGenericsTests {
|
|||
}
|
||||
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private static class ComplexMapHolder {
|
||||
|
||||
private Map<List<Integer>, List<Long>> genericMap;
|
||||
|
|
|
@ -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 {
|
|||
}
|
||||
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private static class NoRead {
|
||||
|
||||
public void setAge(int age) {
|
||||
|
@ -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 {
|
|||
}
|
||||
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private static class PropsTester {
|
||||
|
||||
private Properties props;
|
||||
|
@ -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 {
|
|||
}
|
||||
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private static class ThrowsException {
|
||||
|
||||
public void doSomething(Throwable t) throws Throwable {
|
||||
|
@ -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 {
|
|||
}
|
||||
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private static class NumberPropertyBean {
|
||||
|
||||
private byte myPrimitiveByte;
|
||||
|
@ -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 {
|
|||
}
|
||||
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private static class Employee extends TestBean {
|
||||
|
||||
private String co;
|
||||
|
|
|
@ -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 {
|
|||
}
|
||||
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private static class TestBean {
|
||||
|
||||
private Properties properties;
|
||||
|
|
|
@ -974,7 +974,6 @@ public class ExtendedBeanInfoTests {
|
|||
}
|
||||
|
||||
static class WithStaticWriteMethod {
|
||||
@SuppressWarnings("unused")
|
||||
public static void setProp1(String prop1) {
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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 {
|
|||
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 {
|
|||
/**
|
||||
* Bean with a dependency on a {@link FactoryBean}.
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
private static class FactoryBeanDependentBean {
|
||||
|
||||
private FactoryBean<?> factoryBean;
|
||||
|
@ -2646,6 +2647,7 @@ public class DefaultListableBeanFactoryTests {
|
|||
}
|
||||
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private static class TestSecuredBean {
|
||||
|
||||
private String userName;
|
||||
|
@ -2675,6 +2677,7 @@ public class DefaultListableBeanFactoryTests {
|
|||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private static class KnowsIfInstantiated {
|
||||
|
||||
private static boolean instantiated;
|
||||
|
|
|
@ -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 {
|
|||
|
||||
@Test
|
||||
public void testWithNoScopes() throws Exception {
|
||||
Scope scope = mock(Scope.class);
|
||||
CustomScopeConfigurer figurer = new CustomScopeConfigurer();
|
||||
figurer.postProcessBeanFactory(factory);
|
||||
}
|
||||
|
|
|
@ -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 {
|
|||
ppc.postProcessBeanFactory(factory);
|
||||
|
||||
TestBean tb = (TestBean) factory.getBean("tb");
|
||||
assertNotNull(tb);
|
||||
assertEquals(0, factory.getAliases("tb").length);
|
||||
}
|
||||
|
||||
|
|
|
@ -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()]);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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 {
|
|||
}
|
||||
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private static class QualifiedTestBean {
|
||||
|
||||
@TestQualifier
|
||||
|
@ -226,6 +227,7 @@ public class QualifierAnnotationAutowireBeanFactoryTests {
|
|||
}
|
||||
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private static class Person {
|
||||
|
||||
private String name;
|
||||
|
|
|
@ -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 {
|
|||
private DefaultListableBeanFactory beanFactory;
|
||||
private SecurityContextProvider provider;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private static class NonPrivilegedBean {
|
||||
|
||||
private String expectedName;
|
||||
|
@ -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 {
|
|||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private static class NonPrivilegedFactoryBean implements SmartFactoryBean {
|
||||
private String expectedName;
|
||||
|
||||
|
@ -204,6 +207,7 @@ public class CallbacksSecurityTests {
|
|||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private static class NonPrivilegedFactory {
|
||||
|
||||
private final String expectedName;
|
||||
|
@ -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"));
|
||||
|
|
|
@ -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 {
|
|||
|
||||
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 {
|
|||
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 {
|
|||
|
||||
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 {
|
|||
*/
|
||||
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());
|
||||
}
|
||||
|
|
|
@ -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 {
|
|||
return this.tb;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private TestBean privateGetTestBean() {
|
||||
return this.tb;
|
||||
}
|
||||
|
|
|
@ -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 {
|
|||
}
|
||||
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
@SuppressWarnings({ "serial", "unused" })
|
||||
private static final class CollectionTypeWithNoNoArgCtor extends ArrayList<Object> {
|
||||
public CollectionTypeWithNoNoArgCtor(String anArg) {
|
||||
}
|
||||
|
|
|
@ -1506,6 +1506,7 @@ public class CustomEditorTests {
|
|||
}
|
||||
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private static class PrimitiveArrayBean {
|
||||
|
||||
private byte[] byteArray;
|
||||
|
@ -1530,6 +1531,7 @@ public class CustomEditorTests {
|
|||
}
|
||||
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private static class CharBean {
|
||||
|
||||
private char myChar;
|
||||
|
@ -1554,6 +1556,7 @@ public class CustomEditorTests {
|
|||
}
|
||||
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private static class OldCollectionsBean {
|
||||
|
||||
private Vector<?> vector;
|
||||
|
|
|
@ -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 {
|
|||
}
|
||||
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private static class Dog implements Comparable<Object> {
|
||||
|
||||
private String nickName;
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -65,7 +65,6 @@ public class FooServiceImpl implements FooService {
|
|||
|
||||
private boolean initCalled = false;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
@PostConstruct
|
||||
private void init() {
|
||||
if (this.initCalled) {
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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 {
|
|||
}
|
||||
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private static class QualifiedFieldWithBaseQualifierDefaultValueTestBean {
|
||||
|
||||
@Inject
|
||||
|
|
|
@ -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 {
|
|||
}
|
||||
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private static class NonQualifiedTestBean {
|
||||
|
||||
@Autowired
|
||||
|
@ -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 {
|
|||
}
|
||||
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private static class Person {
|
||||
|
||||
private String name;
|
||||
|
|
|
@ -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 {
|
|||
* @author Rod Johnson
|
||||
* @author Juergen Hoeller
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
class FactoryMethods {
|
||||
|
||||
public static FactoryMethods nullInstance() {
|
||||
|
|
|
@ -133,7 +133,6 @@ public class AnnotationConfigApplicationContextTests {
|
|||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Test
|
||||
public void getBeanByTypeAmbiguityRaisesException() {
|
||||
AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(TwoTestBeanConfig.class);
|
||||
|
|
|
@ -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"; }
|
||||
|
|
|
@ -700,6 +700,7 @@ public class CommonAnnotationBeanPostProcessorTests {
|
|||
}
|
||||
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private static class NullFactory {
|
||||
|
||||
public static Object create() {
|
||||
|
|
|
@ -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 {
|
|||
}
|
||||
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private static class DefaultsTestBean {
|
||||
|
||||
static int INIT_COUNT;
|
||||
|
@ -276,6 +277,7 @@ public class ComponentScanParserBeanDefinitionDefaultsTests {
|
|||
}
|
||||
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private static class PropertyDependencyTestBean {
|
||||
|
||||
private String name;
|
||||
|
@ -290,6 +292,7 @@ public class ComponentScanParserBeanDefinitionDefaultsTests {
|
|||
}
|
||||
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private static class ConstructorDependencyTestBean {
|
||||
|
||||
private String name;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -272,6 +272,7 @@ public class ConfigurationClassProcessingTests {
|
|||
}
|
||||
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
static class ConfigWithPostProcessor extends ConfigWithPrototypeBean {
|
||||
|
||||
@Value("${myProp}")
|
||||
|
@ -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 {
|
|||
}
|
||||
return bean;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object postProcessAfterInitialization(Object bean, String beanName) {
|
||||
return bean;
|
||||
}
|
||||
|
||||
public int getOrder() {
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -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 {
|
|||
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -130,7 +130,6 @@ public class FormattingConversionServiceFactoryBeanTests {
|
|||
|
||||
private static class TestBean {
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
@NumberFormat(style = Style.PERCENT)
|
||||
private double percent;
|
||||
|
||||
|
|
|
@ -393,7 +393,6 @@ public class FormattingConversionServiceTests {
|
|||
|
||||
private static class ModelWithSubclassField {
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
@org.springframework.format.annotation.DateTimeFormat(style = "S-")
|
||||
public MyDate date;
|
||||
}
|
||||
|
|
|
@ -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 {
|
||||
|
||||
|
|
|
@ -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 {
|
|||
protected void someProtectedMethod() {
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private void somePrivateMethod() {
|
||||
}
|
||||
|
||||
protected void getSomething() {
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private void getSomethingElse() {
|
||||
}
|
||||
|
||||
|
|
|
@ -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 {
|
|||
|
||||
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 {
|
|||
|
||||
public void testRegisterAttributes() throws Exception {
|
||||
IJmxTestBean bean = getBean();
|
||||
assertNotNull(bean);
|
||||
MBeanInfo inf = getMBeanInfo();
|
||||
assertEquals("Incorrect number of attributes registered",
|
||||
getExpectedAttributeCount(), inf.getAttributes().length);
|
||||
|
|
|
@ -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
|
|||
|
||||
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
|
|||
|
||||
public void testWithNonInterface() throws Exception {
|
||||
try {
|
||||
InterfaceBasedMBeanInfoAssembler assembler = getWithMapping("JmxTestBean");
|
||||
getWithMapping("JmxTestBean");
|
||||
fail("Should have thrown IllegalArgumentException");
|
||||
}
|
||||
catch (IllegalArgumentException ex) {
|
||||
|
|
|
@ -74,7 +74,6 @@ public class EnableAsyncTests {
|
|||
}
|
||||
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Test
|
||||
public void withAsyncBeanWithExecutorQualifiedByName() throws ExecutionException, InterruptedException {
|
||||
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
|
||||
|
|
|
@ -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 {
|
|||
try {
|
||||
timerFactoryBean.setScheduledTimerTasks(tasks);
|
||||
timerFactoryBean.afterPropertiesSet();
|
||||
assertTrue(timerFactoryBean.getObject() instanceof Timer);
|
||||
assertThat(timerFactoryBean.getObject(), instanceOf(Timer.class));
|
||||
timerTask0.run();
|
||||
timerTask1.run();
|
||||
timerTask2.run();
|
||||
|
|
|
@ -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 {
|
|||
}
|
||||
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private static class Book {
|
||||
|
||||
private String Title;
|
||||
|
@ -1728,6 +1730,7 @@ public class DataBinderTests extends TestCase {
|
|||
}
|
||||
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private static class GrowingList<E> extends AbstractList<E> {
|
||||
|
||||
private List<E> list;
|
||||
|
|
|
@ -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
|
|||
/**
|
||||
* VFS visitor for path matching purposes.
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
private static class PatternVirtualFileVisitor implements InvocationHandler {
|
||||
|
||||
private final String subPattern;
|
||||
|
|
|
@ -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 {
|
|||
}
|
||||
|
||||
/**
|
||||
* 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 {
|
|||
}
|
||||
|
||||
/**
|
||||
* 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 {
|
|||
}
|
||||
|
||||
/**
|
||||
* 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 {
|
|||
}
|
||||
|
||||
/**
|
||||
* 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) {
|
||||
|
|
|
@ -560,6 +560,7 @@ public class BridgeMethodResolverTests {
|
|||
}
|
||||
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private static class StringGenericParameter implements GenericParameter<String> {
|
||||
|
||||
@Override
|
||||
|
@ -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 {
|
|||
}
|
||||
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private static abstract class AbstractImplementsInterface<D extends DomainObjectSuper> implements IGenericInterface<D> {
|
||||
|
||||
@Override
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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 {
|
|||
|
||||
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 {
|
|||
}
|
||||
|
||||
|
||||
@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");
|
||||
|
||||
|
||||
|
|
|
@ -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 {
|
|||
}
|
||||
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private static class SomeSubClassOfSomeComponentInterface implements SomeComponentInterface {
|
||||
}
|
||||
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private static class SomeSubClassOfSomeComponent extends SomeComponent {
|
||||
}
|
||||
|
||||
|
@ -139,10 +141,12 @@ public class AnnotationTypeFilterTests {
|
|||
}
|
||||
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private static class SomeSubclassOfSomeClassMarkedWithNonInheritedAnnotation extends SomeClassMarkedWithNonInheritedAnnotation {
|
||||
}
|
||||
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private static class SomeNonCandidateClass {
|
||||
}
|
||||
|
||||
|
|
|
@ -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 {
|
|||
}
|
||||
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private static class TestInterfaceImpl implements TestInterface {
|
||||
}
|
||||
|
||||
|
@ -89,6 +90,7 @@ public class AssignableTypeFilterTests extends TestCase {
|
|||
}
|
||||
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private static class SomeDaoLikeImpl extends SimpleJdbcDaoSupport implements SomeDaoLikeInterface {
|
||||
}
|
||||
|
||||
|
|
|
@ -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.
|
||||
*
|
||||
|
|
|
@ -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 */
|
||||
}
|
||||
|
|
|
@ -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 {
|
|||
}
|
||||
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public static class Greeter {
|
||||
|
||||
// should handle Salesman (only interface)
|
||||
|
|
|
@ -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 {
|
|||
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 {
|
|||
// 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 {
|
|||
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 {
|
|||
// 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);
|
||||
|
|
|
@ -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 @@
|
|||
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,7 +84,8 @@ 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);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
|||
|
||||
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 {
|
|||
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);
|
||||
|
|
|
@ -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 {
|
|||
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 {
|
|||
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 {
|
|||
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 {
|
|||
ExpressionParser parser = new SpelExpressionParser();
|
||||
StandardEvaluationContext evaluationContext = new StandardEvaluationContext(new BooleanHolder());
|
||||
Object value = parser.parseExpression("primitiveProperty").getValue(evaluationContext);
|
||||
assertNotNull(value);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -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 {
|
|||
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 {
|
|||
|
||||
private String tableName;
|
||||
|
||||
private String type;
|
||||
|
||||
public void setCatalogName(String catalogName) {
|
||||
this.catalogName = catalogName;
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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
|
|||
return this.newConnectionHolder;
|
||||
}
|
||||
|
||||
public boolean hasTransaction() {
|
||||
return (getConnectionHolder() != null && getConnectionHolder().isTransactionActive());
|
||||
}
|
||||
|
||||
public void setMustRestoreAutoCommit(boolean mustRestoreAutoCommit) {
|
||||
this.mustRestoreAutoCommit = mustRestoreAutoCommit;
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -81,6 +81,8 @@ public class BeanPropertySqlParameterSourceTests {
|
|||
assertFalse(source.hasValue("noOp"));
|
||||
}
|
||||
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private static final class NoReadableProperties {
|
||||
|
||||
public void setNoOp(String noOp) {
|
||||
|
|
|
@ -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 {
|
|||
* Bug 729170
|
||||
*/
|
||||
public void testMalformedSqlStateCodes() {
|
||||
String sql = "SELECT FOO FROM BAR";
|
||||
SQLException sex = new SQLException("Message", null, 1);
|
||||
testMalformedSqlStateCode(sex);
|
||||
|
||||
|
|
|
@ -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 {
|
|||
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 {
|
|||
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;
|
||||
}
|
||||
});
|
||||
|
|
|
@ -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 {
|
|||
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 {
|
|||
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 {
|
|||
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 {
|
|||
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 {
|
|||
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();
|
||||
|
||||
|
|
|
@ -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;
|
|||
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 {
|
|||
}
|
||||
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private static class StubActiveMQActivationSpec extends StubJmsActivationSpec {
|
||||
|
||||
private int maxSessions;
|
||||
|
@ -133,6 +134,7 @@ public class DefaultJmsActivationSpecFactoryTests extends TestCase {
|
|||
}
|
||||
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private static class StubWebSphereActivationSpecImpl extends StubJmsActivationSpec {
|
||||
|
||||
private Destination destination;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -77,6 +77,7 @@ public class JdoInterceptorTests {
|
|||
}
|
||||
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private static class TestInvocation implements MethodInvocation {
|
||||
|
||||
private PersistenceManagerFactory persistenceManagerFactory;
|
||||
|
|
|
@ -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
|
|||
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();
|
||||
|
|
|
@ -198,6 +198,7 @@ public class JpaInterceptorTests {
|
|||
}
|
||||
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private static class TestInvocation implements MethodInvocation {
|
||||
|
||||
private EntityManagerFactory entityManagerFactory;
|
||||
|
|
|
@ -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 {
|
|||
private String s = "Hello";
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private JAXBElement<DummyRootElement> createDummyRootElement() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private JAXBElement<DummyType> createDummyType() {
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
|
|
|
@ -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
|
|||
|
||||
private final LoadTimeWeaver ltw;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public LoadTimeWeaverInjectingBeanPostProcessor(LoadTimeWeaver ltw) {
|
||||
this.ltw = ltw;
|
||||
}
|
||||
|
@ -346,6 +347,7 @@ public abstract class AbstractJpaTests extends AbstractAnnotationAwareTransactio
|
|||
|
||||
private final ClassLoader shadowingClassLoader;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public ShadowingLoadTimeWeaver(ClassLoader shadowingClassLoader) {
|
||||
this.shadowingClassLoader = shadowingClassLoader;
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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 {
|
|||
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) {
|
||||
|
|
|
@ -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;
|
|||
|
||||
/**
|
||||
* 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.
|
||||
*
|
||||
|
|
|
@ -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
|
|||
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++) {
|
||||
|
|
|
@ -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");
|
||||
|
|
|
@ -140,25 +140,21 @@ 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);
|
||||
|
|
|
@ -299,7 +299,6 @@ public class ModelAttributeMethodProcessorTests {
|
|||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
@ModelAttribute("modelAttrName")
|
||||
private String annotatedReturnValue() {
|
||||
return null;
|
||||
|
|
|
@ -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 {
|
|||
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;
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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;
|
|||
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;
|
|||
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;
|
|||
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;
|
|||
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 {
|
|||
|
||||
@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, "-"));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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 {
|
|||
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 {
|
|||
else {
|
||||
assertTrue("name param set", pname.equals(command.getName()));
|
||||
}
|
||||
|
||||
//String page = request.getParameter("age");
|
||||
// if (page == null)
|
||||
// assertTrue("age default", command.getAge() == 0);
|
||||
// else
|
||||
|
|
|
@ -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 @@
|
|||
|
||||
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 {
|
|||
}
|
||||
|
||||
public void testParamSupport() {
|
||||
assertTrue(tag instanceof ParamAware);
|
||||
assertThat(tag, instanceOf(ParamAware.class));
|
||||
}
|
||||
|
||||
public void testDoStartTag() throws JspException {
|
||||
|
|
|
@ -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 {
|
|||
|
||||
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 {
|
|||
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) {
|
||||
|
|
|
@ -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 @@
|
|||
|
||||
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 {
|
|||
}
|
||||
});
|
||||
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()));
|
||||
|
|
|
@ -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 @@
|
|||
|
||||
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;
|
|||
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 {
|
|||
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 {
|
|||
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 {
|
|||
}
|
||||
});
|
||||
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 {
|
|||
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 {
|
|||
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 {
|
|||
});
|
||||
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()));
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 {
|
|||
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…
Reference in New Issue