Remove trailing whitespace in source files
find . -type f -name "*.java" -or -name "*.aj" | \
xargs perl -p -i -e "s/[ \t]*$//g" {} \;
Issue: SPR-10127
This commit is contained in:
committed by
Chris Beams
parent
44a474a014
commit
1762157ad1
@@ -1,12 +1,12 @@
|
||||
/*
|
||||
* Copyright 2002-2008 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 the License at
|
||||
*
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
@@ -25,7 +25,7 @@ import java.util.Map;
|
||||
* @author Rod Johnson
|
||||
* @author Chris Beams
|
||||
*/
|
||||
public abstract class AbstractPropertyValuesTests {
|
||||
public abstract class AbstractPropertyValuesTests {
|
||||
|
||||
/**
|
||||
* Must contain: forname=Tony surname=Blair age=50
|
||||
|
||||
@@ -36,7 +36,7 @@ import test.beans.TestBean;
|
||||
|
||||
/**
|
||||
* Unit tests for {@link BeanUtils}.
|
||||
*
|
||||
*
|
||||
* @author Juergen Hoeller
|
||||
* @author Rob Harrop
|
||||
* @author Chris Beams
|
||||
|
||||
@@ -71,12 +71,12 @@ public class BeanWrapperAutoGrowingTests {
|
||||
@Test
|
||||
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);
|
||||
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);
|
||||
assertNotNull(wrapper.getPropertyValue("array[0]"));
|
||||
assertNotNull(wrapper.getPropertyValue("array[1]"));
|
||||
assertNotNull(wrapper.getPropertyValue("array[2]"));
|
||||
@@ -94,7 +94,7 @@ public class BeanWrapperAutoGrowingTests {
|
||||
public void getPropertyValueAutoGrowList() {
|
||||
assertNotNull(wrapper.getPropertyValue("list[0]"));
|
||||
assertEquals(1, bean.getList().size());
|
||||
assertTrue(bean.getList().get(0) instanceof Bean);
|
||||
assertTrue(bean.getList().get(0) instanceof Bean);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -107,11 +107,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);
|
||||
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);
|
||||
assertNotNull(wrapper.getPropertyValue("list[0]"));
|
||||
assertNotNull(wrapper.getPropertyValue("list[1]"));
|
||||
assertNotNull(wrapper.getPropertyValue("list[2]"));
|
||||
@@ -167,9 +167,9 @@ public class BeanWrapperAutoGrowingTests {
|
||||
private Bean[] array;
|
||||
|
||||
private Bean[][] multiArray;
|
||||
|
||||
|
||||
private List<Bean> list;
|
||||
|
||||
|
||||
private List<List<Bean>> multiList;
|
||||
|
||||
private List listNotParameterized;
|
||||
@@ -215,7 +215,7 @@ public class BeanWrapperAutoGrowingTests {
|
||||
public void setList(List<Bean> list) {
|
||||
this.list = list;
|
||||
}
|
||||
|
||||
|
||||
public List<List<Bean>> getMultiList() {
|
||||
return multiList;
|
||||
}
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
/*
|
||||
* Copyright 2002-2008 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 the License at
|
||||
*
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
@@ -50,7 +50,7 @@ public final class ConcurrentBeanWrapperTests {
|
||||
performSet();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testConcurrent() {
|
||||
for (int i = 0; i < 10; i++) {
|
||||
|
||||
@@ -36,7 +36,7 @@ public final class MutablePropertyValuesTests extends AbstractPropertyValuesTest
|
||||
pvs.addPropertyValue(new PropertyValue("surname", "Blair"));
|
||||
pvs.addPropertyValue(new PropertyValue("age", "50"));
|
||||
doTestTony(pvs);
|
||||
|
||||
|
||||
MutablePropertyValues deepCopy = new MutablePropertyValues(pvs);
|
||||
doTestTony(deepCopy);
|
||||
deepCopy.setPropertyValueAt(new PropertyValue("name", "Gordon"), 0);
|
||||
|
||||
@@ -45,12 +45,12 @@ import static test.util.TestResourceUtils.qualifiedResource;
|
||||
* @since 04.07.2003
|
||||
*/
|
||||
public final class BeanFactoryUtilsTests {
|
||||
|
||||
|
||||
private static final Class<?> CLASS = BeanFactoryUtilsTests.class;
|
||||
private static final Resource ROOT_CONTEXT = qualifiedResource(CLASS, "root.xml");
|
||||
private static final Resource MIDDLE_CONTEXT = qualifiedResource(CLASS, "middle.xml");
|
||||
private static final Resource LEAF_CONTEXT = qualifiedResource(CLASS, "leaf.xml");
|
||||
private static final Resource DEPENDENT_BEANS_CONTEXT = qualifiedResource(CLASS, "dependentBeans.xml");
|
||||
private static final Resource ROOT_CONTEXT = qualifiedResource(CLASS, "root.xml");
|
||||
private static final Resource MIDDLE_CONTEXT = qualifiedResource(CLASS, "middle.xml");
|
||||
private static final Resource LEAF_CONTEXT = qualifiedResource(CLASS, "leaf.xml");
|
||||
private static final Resource DEPENDENT_BEANS_CONTEXT = qualifiedResource(CLASS, "dependentBeans.xml");
|
||||
|
||||
private ConfigurableListableBeanFactory listableBeanFactory;
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ public final class ConcurrentBeanFactoryTests {
|
||||
|
||||
private static final Log logger = LogFactory.getLog(ConcurrentBeanFactoryTests.class);
|
||||
private static final Resource CONTEXT = qualifiedResource(ConcurrentBeanFactoryTests.class, "context.xml");
|
||||
|
||||
|
||||
private static final SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("yyyy/MM/dd");
|
||||
private static final Date DATE_1, DATE_2;
|
||||
|
||||
|
||||
@@ -2539,38 +2539,38 @@ public class DefaultListableBeanFactoryTests {
|
||||
return this.userName;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Bean that changes state on a business invocation, so that
|
||||
* we can check whether it's been invoked
|
||||
* @author Rod Johnson
|
||||
*/
|
||||
private static class SideEffectBean {
|
||||
|
||||
|
||||
private int count;
|
||||
|
||||
|
||||
public void setCount(int count) {
|
||||
this.count = count;
|
||||
}
|
||||
|
||||
|
||||
public int getCount() {
|
||||
return this.count;
|
||||
}
|
||||
|
||||
|
||||
public void doWork() {
|
||||
++count;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
private static class KnowsIfInstantiated {
|
||||
|
||||
|
||||
private static boolean instantiated;
|
||||
|
||||
|
||||
public static void clearInstantiationRecord() {
|
||||
instantiated = false;
|
||||
}
|
||||
|
||||
|
||||
public static boolean wasInstantiated() {
|
||||
return instantiated;
|
||||
}
|
||||
|
||||
@@ -40,31 +40,31 @@ public class FactoryBeanLookupTests {
|
||||
beanFactory = new XmlBeanFactory(
|
||||
new ClassPathResource("FactoryBeanLookupTests-context.xml", this.getClass()));
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void factoryBeanLookupByNameDereferencing() {
|
||||
Object fooFactory = beanFactory.getBean("&fooFactory");
|
||||
assertThat(fooFactory, instanceOf(FooFactoryBean.class));
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void factoryBeanLookupByType() {
|
||||
FooFactoryBean fooFactory = beanFactory.getBean(FooFactoryBean.class);
|
||||
assertNotNull(fooFactory);
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void factoryBeanLookupByTypeAndNameDereference() {
|
||||
FooFactoryBean fooFactory = beanFactory.getBean("&fooFactory", FooFactoryBean.class);
|
||||
assertNotNull(fooFactory);
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void factoryBeanObjectLookupByName() {
|
||||
Object fooFactory = beanFactory.getBean("fooFactory");
|
||||
assertThat(fooFactory, instanceOf(Foo.class));
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void factoryBeanObjectLookupByNameAndType() {
|
||||
Foo foo = beanFactory.getBean("fooFactory", Foo.class);
|
||||
|
||||
@@ -33,9 +33,9 @@ import org.springframework.util.Assert;
|
||||
public final class FactoryBeanTests {
|
||||
|
||||
private static final Class<?> CLASS = FactoryBeanTests.class;
|
||||
private static final Resource RETURNS_NULL_CONTEXT = qualifiedResource(CLASS, "returnsNull.xml");
|
||||
private static final Resource WITH_AUTOWIRING_CONTEXT = qualifiedResource(CLASS, "withAutowiring.xml");
|
||||
|
||||
private static final Resource RETURNS_NULL_CONTEXT = qualifiedResource(CLASS, "returnsNull.xml");
|
||||
private static final Resource WITH_AUTOWIRING_CONTEXT = qualifiedResource(CLASS, "withAutowiring.xml");
|
||||
|
||||
@Test
|
||||
public void testFactoryBeanReturnsNull() throws Exception {
|
||||
XmlBeanFactory factory = new XmlBeanFactory(RETURNS_NULL_CONTEXT);
|
||||
@@ -46,10 +46,10 @@ public final class FactoryBeanTests {
|
||||
@Test
|
||||
public void testFactoryBeansWithAutowiring() throws Exception {
|
||||
XmlBeanFactory factory = new XmlBeanFactory(WITH_AUTOWIRING_CONTEXT);
|
||||
|
||||
|
||||
BeanFactoryPostProcessor ppc = (BeanFactoryPostProcessor) factory.getBean("propertyPlaceholderConfigurer");
|
||||
ppc.postProcessBeanFactory(factory);
|
||||
|
||||
|
||||
Alpha alpha = (Alpha) factory.getBean("alpha");
|
||||
Beta beta = (Beta) factory.getBean("beta");
|
||||
Gamma gamma = (Gamma) factory.getBean("gamma");
|
||||
@@ -63,10 +63,10 @@ public final class FactoryBeanTests {
|
||||
@Test
|
||||
public void testFactoryBeansWithIntermediateFactoryBeanAutowiringFailure() throws Exception {
|
||||
XmlBeanFactory factory = new XmlBeanFactory(WITH_AUTOWIRING_CONTEXT);
|
||||
|
||||
|
||||
BeanFactoryPostProcessor ppc = (BeanFactoryPostProcessor) factory.getBean("propertyPlaceholderConfigurer");
|
||||
ppc.postProcessBeanFactory(factory);
|
||||
|
||||
|
||||
Beta beta = (Beta) factory.getBean("beta");
|
||||
Alpha alpha = (Alpha) factory.getBean("alpha");
|
||||
Gamma gamma = (Gamma) factory.getBean("gamma");
|
||||
|
||||
@@ -26,7 +26,7 @@ import org.springframework.util.ClassUtils;
|
||||
|
||||
/**
|
||||
* Unit tests for {@link SingletonBeanFactoryLocator}.
|
||||
*
|
||||
*
|
||||
* @author Colin Sampaleanu
|
||||
* @author Chris Beams
|
||||
*/
|
||||
@@ -38,7 +38,7 @@ public class SingletonBeanFactoryLocatorTests {
|
||||
public void testBasicFunctionality() {
|
||||
SingletonBeanFactoryLocator facLoc = new SingletonBeanFactoryLocator(
|
||||
"classpath*:" + ClassUtils.addResourcePathToPackagePath(CLASS, REF1_XML));
|
||||
|
||||
|
||||
basicFunctionalityTest(facLoc);
|
||||
}
|
||||
|
||||
@@ -81,7 +81,7 @@ public class SingletonBeanFactoryLocatorTests {
|
||||
BeanFactoryLocator facLoc = SingletonBeanFactoryLocator.getInstance(
|
||||
ClassUtils.addResourcePathToPackagePath(CLASS, REF1_XML));
|
||||
getInstanceTest1(facLoc);
|
||||
|
||||
|
||||
facLoc = SingletonBeanFactoryLocator.getInstance(
|
||||
"classpath*:/" + ClassUtils.addResourcePathToPackagePath(CLASS, REF1_XML));
|
||||
getInstanceTest2(facLoc);
|
||||
@@ -90,7 +90,7 @@ public class SingletonBeanFactoryLocatorTests {
|
||||
facLoc = SingletonBeanFactoryLocator.getInstance(
|
||||
"classpath:" + ClassUtils.addResourcePathToPackagePath(CLASS, REF1_XML));
|
||||
getInstanceTest3(facLoc);
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -109,12 +109,12 @@ public class SingletonBeanFactoryLocatorTests {
|
||||
fac = bfr3.getFactory();
|
||||
tb = (TestBean) fac.getBean("beans1.bean1");
|
||||
assertTrue(tb.getName().equals("was beans1.bean1"));
|
||||
|
||||
|
||||
BeanFactoryReference bfr4 = facLoc.useBeanFactory("a.qualified.name.which.is.an.alias");
|
||||
fac = bfr4.getFactory();
|
||||
tb = (TestBean) fac.getBean("beans1.bean1");
|
||||
assertTrue(tb.getName().equals("was beans1.bean1"));
|
||||
|
||||
|
||||
bfr.release();
|
||||
bfr3.release();
|
||||
bfr2.release();
|
||||
@@ -152,7 +152,7 @@ public class SingletonBeanFactoryLocatorTests {
|
||||
bfr4.release();
|
||||
bfr3.release();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Worker method so subclass can use it too
|
||||
*/
|
||||
|
||||
@@ -45,7 +45,7 @@ import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* Unit tests for {@link AutowiredAnnotationBeanPostProcessor}.
|
||||
*
|
||||
*
|
||||
* @author Juergen Hoeller
|
||||
* @author Mark Fisher
|
||||
* @author Sam Brannen
|
||||
|
||||
@@ -30,7 +30,7 @@ import org.springframework.core.io.Resource;
|
||||
|
||||
/**
|
||||
* Unit tests for {@link CustomAutowireConfigurer}.
|
||||
*
|
||||
*
|
||||
* @author Mark Fisher
|
||||
* @author Juergen Hoeller
|
||||
* @author Chris Beams
|
||||
|
||||
@@ -39,7 +39,7 @@ import org.springframework.beans.propertyeditors.CustomDateEditor;
|
||||
|
||||
/**
|
||||
* Unit tests for {@link CustomEditorConfigurer}.
|
||||
*
|
||||
*
|
||||
* @author Juergen Hoeller
|
||||
* @author Chris Beams
|
||||
* @since 31.07.2004
|
||||
|
||||
@@ -30,13 +30,13 @@ import test.beans.TestBean;
|
||||
|
||||
/**
|
||||
* Unit tests for {@link FieldRetrievingFactoryBean}.
|
||||
*
|
||||
*
|
||||
* @author Juergen Hoeller
|
||||
* @author Chris Beams
|
||||
* @since 31.07.2004
|
||||
*/
|
||||
public final class FieldRetrievingFactoryBeanTests {
|
||||
|
||||
|
||||
private static final Resource CONTEXT =
|
||||
qualifiedResource(FieldRetrievingFactoryBeanTests.class, "context.xml");
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ import org.springframework.util.MethodInvoker;
|
||||
|
||||
/**
|
||||
* Unit tests for {@link MethodInvokingFactoryBean}.
|
||||
*
|
||||
*
|
||||
* @author Colin Sampaleanu
|
||||
* @author Juergen Hoeller
|
||||
* @author Chris Beams
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
/*
|
||||
* Copyright 2002-2010 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 the License at
|
||||
*
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
@@ -42,7 +42,7 @@ public class ObjectFactoryCreatingFactoryBeanTests {
|
||||
|
||||
private static final Resource CONTEXT =
|
||||
qualifiedResource(ObjectFactoryCreatingFactoryBeanTests.class, "context.xml");
|
||||
|
||||
|
||||
private XmlBeanFactory beanFactory;
|
||||
|
||||
@Before
|
||||
@@ -116,7 +116,7 @@ public class ObjectFactoryCreatingFactoryBeanTests {
|
||||
ObjectFactory<?> objectFactory = (ObjectFactory<?>) factory.getObject();
|
||||
Object actualSingleton = objectFactory.getObject();
|
||||
assertSame(expectedSingleton, actualSingleton);
|
||||
|
||||
|
||||
verify(beanFactory);
|
||||
}
|
||||
|
||||
|
||||
@@ -26,13 +26,13 @@ import org.springframework.core.io.Resource;
|
||||
|
||||
/**
|
||||
* Unit tests for {@link PropertiesFactoryBean}.
|
||||
*
|
||||
*
|
||||
* @author Juergen Hoeller
|
||||
* @author Chris Beams
|
||||
* @since 01.11.2003
|
||||
*/
|
||||
public final class PropertiesFactoryBeanTests {
|
||||
|
||||
|
||||
private static final Class<?> CLASS = PropertiesFactoryBeanTests.class;
|
||||
private static final Resource TEST_PROPS = qualifiedResource(CLASS, "test.properties");
|
||||
private static final Resource TEST_PROPS_XML = qualifiedResource(CLASS, "test.properties.xml");
|
||||
|
||||
@@ -28,13 +28,13 @@ import test.beans.TestBean;
|
||||
|
||||
/**
|
||||
* Unit tests for {@link PropertyPathFactoryBean}.
|
||||
*
|
||||
*
|
||||
* @author Juergen Hoeller
|
||||
* @author Chris Beams
|
||||
* @since 04.10.2004
|
||||
*/
|
||||
public class PropertyPathFactoryBeanTests {
|
||||
|
||||
|
||||
private static final Resource CONTEXT = qualifiedResource(PropertyPathFactoryBeanTests.class, "context.xml");
|
||||
|
||||
@Test
|
||||
|
||||
@@ -32,7 +32,7 @@ import org.springframework.core.NestedRuntimeException;
|
||||
|
||||
/**
|
||||
* Unit tests for {@link ServiceLocatorFactoryBean}.
|
||||
*
|
||||
*
|
||||
* @author Colin Sampaleanu
|
||||
* @author Rick Evans
|
||||
* @author Chris Beams
|
||||
@@ -40,7 +40,7 @@ import org.springframework.core.NestedRuntimeException;
|
||||
public final class ServiceLocatorFactoryBeanTests {
|
||||
|
||||
private DefaultListableBeanFactory bf;
|
||||
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
bf = new DefaultListableBeanFactory();
|
||||
@@ -53,7 +53,7 @@ public final class ServiceLocatorFactoryBeanTests {
|
||||
genericBeanDefinition(ServiceLocatorFactoryBean.class)
|
||||
.addPropertyValue("serviceLocatorInterface", TestServiceLocator.class)
|
||||
.getBeanDefinition());
|
||||
|
||||
|
||||
TestServiceLocator factory = (TestServiceLocator) bf.getBean("factory");
|
||||
TestService testService = factory.getTestService();
|
||||
assertNotNull(testService);
|
||||
@@ -75,13 +75,13 @@ public final class ServiceLocatorFactoryBeanTests {
|
||||
genericBeanDefinition(ServiceLocatorFactoryBean.class)
|
||||
.addPropertyValue("serviceLocatorInterface", TestService2Locator.class)
|
||||
.getBeanDefinition());
|
||||
|
||||
|
||||
try {
|
||||
TestServiceLocator factory = (TestServiceLocator) bf.getBean("factory");
|
||||
factory.getTestService();
|
||||
fail("Must fail on more than one matching type");
|
||||
} catch (NoSuchBeanDefinitionException ex) { /* expected */ }
|
||||
|
||||
|
||||
try {
|
||||
TestServiceLocator2 factory = (TestServiceLocator2) bf.getBean("factory2");
|
||||
factory.getTestService(null);
|
||||
@@ -114,7 +114,7 @@ public final class ServiceLocatorFactoryBeanTests {
|
||||
.addPropertyValue("serviceLocatorInterface", TestService2Locator.class)
|
||||
.addPropertyValue("serviceLocatorExceptionClass", CustomServiceLocatorException3.class)
|
||||
.getBeanDefinition());
|
||||
|
||||
|
||||
try {
|
||||
TestServiceLocator factory = (TestServiceLocator) bf.getBean("factory");
|
||||
factory.getTestService();
|
||||
@@ -123,7 +123,7 @@ public final class ServiceLocatorFactoryBeanTests {
|
||||
catch (CustomServiceLocatorException1 expected) {
|
||||
assertTrue(expected.getCause() instanceof NoSuchBeanDefinitionException);
|
||||
}
|
||||
|
||||
|
||||
try {
|
||||
TestServiceLocator2 factory2 = (TestServiceLocator2) bf.getBean("factory2");
|
||||
factory2.getTestService(null);
|
||||
@@ -132,7 +132,7 @@ public final class ServiceLocatorFactoryBeanTests {
|
||||
catch (CustomServiceLocatorException2 expected) {
|
||||
assertTrue(expected.getCause() instanceof NoSuchBeanDefinitionException);
|
||||
}
|
||||
|
||||
|
||||
try {
|
||||
TestService2Locator factory3 = (TestService2Locator) bf.getBean("factory3");
|
||||
factory3.getTestService();
|
||||
@@ -150,7 +150,7 @@ public final class ServiceLocatorFactoryBeanTests {
|
||||
|
||||
// test string-arg getter with null id
|
||||
TestServiceLocator2 factory = (TestServiceLocator2) bf.getBean("factory");
|
||||
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
TestService testBean = factory.getTestService(null);
|
||||
// now test with explicit id
|
||||
@@ -166,12 +166,12 @@ public final class ServiceLocatorFactoryBeanTests {
|
||||
public void testCombinedLocatorInterface() {
|
||||
bf.registerBeanDefinition("testService", genericBeanDefinition(TestService.class).getBeanDefinition());
|
||||
bf.registerAlias("testService", "1");
|
||||
|
||||
|
||||
bf.registerBeanDefinition("factory",
|
||||
genericBeanDefinition(ServiceLocatorFactoryBean.class)
|
||||
.addPropertyValue("serviceLocatorInterface", TestServiceLocator3.class)
|
||||
.getBeanDefinition());
|
||||
|
||||
|
||||
// StaticApplicationContext ctx = new StaticApplicationContext();
|
||||
// ctx.registerPrototype("testService", TestService.class, new MutablePropertyValues());
|
||||
// ctx.registerAlias("testService", "1");
|
||||
@@ -204,7 +204,7 @@ public final class ServiceLocatorFactoryBeanTests {
|
||||
.addPropertyValue("serviceLocatorInterface", TestServiceLocator3.class)
|
||||
.addPropertyValue("serviceMappings", "=testService1\n1=testService1\n2=testService2")
|
||||
.getBeanDefinition());
|
||||
|
||||
|
||||
// StaticApplicationContext ctx = new StaticApplicationContext();
|
||||
// ctx.registerPrototype("testService1", TestService.class, new MutablePropertyValues());
|
||||
// ctx.registerPrototype("testService2", ExtendedTestService.class, new MutablePropertyValues());
|
||||
|
||||
@@ -39,11 +39,11 @@ import test.beans.TestBean;
|
||||
* @author Chris Beams
|
||||
*/
|
||||
public final class SimpleScopeTests {
|
||||
|
||||
|
||||
private static final Resource CONTEXT = qualifiedResource(SimpleScopeTests.class, "context.xml");
|
||||
|
||||
private DefaultListableBeanFactory beanFactory;
|
||||
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
beanFactory = new DefaultListableBeanFactory();
|
||||
@@ -71,7 +71,7 @@ public final class SimpleScopeTests {
|
||||
XmlBeanDefinitionReader xbdr = new XmlBeanDefinitionReader(beanFactory);
|
||||
xbdr.loadBeanDefinitions(CONTEXT);
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testCanGetScopedObject() {
|
||||
TestBean tb1 = (TestBean) beanFactory.getBean("usesScope");
|
||||
|
||||
@@ -20,7 +20,7 @@ import org.springframework.beans.factory.ObjectFactory;
|
||||
|
||||
/**
|
||||
* Shared test types for this package.
|
||||
*
|
||||
*
|
||||
* @author Chris Beams
|
||||
*/
|
||||
final class TestTypes {}
|
||||
|
||||
@@ -36,7 +36,7 @@ import test.beans.TestBean;
|
||||
* @since 2.0
|
||||
*/
|
||||
public final class CustomProblemReporterTests {
|
||||
|
||||
|
||||
private static final Resource CONTEXT = qualifiedResource(CustomProblemReporterTests.class, "context.xml");
|
||||
|
||||
private CollatingProblemReporter problemReporter;
|
||||
|
||||
@@ -22,7 +22,7 @@ import org.junit.Test;
|
||||
|
||||
/**
|
||||
* Unit tests for {@link PassThroughSourceExtractor}.
|
||||
*
|
||||
*
|
||||
* @author Rick Evans
|
||||
* @author Chris Beams
|
||||
*/
|
||||
|
||||
@@ -53,9 +53,9 @@ public class QualifierAnnotationAutowireBeanFactoryTests {
|
||||
RootBeanDefinition rbd = new RootBeanDefinition(Person.class, cavs, null);
|
||||
lbf.registerBeanDefinition(JUERGEN, rbd);
|
||||
assertTrue(lbf.isAutowireCandidate(JUERGEN, null));
|
||||
assertTrue(lbf.isAutowireCandidate(JUERGEN,
|
||||
assertTrue(lbf.isAutowireCandidate(JUERGEN,
|
||||
new DependencyDescriptor(Person.class.getDeclaredField("name"), false)));
|
||||
assertTrue(lbf.isAutowireCandidate(JUERGEN,
|
||||
assertTrue(lbf.isAutowireCandidate(JUERGEN,
|
||||
new DependencyDescriptor(Person.class.getDeclaredField("name"), true)));
|
||||
}
|
||||
|
||||
@@ -68,16 +68,16 @@ public class QualifierAnnotationAutowireBeanFactoryTests {
|
||||
rbd.setAutowireCandidate(false);
|
||||
lbf.registerBeanDefinition(JUERGEN, rbd);
|
||||
assertFalse(lbf.isAutowireCandidate(JUERGEN, null));
|
||||
assertFalse(lbf.isAutowireCandidate(JUERGEN,
|
||||
assertFalse(lbf.isAutowireCandidate(JUERGEN,
|
||||
new DependencyDescriptor(Person.class.getDeclaredField("name"), false)));
|
||||
assertFalse(lbf.isAutowireCandidate(JUERGEN,
|
||||
assertFalse(lbf.isAutowireCandidate(JUERGEN,
|
||||
new DependencyDescriptor(Person.class.getDeclaredField("name"), true)));
|
||||
}
|
||||
|
||||
@Ignore
|
||||
@Test
|
||||
public void testAutowireCandidateWithFieldDescriptor() throws Exception {
|
||||
DefaultListableBeanFactory lbf = new DefaultListableBeanFactory();
|
||||
DefaultListableBeanFactory lbf = new DefaultListableBeanFactory();
|
||||
ConstructorArgumentValues cavs1 = new ConstructorArgumentValues();
|
||||
cavs1.addGenericArgumentValue(JUERGEN);
|
||||
RootBeanDefinition person1 = new RootBeanDefinition(Person.class, cavs1, null);
|
||||
@@ -101,7 +101,7 @@ public class QualifierAnnotationAutowireBeanFactoryTests {
|
||||
|
||||
@Test
|
||||
public void testAutowireCandidateExplicitlyFalseWithFieldDescriptor() throws Exception {
|
||||
DefaultListableBeanFactory lbf = new DefaultListableBeanFactory();
|
||||
DefaultListableBeanFactory lbf = new DefaultListableBeanFactory();
|
||||
ConstructorArgumentValues cavs = new ConstructorArgumentValues();
|
||||
cavs.addGenericArgumentValue(JUERGEN);
|
||||
RootBeanDefinition person = new RootBeanDefinition(Person.class, cavs, null);
|
||||
@@ -119,7 +119,7 @@ public class QualifierAnnotationAutowireBeanFactoryTests {
|
||||
|
||||
@Test
|
||||
public void testAutowireCandidateWithShortClassName() throws Exception {
|
||||
DefaultListableBeanFactory lbf = new DefaultListableBeanFactory();
|
||||
DefaultListableBeanFactory lbf = new DefaultListableBeanFactory();
|
||||
ConstructorArgumentValues cavs = new ConstructorArgumentValues();
|
||||
cavs.addGenericArgumentValue(JUERGEN);
|
||||
RootBeanDefinition person = new RootBeanDefinition(Person.class, cavs, null);
|
||||
@@ -137,7 +137,7 @@ public class QualifierAnnotationAutowireBeanFactoryTests {
|
||||
@Ignore
|
||||
@Test
|
||||
public void testAutowireCandidateWithConstructorDescriptor() throws Exception {
|
||||
DefaultListableBeanFactory lbf = new DefaultListableBeanFactory();
|
||||
DefaultListableBeanFactory lbf = new DefaultListableBeanFactory();
|
||||
ConstructorArgumentValues cavs1 = new ConstructorArgumentValues();
|
||||
cavs1.addGenericArgumentValue(JUERGEN);
|
||||
RootBeanDefinition person1 = new RootBeanDefinition(Person.class, cavs1, null);
|
||||
@@ -159,7 +159,7 @@ public class QualifierAnnotationAutowireBeanFactoryTests {
|
||||
@Ignore
|
||||
@Test
|
||||
public void testAutowireCandidateWithMethodDescriptor() throws Exception {
|
||||
DefaultListableBeanFactory lbf = new DefaultListableBeanFactory();
|
||||
DefaultListableBeanFactory lbf = new DefaultListableBeanFactory();
|
||||
ConstructorArgumentValues cavs1 = new ConstructorArgumentValues();
|
||||
cavs1.addGenericArgumentValue(JUERGEN);
|
||||
RootBeanDefinition person1 = new RootBeanDefinition(Person.class, cavs1, null);
|
||||
@@ -189,7 +189,7 @@ public class QualifierAnnotationAutowireBeanFactoryTests {
|
||||
|
||||
@Test
|
||||
public void testAutowireCandidateWithMultipleCandidatesDescriptor() throws Exception {
|
||||
DefaultListableBeanFactory lbf = new DefaultListableBeanFactory();
|
||||
DefaultListableBeanFactory lbf = new DefaultListableBeanFactory();
|
||||
ConstructorArgumentValues cavs1 = new ConstructorArgumentValues();
|
||||
cavs1.addGenericArgumentValue(JUERGEN);
|
||||
RootBeanDefinition person1 = new RootBeanDefinition(Person.class, cavs1, null);
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
/*
|
||||
* Copyright 2002-2012 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 the License at
|
||||
*
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
@@ -63,11 +63,11 @@ import org.springframework.core.io.Resource;
|
||||
/**
|
||||
* Security test case. Checks whether the container uses its privileges for its
|
||||
* internal work but does not leak them when touching/calling user code.
|
||||
*
|
||||
*
|
||||
*t The first half of the test case checks that permissions are downgraded when
|
||||
* calling user code while the second half that the caller code permission get
|
||||
* through and Spring doesn't override the permission stack.
|
||||
*
|
||||
*
|
||||
* @author Costin Leau
|
||||
*/
|
||||
public class CallbacksSecurityTests {
|
||||
@@ -97,7 +97,7 @@ public class CallbacksSecurityTests {
|
||||
public void setProperty(Object value) {
|
||||
checkCurrentContext();
|
||||
}
|
||||
|
||||
|
||||
public Object getProperty() {
|
||||
checkCurrentContext();
|
||||
return null;
|
||||
@@ -111,7 +111,7 @@ public class CallbacksSecurityTests {
|
||||
checkCurrentContext();
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
private void checkCurrentContext() {
|
||||
assertEquals(expectedName, getCurrentSubjectName());
|
||||
}
|
||||
@@ -352,7 +352,7 @@ public class CallbacksSecurityTests {
|
||||
assertTrue(ex.getCause() instanceof SecurityException);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testCustomInitBean() throws Exception {
|
||||
try {
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
/*
|
||||
* Copyright 2006-2009 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 the License at
|
||||
*
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
/*
|
||||
* Copyright 2006-2009 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 the License at
|
||||
*
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
@@ -23,7 +23,7 @@ public class CustomCallbackBean {
|
||||
public void init() {
|
||||
System.getProperties();
|
||||
}
|
||||
|
||||
|
||||
public void destroy() {
|
||||
System.setProperty("security.destroy", "true");
|
||||
}
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
/*
|
||||
* Copyright 2006-2009 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 the License at
|
||||
*
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
/*
|
||||
* Copyright 2006-2009 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 the License at
|
||||
*
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
/*
|
||||
* Copyright 2006-2009 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 the License at
|
||||
*
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
@@ -19,12 +19,12 @@ package org.springframework.beans.factory.support.security.support;
|
||||
* @author Costin Leau
|
||||
*/
|
||||
public class FactoryBean {
|
||||
|
||||
|
||||
public static Object makeStaticInstance() {
|
||||
System.getProperties();
|
||||
return new Object();
|
||||
}
|
||||
|
||||
|
||||
protected static Object protectedStaticInstance() {
|
||||
return "protectedStaticInstance";
|
||||
}
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
/*
|
||||
* Copyright 2006-2009 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 the License at
|
||||
*
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
/*
|
||||
* Copyright 2006-2009 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 the License at
|
||||
*
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
@@ -25,6 +25,6 @@ public class PropertyBean {
|
||||
}
|
||||
|
||||
public void setProperty(Object property) {
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -102,7 +102,7 @@ public class BeanConfigurerSupportTests extends TestCase {
|
||||
configurer.setBeanWiringInfoResolver(resolver);
|
||||
configurer.configureBean(beanInstance);
|
||||
assertEquals("Bean is evidently not being configured (for some reason)", "David Gavurin", beanInstance.getSpouse().getName());
|
||||
|
||||
|
||||
mock.verify();
|
||||
}
|
||||
|
||||
@@ -126,7 +126,7 @@ public class BeanConfigurerSupportTests extends TestCase {
|
||||
configurer.setBeanWiringInfoResolver(resolver);
|
||||
configurer.configureBean(beanInstance);
|
||||
assertEquals("Bean is evidently not being configured (for some reason)", "David Gavurin", beanInstance.getSpouse().getName());
|
||||
|
||||
|
||||
mock.verify();
|
||||
}
|
||||
|
||||
|
||||
@@ -58,5 +58,5 @@ public class BeanNameGenerationTests extends TestCase {
|
||||
|
||||
assertFalse(child1.getBeanName().equals(child2.getBeanName()));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
/*
|
||||
* Copyright 2002-2005 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 the License at
|
||||
*
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
@@ -28,11 +28,11 @@ import test.beans.TestBean;
|
||||
* @since 09.11.2003
|
||||
*/
|
||||
public class ConstructorDependenciesBean implements Serializable {
|
||||
|
||||
|
||||
private int age;
|
||||
|
||||
|
||||
private String name;
|
||||
|
||||
|
||||
private TestBean spouse1;
|
||||
|
||||
private TestBean spouse2;
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
/*
|
||||
* Copyright 2002-2005 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 the License at
|
||||
*
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
@@ -28,11 +28,11 @@ import test.beans.TestBean;
|
||||
* @since 04.09.2003
|
||||
*/
|
||||
public class DependenciesBean implements BeanFactoryAware {
|
||||
|
||||
|
||||
private int age;
|
||||
|
||||
|
||||
private String name;
|
||||
|
||||
|
||||
private TestBean spouse;
|
||||
|
||||
private BeanFactory beanFactory;
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
/*
|
||||
* Copyright 2002-2005 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 the License at
|
||||
*
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
|
||||
@@ -31,11 +31,11 @@ import test.beans.TestBean;
|
||||
* With Spring 3.1, bean id attributes (and all other id attributes across the
|
||||
* core schemas) are no longer typed as xsd:id, but as xsd:string. This allows
|
||||
* for using the same bean id within nested <beans> elements.
|
||||
*
|
||||
*
|
||||
* Duplicate ids *within the same level of nesting* will still be treated as an
|
||||
* error through the ProblemReporter, as this could never be an intended/valid
|
||||
* situation.
|
||||
*
|
||||
*
|
||||
* @author Chris Beams
|
||||
* @since 3.1
|
||||
* @see org.springframework.beans.factory.xml.XmlBeanFactoryTests#testWithDuplicateName
|
||||
|
||||
@@ -29,7 +29,7 @@ import test.beans.TestBean;
|
||||
* @author Juergen Hoeller
|
||||
*/
|
||||
public class FactoryMethods {
|
||||
|
||||
|
||||
public static FactoryMethods nullInstance() {
|
||||
return null;
|
||||
}
|
||||
@@ -39,21 +39,21 @@ public class FactoryMethods {
|
||||
tb.setName("defaultInstance");
|
||||
return new FactoryMethods(tb, "default", 0);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Note that overloaded methods are supported.
|
||||
*/
|
||||
public static FactoryMethods newInstance(TestBean tb) {
|
||||
return new FactoryMethods(tb, "default", 0);
|
||||
}
|
||||
|
||||
|
||||
protected static FactoryMethods newInstance(TestBean tb, int num, String name) {
|
||||
if (name == null) {
|
||||
throw new IllegalStateException("Should never be called with null value");
|
||||
}
|
||||
return new FactoryMethods(tb, name, num);
|
||||
}
|
||||
|
||||
|
||||
static FactoryMethods newInstance(TestBean tb, int num, Integer something) {
|
||||
if (something != null) {
|
||||
throw new IllegalStateException("Should never be called with non-null value");
|
||||
@@ -81,35 +81,35 @@ public class FactoryMethods {
|
||||
this.name = name;
|
||||
this.num = num;
|
||||
}
|
||||
|
||||
|
||||
public void setStringValue(String stringValue) {
|
||||
this.stringValue = stringValue;
|
||||
}
|
||||
|
||||
|
||||
public String getStringValue() {
|
||||
return this.stringValue;
|
||||
}
|
||||
|
||||
|
||||
public TestBean getTestBean() {
|
||||
return this.tb;
|
||||
}
|
||||
|
||||
|
||||
protected TestBean protectedGetTestBean() {
|
||||
return this.tb;
|
||||
}
|
||||
|
||||
|
||||
private TestBean privateGetTestBean() {
|
||||
return this.tb;
|
||||
}
|
||||
|
||||
|
||||
public int getNum() {
|
||||
return num;
|
||||
}
|
||||
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set via Setter Injection once instance is created.
|
||||
*/
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
/*
|
||||
* Copyright 2002-2005 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 the License at
|
||||
*
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
@@ -37,26 +37,26 @@ public class InstanceFactory {
|
||||
public void setFactoryBeanProperty(String s) {
|
||||
this.factoryBeanProperty = s;
|
||||
}
|
||||
|
||||
|
||||
public String getFactoryBeanProperty() {
|
||||
return this.factoryBeanProperty;
|
||||
}
|
||||
|
||||
|
||||
public FactoryMethods defaultInstance() {
|
||||
TestBean tb = new TestBean();
|
||||
tb.setName(this.factoryBeanProperty);
|
||||
return FactoryMethods.newInstance(tb);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Note that overloaded methods are supported.
|
||||
*/
|
||||
public FactoryMethods newInstance(TestBean tb) {
|
||||
return FactoryMethods.newInstance(tb);
|
||||
}
|
||||
|
||||
|
||||
public FactoryMethods newInstance(TestBean tb, int num, String name) {
|
||||
return FactoryMethods.newInstance(tb, num, name);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
/*
|
||||
* Copyright 2002-2005 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 the License at
|
||||
*
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
@@ -21,18 +21,18 @@ import test.beans.TestBean;
|
||||
/**
|
||||
* Test class for Spring's ability to create
|
||||
* objects using static factory methods, rather
|
||||
* than constructors.
|
||||
* than constructors.
|
||||
* @author Rod Johnson
|
||||
*/
|
||||
public class TestBeanCreator {
|
||||
|
||||
|
||||
public static TestBean createTestBean(String name, int age) {
|
||||
TestBean tb = new TestBean();
|
||||
tb.setName(name);
|
||||
tb.setAge(age);
|
||||
return tb;
|
||||
}
|
||||
|
||||
|
||||
public static TestBean createTestBean() {
|
||||
TestBean tb = new TestBean();
|
||||
tb.setName("Tristan");
|
||||
|
||||
@@ -454,7 +454,7 @@ public class XmlBeanCollectionTests {
|
||||
* @since 05.06.2003
|
||||
*/
|
||||
class HasMap {
|
||||
|
||||
|
||||
private Map map;
|
||||
|
||||
private IdentityHashMap identityMap;
|
||||
@@ -464,11 +464,11 @@ class HasMap {
|
||||
private CopyOnWriteArraySet concurrentSet;
|
||||
|
||||
private Properties props;
|
||||
|
||||
|
||||
private Object[] objectArray;
|
||||
|
||||
|
||||
private Class[] classArray;
|
||||
|
||||
|
||||
private Integer[] intArray;
|
||||
|
||||
public Map getMap() {
|
||||
|
||||
@@ -106,7 +106,7 @@ public class XmlBeanDefinitionReaderTests extends TestCase {
|
||||
catch (BeanDefinitionStoreException expected) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void testWithInputSourceAndExplicitValidationMode() {
|
||||
SimpleBeanDefinitionRegistry registry = new SimpleBeanDefinitionRegistry();;
|
||||
InputSource resource = new InputSource(getClass().getResourceAsStream("test.xml"));
|
||||
|
||||
@@ -25,7 +25,7 @@ import org.springframework.beans.factory.xml.UtilNamespaceHandler;
|
||||
|
||||
/**
|
||||
* Unit and integration tests for the {@link DefaultNamespaceHandlerResolver} class.
|
||||
*
|
||||
*
|
||||
* @author Rob Harrop
|
||||
* @author Rick Evans
|
||||
*/
|
||||
|
||||
@@ -46,7 +46,7 @@ public final class ByteArrayPropertyEditorTests extends TestCase {
|
||||
public void testGetAsTextReturnsEmptyStringIfValueIsNull() throws Exception {
|
||||
PropertyEditor byteEditor = new ByteArrayPropertyEditor();
|
||||
assertEquals("", byteEditor.getAsText());
|
||||
|
||||
|
||||
byteEditor.setAsText(null);
|
||||
assertEquals("", byteEditor.getAsText());
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ import test.beans.TestBean;
|
||||
* @author Rob Harrop
|
||||
* @author Arjen Poutsma
|
||||
* @author Chris Beams
|
||||
*
|
||||
*
|
||||
* @since 10.06.2003
|
||||
*/
|
||||
public class CustomEditorTests {
|
||||
@@ -511,7 +511,7 @@ public class CustomEditorTests {
|
||||
|
||||
bw.setPropertyValue("myChar", "\\u0022");
|
||||
assertEquals('"', cb.getMyChar());
|
||||
|
||||
|
||||
CharacterEditor editor = new CharacterEditor(false);
|
||||
editor.setAsText("M");
|
||||
assertEquals("M", editor.getAsText());
|
||||
@@ -672,7 +672,7 @@ public class CustomEditorTests {
|
||||
|
||||
patternEditor = new PatternEditor();
|
||||
assertEquals("", patternEditor.getAsText());
|
||||
|
||||
|
||||
patternEditor = new PatternEditor();
|
||||
patternEditor.setAsText(null);
|
||||
assertEquals("", patternEditor.getAsText());
|
||||
|
||||
@@ -40,7 +40,7 @@ public class PropertiesEditorTests extends TestCase {
|
||||
assertTrue("contains one entry", p.entrySet().size() == 1);
|
||||
assertTrue("foo=bar", p.get("foo").equals("bar"));
|
||||
}
|
||||
|
||||
|
||||
public void testTwoProperties() {
|
||||
String s = "foo=bar with whitespace\n" +
|
||||
"me=mi";
|
||||
@@ -51,7 +51,7 @@ public class PropertiesEditorTests extends TestCase {
|
||||
assertTrue("foo=bar with whitespace", p.get("foo").equals("bar with whitespace"));
|
||||
assertTrue("me=mi", p.get("me").equals("mi"));
|
||||
}
|
||||
|
||||
|
||||
public void testHandlesEqualsInValue() {
|
||||
String s = "foo=bar\n" +
|
||||
"me=mi\n" +
|
||||
@@ -64,7 +64,7 @@ public class PropertiesEditorTests extends TestCase {
|
||||
assertTrue("me=mi", p.get("me").equals("mi"));
|
||||
assertTrue("x='y=z'", p.get("x").equals("y=z"));
|
||||
}
|
||||
|
||||
|
||||
public void testHandlesEmptyProperty() {
|
||||
String s = "foo=bar\nme=mi\nx=";
|
||||
PropertiesEditor pe= new PropertiesEditor();
|
||||
@@ -75,7 +75,7 @@ public class PropertiesEditorTests extends TestCase {
|
||||
assertTrue("me=mi", p.get("me").equals("mi"));
|
||||
assertTrue("x='y=z'", p.get("x").equals(""));
|
||||
}
|
||||
|
||||
|
||||
public void testHandlesEmptyPropertyWithoutEquals() {
|
||||
String s = "foo\nme=mi\nx=x";
|
||||
PropertiesEditor pe= new PropertiesEditor();
|
||||
@@ -85,7 +85,7 @@ public class PropertiesEditorTests extends TestCase {
|
||||
assertTrue("foo is empty", p.get("foo").equals(""));
|
||||
assertTrue("me=mi", p.get("me").equals("mi"));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Comments begin with #
|
||||
*/
|
||||
@@ -124,14 +124,14 @@ public class PropertiesEditorTests extends TestCase {
|
||||
assertTrue("foo is bar", p.get("foo").equals("bar"));
|
||||
assertTrue("me=mi", p.get("me").equals("mi"));
|
||||
}
|
||||
|
||||
|
||||
public void testNull() {
|
||||
PropertiesEditor pe= new PropertiesEditor();
|
||||
pe.setAsText(null);
|
||||
Properties p = (Properties) pe.getValue();
|
||||
assertEquals(0, p.size());
|
||||
}
|
||||
|
||||
|
||||
public void testEmptyString() {
|
||||
PropertiesEditor pe = new PropertiesEditor();
|
||||
pe.setAsText("");
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
/*
|
||||
* Copyright 2002-2005 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 the License at
|
||||
*
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
|
||||
@@ -23,9 +23,9 @@ import org.springframework.util.comparator.CompoundComparator;
|
||||
|
||||
/**
|
||||
* Unit tests for {@link PropertyComparator}
|
||||
*
|
||||
*
|
||||
* @see org.springframework.util.comparator.ComparatorTests
|
||||
*
|
||||
*
|
||||
* @author Keith Donald
|
||||
* @author Chris Beams
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user