Author: oheger
Date: Tue Jul 12 19:05:27 2016
New Revision: 1752329
URL: http://svn.apache.org/viewvc?rev=1752329&view=rev
Log:
Reformatted test classes to match coding conventions.
Modified:
commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration2/spring/TestConfigurationPropertiesFactoryBean.java
commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration2/spring/TestConfigurationPropertySource.java
Modified:
commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration2/spring/TestConfigurationPropertiesFactoryBean.java
URL:
http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration2/spring/TestConfigurationPropertiesFactoryBean.java?rev=1752329&r1=1752328&r2=1752329&view=diff
==============================================================================
---
commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration2/spring/TestConfigurationPropertiesFactoryBean.java
(original)
+++
commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration2/spring/TestConfigurationPropertiesFactoryBean.java
Tue Jul 12 19:05:27 2016
@@ -31,41 +31,51 @@ import org.springframework.core.io.Resou
/**
* Spring FactoryBean test.
- *
*/
-public class TestConfigurationPropertiesFactoryBean {
+public class TestConfigurationPropertiesFactoryBean
+{
private ConfigurationPropertiesFactoryBean configurationFactory;
@Before
- public void setUp() {
+ public void setUp()
+ {
configurationFactory = new ConfigurationPropertiesFactoryBean();
}
@Test(expected = IllegalArgumentException.class)
- public void testAfterPropertiesSet() throws Exception {
+ public void testAfterPropertiesSet() throws Exception
+ {
configurationFactory.afterPropertiesSet();
}
@Test
- public void testGetObject() throws Exception {
- configurationFactory.setConfigurations(new Configuration[] { new
BaseConfiguration() });
+ public void testGetObject() throws Exception
+ {
+ configurationFactory.setConfigurations(new Configuration[] {
+ new BaseConfiguration()
+ });
Assert.assertNull(configurationFactory.getObject());
configurationFactory.afterPropertiesSet();
Assert.assertNotNull(configurationFactory.getObject());
}
@Test
- public void testMergeConfigurations() throws Exception {
+ public void testMergeConfigurations() throws Exception
+ {
Configuration one = new BaseConfiguration();
one.setProperty("foo", "bar");
- String properties = "## some header \n" + "foo = bar1\n" + "bar =
foo\n";
+ String properties =
+ "## some header \n" + "foo = bar1\n" + "bar = foo\n";
PropertiesConfiguration two = new PropertiesConfiguration();
- PropertiesConfigurationLayout layout = new
PropertiesConfigurationLayout();
+ PropertiesConfigurationLayout layout =
+ new PropertiesConfigurationLayout();
layout.load(two, new StringReader(properties));
- configurationFactory.setConfigurations(new Configuration[] { one, two
});
+ configurationFactory.setConfigurations(new Configuration[] {
+ one, two
+ });
configurationFactory.afterPropertiesSet();
Properties props = configurationFactory.getObject();
Assert.assertEquals("foo", props.getProperty("bar"));
@@ -73,9 +83,14 @@ public class TestConfigurationProperties
}
@Test
- public void testLoadResources() throws Exception {
- configurationFactory.setLocations(new Resource[] { new
ClassPathResource("testConfigurationFactoryBean.file") });
- configurationFactory.setConfigurations(new Configuration[] { new
BaseConfiguration() });
+ public void testLoadResources() throws Exception
+ {
+ configurationFactory.setLocations(new Resource[] {
+ new ClassPathResource("testConfigurationFactoryBean.file")
+ });
+ configurationFactory.setConfigurations(new Configuration[] {
+ new BaseConfiguration()
+ });
configurationFactory.afterPropertiesSet();
Properties props = configurationFactory.getObject();
@@ -83,8 +98,10 @@ public class TestConfigurationProperties
}
@Test
- public void testInitialConfiguration() throws Exception {
- configurationFactory = new ConfigurationPropertiesFactoryBean(new
BaseConfiguration());
+ public void testInitialConfiguration() throws Exception
+ {
+ configurationFactory =
+ new ConfigurationPropertiesFactoryBean(new
BaseConfiguration());
configurationFactory.afterPropertiesSet();
Assert.assertNotNull(configurationFactory.getConfiguration());
}
Modified:
commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration2/spring/TestConfigurationPropertySource.java
URL:
http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration2/spring/TestConfigurationPropertySource.java?rev=1752329&r1=1752328&r2=1752329&view=diff
==============================================================================
---
commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration2/spring/TestConfigurationPropertySource.java
(original)
+++
commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration2/spring/TestConfigurationPropertySource.java
Tue Jul 12 19:05:27 2016
@@ -30,13 +30,13 @@ import org.springframework.core.env.Muta
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
-
/**
* test for ConfigurationPropertySource
*/
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration
-public class TestConfigurationPropertySource {
+public class TestConfigurationPropertySource
+{
private static final String TEST_PROPERTY = "test.property";
private static final String TEST_VALUE = "testVALUE";
@@ -45,18 +45,23 @@ public class TestConfigurationPropertySo
private String value;
@Test
- public void testValueInjection() {
+ public void testValueInjection()
+ {
Assert.assertEquals(TEST_VALUE, value);
}
@Configuration
- static class Config {
+ static class Config
+ {
@Bean
- public PropertySourcesPlaceholderConfigurer
propertySourcesPlaceholderConfigurer(ConfigurableEnvironment
-
env) {
- PropertySourcesPlaceholderConfigurer configurer = new
PropertySourcesPlaceholderConfigurer();
- // https://jira.spring.io/browse/SPR-9631 may simplify this in
future
+ public PropertySourcesPlaceholderConfigurer
propertySourcesPlaceholderConfigurer(
+ ConfigurableEnvironment env)
+ {
+ PropertySourcesPlaceholderConfigurer configurer =
+ new PropertySourcesPlaceholderConfigurer();
+ // https://jira.spring.io/browse/SPR-9631 may simplify this in
+ // future
MutablePropertySources sources = new MutablePropertySources();
sources.addLast(createConfigPropertySource());
configurer.setPropertySources(sources);
@@ -65,10 +70,13 @@ public class TestConfigurationPropertySo
}
}
- private static ConfigurationPropertySource createConfigPropertySource() {
- PropertiesConfiguration propertiesConfiguration = new
PropertiesConfiguration();
+ private static ConfigurationPropertySource createConfigPropertySource()
+ {
+ PropertiesConfiguration propertiesConfiguration =
+ new PropertiesConfiguration();
propertiesConfiguration.addProperty(TEST_PROPERTY, TEST_VALUE);
- return new ConfigurationPropertySource("test configuration",
propertiesConfiguration);
+ return new ConfigurationPropertySource("test configuration",
+ propertiesConfiguration);
}
}