You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2018/09/27 22:24:26 UTC
svn commit: r1842194 [30/34] - in /commons/proper/configuration/trunk/src:
main/java/org/apache/commons/configuration2/
main/java/org/apache/commons/configuration2/beanutils/
main/java/org/apache/commons/configuration2/builder/
main/java/org/apache/com...
Modified: commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration2/io/TestFileLocatorUtils.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration2/io/TestFileLocatorUtils.java?rev=1842194&r1=1842193&r2=1842194&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration2/io/TestFileLocatorUtils.java (original)
+++ commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration2/io/TestFileLocatorUtils.java Thu Sep 27 22:24:23 2018
@@ -76,9 +76,9 @@ public class TestFileLocatorUtils
@Test
public void testFileFromURLWithEncodedPercent() throws MalformedURLException
{
- File file = new File("https%3A%2F%2Fwww.apache.org%2F.url").getAbsoluteFile();
- URL fileURL = file.toURI().toURL();
- File file2 = FileLocatorUtils.fileFromURL(fileURL);
+ final File file = new File("https%3A%2F%2Fwww.apache.org%2F.url").getAbsoluteFile();
+ final URL fileURL = file.toURI().toURL();
+ final File file2 = FileLocatorUtils.fileFromURL(fileURL);
assertEquals("Wrong file", file, file2);
}
@@ -89,10 +89,10 @@ public class TestFileLocatorUtils
@Test
public void testFileFromURLWithPlus() throws MalformedURLException
{
- File file = new File(new File("target"), "foo+bar.txt")
+ final File file = new File(new File("target"), "foo+bar.txt")
.getAbsoluteFile();
- URL fileURL = file.toURI().toURL();
- File file2 = FileLocatorUtils.fileFromURL(fileURL);
+ final URL fileURL = file.toURI().toURL();
+ final File file2 = FileLocatorUtils.fileFromURL(fileURL);
assertEquals("Wrong file", file, file2);
}
@@ -140,8 +140,8 @@ public class TestFileLocatorUtils
@Test
public void testGetFile() throws Exception
{
- File directory = new File("target");
- File reference = new File(directory, "test.txt").getAbsoluteFile();
+ final File directory = new File("target");
+ final File reference = new File(directory, "test.txt").getAbsoluteFile();
assertEquals(reference, FileLocatorUtils.getFile(null, reference.getAbsolutePath()));
assertEquals(reference, FileLocatorUtils.getFile(directory.getAbsolutePath(), reference.getAbsolutePath()));
@@ -156,7 +156,7 @@ public class TestFileLocatorUtils
@Test
public void testLocateWithNullTCCL() throws Exception
{
- ClassLoader cl = Thread.currentThread().getContextClassLoader();
+ final ClassLoader cl = Thread.currentThread().getContextClassLoader();
try
{
Thread.currentThread().setContextClassLoader(null);
@@ -198,8 +198,8 @@ public class TestFileLocatorUtils
@Test
public void testObtainFileSystemSetInLocator()
{
- FileSystem fs = EasyMock.createMock(FileSystem.class);
- FileLocator locator =
+ final FileSystem fs = EasyMock.createMock(FileSystem.class);
+ final FileLocator locator =
FileLocatorUtils.fileLocator().fileSystem(fs).create();
assertSame("Wrong file system", fs,
FileLocatorUtils.obtainFileSystem(locator));
@@ -220,7 +220,7 @@ public class TestFileLocatorUtils
@Test
public void testIsLocationDefinedFalse()
{
- FileLocator locator =
+ final FileLocator locator =
FileLocatorUtils.fileLocator().encoding(ENCODING)
.basePath(BASE_PATH)
.fileSystem(FileLocatorUtils.DEFAULT_FILE_SYSTEM)
@@ -234,7 +234,7 @@ public class TestFileLocatorUtils
@Test
public void testIsLocationDefinedFileName()
{
- FileLocator locator =
+ final FileLocator locator =
FileLocatorUtils.fileLocator().fileName(FILE_NAME).create();
assertTrue("Wrong result", FileLocatorUtils.isLocationDefined(locator));
}
@@ -245,7 +245,7 @@ public class TestFileLocatorUtils
@Test
public void testIsLocationDefinedURL()
{
- FileLocator locator =
+ final FileLocator locator =
FileLocatorUtils.fileLocator()
.sourceURL(ConfigurationAssert.getTestURL(FILE_NAME))
.create();
@@ -271,11 +271,11 @@ public class TestFileLocatorUtils
* @param handler the file handler
* @throws ConfigurationException if an error occurs
*/
- private static void checkTestConfiguration(FileHandler handler)
+ private static void checkTestConfiguration(final FileHandler handler)
throws ConfigurationException
{
- XMLConfiguration config = new XMLConfiguration();
- FileHandler h2 = new FileHandler(config, handler);
+ final XMLConfiguration config = new XMLConfiguration();
+ final FileHandler h2 = new FileHandler(config, handler);
h2.load();
assertEquals("Wrong content", "value", config.getString("element"));
}
@@ -287,7 +287,7 @@ public class TestFileLocatorUtils
* @param locator the locator to check
* @throws ConfigurationException if an error occurs
*/
- private static void checkFullyInitializedLocator(FileLocator locator)
+ private static void checkFullyInitializedLocator(final FileLocator locator)
throws ConfigurationException
{
assertNotNull("No base path", locator.getBasePath());
@@ -312,7 +312,7 @@ public class TestFileLocatorUtils
public void testFullyInitializedLocatorFileName()
throws ConfigurationException
{
- FileLocator locator =
+ final FileLocator locator =
FileLocatorUtils.fileLocator().fileName(FILE_NAME).create();
checkFullyInitializedLocator(FileLocatorUtils
.fullyInitializedLocator(locator));
@@ -325,7 +325,7 @@ public class TestFileLocatorUtils
@Test
public void testFullyInitializedLocatorURL() throws ConfigurationException
{
- FileLocator locator =
+ final FileLocator locator =
FileLocatorUtils.fileLocator().sourceURL(sourceURL).create();
checkFullyInitializedLocator(FileLocatorUtils
.fullyInitializedLocator(locator));
@@ -338,9 +338,9 @@ public class TestFileLocatorUtils
@Test
public void testFullyInitializedLocatorAlreadyComplete()
{
- FileLocator locator =
+ final FileLocator locator =
FileLocatorUtils.fileLocator().fileName(FILE_NAME).create();
- FileLocator fullLocator =
+ final FileLocator fullLocator =
FileLocatorUtils.fullyInitializedLocator(locator);
assertSame("Different instance", fullLocator,
FileLocatorUtils.fullyInitializedLocator(fullLocator));
@@ -352,7 +352,7 @@ public class TestFileLocatorUtils
@Test
public void testFullyInitializedLocatorLocateFails()
{
- FileLocator locator =
+ final FileLocator locator =
FileLocatorUtils.fileLocator().fileName("non existing file")
.create();
assertNull("Wrong result",
@@ -375,7 +375,7 @@ public class TestFileLocatorUtils
@Test
public void testIsFullyInitializedNoBasePath()
{
- FileLocator locator =
+ final FileLocator locator =
FileLocatorUtils.fileLocator()
.sourceURL(ConfigurationAssert.getTestURL(FILE_NAME))
.fileName(FILE_NAME).create();
@@ -389,7 +389,7 @@ public class TestFileLocatorUtils
@Test
public void testConvertToURIException() throws URISyntaxException
{
- URI uri = new URI("test://test/path/file.tst");
+ final URI uri = new URI("test://test/path/file.tst");
assertNull("Got a URL", FileLocatorUtils.convertURIToURL(uri));
}
@@ -399,8 +399,8 @@ public class TestFileLocatorUtils
@Test
public void testConvertFileToURL() throws ConfigurationException
{
- File file = ConfigurationAssert.getTestFile(FILE_NAME);
- FileHandler handler = new FileHandler();
+ final File file = ConfigurationAssert.getTestFile(FILE_NAME);
+ final FileHandler handler = new FileHandler();
handler.setURL(FileLocatorUtils.convertFileToURL(file));
checkTestConfiguration(handler);
}
@@ -411,9 +411,9 @@ public class TestFileLocatorUtils
@Test
public void testDefaultFileLocationStrategy()
{
- CombinedLocationStrategy strategy =
+ final CombinedLocationStrategy strategy =
(CombinedLocationStrategy) FileLocatorUtils.DEFAULT_LOCATION_STRATEGY;
- Iterator<FileLocationStrategy> it =
+ final Iterator<FileLocationStrategy> it =
strategy.getSubStrategies().iterator();
assertTrue("Wrong strategy (1)",
it.next() instanceof ProvidedURLLocationStrategy);
@@ -444,10 +444,10 @@ public class TestFileLocatorUtils
@Test
public void testObtainLocationStrategySetInLocator()
{
- FileLocationStrategy strategy =
+ final FileLocationStrategy strategy =
EasyMock.createMock(FileLocationStrategy.class);
EasyMock.replay(strategy);
- FileLocator locator =
+ final FileLocator locator =
FileLocatorUtils.fileLocator().locationStrategy(strategy)
.create();
assertSame("Wrong strategy", strategy,
@@ -461,7 +461,7 @@ public class TestFileLocatorUtils
@Test
public void testObtainLocationStrategyNotSetInLocator()
{
- FileLocator locator = FileLocatorUtils.fileLocator().create();
+ final FileLocator locator = FileLocatorUtils.fileLocator().create();
assertSame("Wrong strategy",
FileLocatorUtils.DEFAULT_LOCATION_STRATEGY,
FileLocatorUtils.obtainLocationStrategy(locator));
@@ -496,10 +496,10 @@ public class TestFileLocatorUtils
public void testLocateSuccessWithStrategyAndFileSystem()
throws ConfigurationException
{
- FileSystem fs = EasyMock.createMock(FileSystem.class);
- FileLocationStrategy strategy =
+ final FileSystem fs = EasyMock.createMock(FileSystem.class);
+ final FileLocationStrategy strategy =
EasyMock.createMock(FileLocationStrategy.class);
- FileLocator locator =
+ final FileLocator locator =
FileLocatorUtils.fileLocator().fileSystem(fs)
.locationStrategy(strategy).create();
EasyMock.expect(strategy.locate(fs, locator)).andReturn(sourceURL);
@@ -517,9 +517,9 @@ public class TestFileLocatorUtils
public void testLocateSuccessWithStrategyDefaultFileSystem()
throws ConfigurationException
{
- FileLocationStrategy strategy =
+ final FileLocationStrategy strategy =
EasyMock.createMock(FileLocationStrategy.class);
- FileLocator locator =
+ final FileLocator locator =
FileLocatorUtils.fileLocator().locationStrategy(strategy)
.create();
EasyMock.expect(
@@ -538,7 +538,7 @@ public class TestFileLocatorUtils
@Test
public void testLocateSuccessWithDefaults()
{
- FileLocator locator =
+ final FileLocator locator =
FileLocatorUtils.fileLocator().sourceURL(sourceURL).create();
assertSame("Wrong URL", sourceURL, FileLocatorUtils.locate(locator));
}
@@ -549,13 +549,13 @@ public class TestFileLocatorUtils
@Test(expected = ConfigurationException.class)
public void testLocateOrThrowFailed() throws ConfigurationException
{
- FileLocationStrategy strategy =
+ final FileLocationStrategy strategy =
EasyMock.createMock(FileLocationStrategy.class);
EasyMock.expect(
strategy.locate(EasyMock.anyObject(FileSystem.class),
EasyMock.anyObject(FileLocator.class))).andReturn(null);
EasyMock.replay(strategy);
- FileLocator locator =
+ final FileLocator locator =
FileLocatorUtils.fileLocator().locationStrategy(strategy)
.create();
FileLocatorUtils.locateOrThrow(locator);
@@ -568,17 +568,17 @@ public class TestFileLocatorUtils
@Test
public void testStoreFileLocatorInMap()
{
- FileLocationStrategy strategy =
+ final FileLocationStrategy strategy =
EasyMock.createMock(FileLocationStrategy.class);
EasyMock.replay(strategy);
- FileLocator locator =
+ final FileLocator locator =
FileLocatorUtils.fileLocator().basePath(BASE_PATH)
.encoding(ENCODING).fileName(FILE_NAME)
.fileSystem(fileSystem).locationStrategy(strategy)
.sourceURL(sourceURL).create();
- Map<String, Object> map = new HashMap<>();
+ final Map<String, Object> map = new HashMap<>();
FileLocatorUtils.put(locator, map);
- FileLocator locator2 = FileLocatorUtils.fromMap(map);
+ final FileLocator locator2 = FileLocatorUtils.fromMap(map);
assertEquals("Different locators", locator, locator2);
}
@@ -588,7 +588,7 @@ public class TestFileLocatorUtils
@Test
public void testPutNoLocator()
{
- Map<String, Object> map = new HashMap<>();
+ final Map<String, Object> map = new HashMap<>();
FileLocatorUtils.put(null, map);
assertTrue("Got properties", map.isEmpty());
}
@@ -608,7 +608,7 @@ public class TestFileLocatorUtils
@Test
public void testFromMapNoMap()
{
- FileLocator fileLocator = FileLocatorUtils.fromMap(null);
+ final FileLocator fileLocator = FileLocatorUtils.fromMap(null);
assertEquals("Locator is initialized", FileLocatorUtils.fileLocator()
.create(), fileLocator);
}
Modified: commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration2/io/TestFileSystemLocationStrategy.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration2/io/TestFileSystemLocationStrategy.java?rev=1842194&r1=1842193&r2=1842194&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration2/io/TestFileSystemLocationStrategy.java (original)
+++ commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration2/io/TestFileSystemLocationStrategy.java Thu Sep 27 22:24:23 2018
@@ -47,13 +47,13 @@ public class TestFileSystemLocationStrat
@Test
public void testLocate()
{
- FileSystem fs = EasyMock.createMock(FileSystem.class);
- URL url = ConfigurationAssert.getTestURL("test.xml");
+ final FileSystem fs = EasyMock.createMock(FileSystem.class);
+ final URL url = ConfigurationAssert.getTestURL("test.xml");
final String basePath = "testBasePath";
final String fileName = "testFileName.txt";
EasyMock.expect(fs.locateFromURL(basePath, fileName)).andReturn(url);
EasyMock.replay(fs);
- FileLocator locator =
+ final FileLocator locator =
FileLocatorUtils
.fileLocator()
.basePath(basePath)
Modified: commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration2/io/TestHomeDirectoryLocationStrategy.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration2/io/TestHomeDirectoryLocationStrategy.java?rev=1842194&r1=1842193&r2=1842194&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration2/io/TestHomeDirectoryLocationStrategy.java (original)
+++ commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration2/io/TestHomeDirectoryLocationStrategy.java Thu Sep 27 22:24:23 2018
@@ -65,7 +65,7 @@ public class TestHomeDirectoryLocationSt
* @param withBasePath the base path flag
* @return the test strategy
*/
- private HomeDirectoryLocationStrategy setUpStrategy(boolean withBasePath)
+ private HomeDirectoryLocationStrategy setUpStrategy(final boolean withBasePath)
{
return new HomeDirectoryLocationStrategy(folder.getRoot()
.getAbsolutePath(), withBasePath);
@@ -77,7 +77,7 @@ public class TestHomeDirectoryLocationSt
@Test
public void testInitDefaults()
{
- HomeDirectoryLocationStrategy strategy =
+ final HomeDirectoryLocationStrategy strategy =
new HomeDirectoryLocationStrategy();
assertEquals("Wrong home directory", System.getProperty("user.home"),
strategy.getHomeDirectory());
@@ -90,12 +90,12 @@ public class TestHomeDirectoryLocationSt
@Test
public void testLocateSuccessIgnoreBasePath() throws IOException
{
- File file = folder.newFile(FILE_NAME);
- FileLocator locator =
+ final File file = folder.newFile(FILE_NAME);
+ final FileLocator locator =
FileLocatorUtils.fileLocator().basePath(BASE_PATH)
.fileName(FILE_NAME).create();
- HomeDirectoryLocationStrategy strategy = setUpStrategy(false);
- URL url = strategy.locate(fileSystem, locator);
+ final HomeDirectoryLocationStrategy strategy = setUpStrategy(false);
+ final URL url = strategy.locate(fileSystem, locator);
assertEquals("Wrong URL", file.getAbsoluteFile(), FileLocatorUtils
.fileFromURL(url).getAbsoluteFile());
}
@@ -107,10 +107,10 @@ public class TestHomeDirectoryLocationSt
public void testLocateFailedWithBasePath() throws IOException
{
folder.newFile(FILE_NAME);
- FileLocator locator =
+ final FileLocator locator =
FileLocatorUtils.fileLocator().basePath(BASE_PATH)
.fileName(FILE_NAME).create();
- HomeDirectoryLocationStrategy strategy = setUpStrategy(true);
+ final HomeDirectoryLocationStrategy strategy = setUpStrategy(true);
assertNull("Got a URL", strategy.locate(fileSystem, locator));
}
@@ -120,14 +120,14 @@ public class TestHomeDirectoryLocationSt
@Test
public void testLocateSuccessInSubFolder() throws IOException
{
- File sub = folder.newFolder(BASE_PATH);
- File file = new File(sub, FILE_NAME);
+ final File sub = folder.newFolder(BASE_PATH);
+ final File file = new File(sub, FILE_NAME);
assertTrue("Could not create file", file.createNewFile());
- FileLocator locator =
+ final FileLocator locator =
FileLocatorUtils.fileLocator().basePath(BASE_PATH)
.fileName(FILE_NAME).create();
- HomeDirectoryLocationStrategy strategy = setUpStrategy(true);
- URL url = strategy.locate(fileSystem, locator);
+ final HomeDirectoryLocationStrategy strategy = setUpStrategy(true);
+ final URL url = strategy.locate(fileSystem, locator);
assertEquals("Wrong URL", file.getAbsoluteFile(), FileLocatorUtils
.fileFromURL(url).getAbsoluteFile());
}
@@ -139,11 +139,11 @@ public class TestHomeDirectoryLocationSt
@Test
public void testLocateSuccessNoBasePath() throws IOException
{
- File file = folder.newFile(FILE_NAME);
- FileLocator locator =
+ final File file = folder.newFile(FILE_NAME);
+ final FileLocator locator =
FileLocatorUtils.fileLocator().fileName(FILE_NAME).create();
- HomeDirectoryLocationStrategy strategy = setUpStrategy(true);
- URL url = strategy.locate(fileSystem, locator);
+ final HomeDirectoryLocationStrategy strategy = setUpStrategy(true);
+ final URL url = strategy.locate(fileSystem, locator);
assertEquals("Wrong URL", file.getAbsoluteFile(), FileLocatorUtils
.fileFromURL(url).getAbsoluteFile());
}
@@ -154,9 +154,9 @@ public class TestHomeDirectoryLocationSt
@Test
public void testNoFileName()
{
- FileLocator locator =
+ final FileLocator locator =
FileLocatorUtils.fileLocator().basePath(BASE_PATH).create();
- HomeDirectoryLocationStrategy strategy = setUpStrategy(true);
+ final HomeDirectoryLocationStrategy strategy = setUpStrategy(true);
assertNull("Got a URL", strategy.locate(fileSystem, locator));
}
}
Modified: commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration2/io/TestProvidedURLLocationStrategy.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration2/io/TestProvidedURLLocationStrategy.java?rev=1842194&r1=1842193&r2=1842194&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration2/io/TestProvidedURLLocationStrategy.java (original)
+++ commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration2/io/TestProvidedURLLocationStrategy.java Thu Sep 27 22:24:23 2018
@@ -48,10 +48,10 @@ public class TestProvidedURLLocationStra
@Test
public void testLocateSuccess()
{
- FileSystem fs = EasyMock.createMock(FileSystem.class);
+ final FileSystem fs = EasyMock.createMock(FileSystem.class);
EasyMock.replay(fs);
- URL url = ConfigurationAssert.getTestURL("test.xml");
- FileLocator locator =
+ final URL url = ConfigurationAssert.getTestURL("test.xml");
+ final FileLocator locator =
FileLocatorUtils.fileLocator().sourceURL(url).create();
assertSame("Wrong URL", url, strategy.locate(fs, locator));
}
@@ -62,9 +62,9 @@ public class TestProvidedURLLocationStra
@Test
public void testLocateFail()
{
- FileSystem fs = EasyMock.createMock(FileSystem.class);
+ final FileSystem fs = EasyMock.createMock(FileSystem.class);
EasyMock.replay(fs);
- FileLocator locator =
+ final FileLocator locator =
FileLocatorUtils.fileLocator().basePath("somePath")
.fileName("someFile.xml").create();
assertNull("Got a URL", strategy.locate(fs, locator));
Modified: commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration2/plist/TestPropertyListConfiguration.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration2/plist/TestPropertyListConfiguration.java?rev=1842194&r1=1842193&r2=1842194&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration2/plist/TestPropertyListConfiguration.java (original)
+++ commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration2/plist/TestPropertyListConfiguration.java Thu Sep 27 22:24:23 2018
@@ -77,7 +77,7 @@ public class TestPropertyListConfigurati
* @param f the file to be loaded
* @throws ConfigurationException if an error occurs
*/
- private static void load(PropertyListConfiguration c, File f)
+ private static void load(final PropertyListConfiguration c, final File f)
throws ConfigurationException
{
new FileHandler(c).load(f);
@@ -96,7 +96,7 @@ public class TestPropertyListConfigurati
try {
new FileHandler(config).load(new StringReader(""));
fail("No exception thrown on loading an empty file");
- } catch (ConfigurationException e) {
+ } catch (final ConfigurationException e) {
// expected
assertNotNull(e.getMessage());
}
@@ -119,20 +119,20 @@ public class TestPropertyListConfigurati
@Test
public void testEmptyArray()
{
- String key = "empty-array";
+ final String key = "empty-array";
assertNotNull("array null", config.getProperty(key));
- List<?> list = (List<?>) config.getProperty(key);
+ final List<?> list = (List<?>) config.getProperty(key);
assertTrue("array is not empty", list.isEmpty());
}
@Test
public void testArray()
{
- String key = "array";
+ final String key = "array";
assertNotNull("array null", config.getProperty(key));
- List<?> list = (List<?>) config.getProperty(key);
+ final List<?> list = (List<?>) config.getProperty(key);
assertFalse("array is empty", list.isEmpty());
assertEquals("1st value", "value1", list.get(0));
@@ -143,21 +143,21 @@ public class TestPropertyListConfigurati
@Test
public void testNestedArrays()
{
- String key = "nested-arrays";
+ final String key = "nested-arrays";
- Object array = config.getProperty(key);
+ final Object array = config.getProperty(key);
// root array
assertNotNull("array not found", array);
ObjectAssert.assertInstanceOf("the array element is not parsed as a List", List.class, array);
- List<?> list = config.getList(key);
+ final List<?> list = config.getList(key);
assertFalse("empty array", list.isEmpty());
assertEquals("size", 2, list.size());
// 1st array
ObjectAssert.assertInstanceOf("the array element is not parsed as a List", List.class, list.get(0));
- List<?> list1 = (List<?>) list.get(0);
+ final List<?> list1 = (List<?>) list.get(0);
assertFalse("nested array 1 is empty", list1.isEmpty());
assertEquals("size", 2, list1.size());
assertEquals("1st element", "a", list1.get(0));
@@ -165,7 +165,7 @@ public class TestPropertyListConfigurati
// 2nd array
ObjectAssert.assertInstanceOf("the array element is not parsed as a List", List.class, list.get(1));
- List<?> list2 = (List<?>) list.get(1);
+ final List<?> list2 = (List<?>) list.get(1);
assertFalse("nested array 2 is empty", list2.isEmpty());
assertEquals("size", 2, list2.size());
assertEquals("1st element", "c", list2.get(0));
@@ -182,27 +182,27 @@ public class TestPropertyListConfigurati
@Test
public void testDictionaryArray()
{
- String key = "dictionary-array";
+ final String key = "dictionary-array";
- Object array = config.getProperty(key);
+ final Object array = config.getProperty(key);
// root array
assertNotNull("array not found", array);
ObjectAssert.assertInstanceOf("the array element is not parsed as a List", List.class, array);
- List<?> list = config.getList(key);
+ final List<?> list = config.getList(key);
assertFalse("empty array", list.isEmpty());
assertEquals("size", 2, list.size());
// 1st dictionary
ObjectAssert.assertInstanceOf("the dict element is not parsed as a Configuration", Configuration.class, list.get(0));
- Configuration conf1 = (Configuration) list.get(0);
+ final Configuration conf1 = (Configuration) list.get(0);
assertFalse("configuration 1 is empty", conf1.isEmpty());
assertEquals("configuration element", "bar", conf1.getProperty("foo"));
// 2nd dictionary
ObjectAssert.assertInstanceOf("the dict element is not parsed as a Configuration", Configuration.class, list.get(1));
- Configuration conf2 = (Configuration) list.get(1);
+ final Configuration conf2 = (Configuration) list.get(1);
assertFalse("configuration 2 is empty", conf2.isEmpty());
assertEquals("configuration element", "value", conf2.getProperty("key"));
}
@@ -223,11 +223,11 @@ public class TestPropertyListConfigurati
@Test
public void testDate() throws Exception
{
- Calendar cal = Calendar.getInstance();
+ final Calendar cal = Calendar.getInstance();
cal.clear();
cal.set(2002, Calendar.MARCH, 22, 11, 30, 0);
cal.setTimeZone(TimeZone.getTimeZone("GMT+0100"));
- Date date = cal.getTime();
+ final Date date = cal.getTime();
assertEquals("date", date, config.getProperty("date"));
}
@@ -238,7 +238,7 @@ public class TestPropertyListConfigurati
* @param file the target file
* @throws ConfigurationException if an error occurs
*/
- private void saveConfig(File file) throws ConfigurationException
+ private void saveConfig(final File file) throws ConfigurationException
{
new FileHandler(config).save(file);
}
@@ -246,43 +246,43 @@ public class TestPropertyListConfigurati
@Test
public void testSave() throws Exception
{
- File savedFile = folder.newFile("testsave.plist");
+ final File savedFile = folder.newFile("testsave.plist");
// save the configuration
saveConfig(savedFile);
assertTrue("The saved file doesn't exist", savedFile.exists());
// read the configuration and compare the properties
- PropertyListConfiguration checkConfig = new PropertyListConfiguration();
+ final PropertyListConfiguration checkConfig = new PropertyListConfiguration();
load(checkConfig, savedFile);
- Iterator<String> it = config.getKeys();
+ final Iterator<String> it = config.getKeys();
while (it.hasNext())
{
- String key = it.next();
+ final String key = it.next();
assertTrue("The saved configuration doesn't contain the key '" + key + "'", checkConfig.containsKey(key));
- Object value = checkConfig.getProperty(key);
+ final Object value = checkConfig.getProperty(key);
if (value instanceof byte[])
{
- byte[] array = (byte[]) value;
+ final byte[] array = (byte[]) value;
ArrayAssert.assertEquals("Value of the '" + key + "' property", (byte[]) config.getProperty(key), array);
}
else if (value instanceof List)
{
- List<?> list1 = (List<?>) config.getProperty(key);
- List<?> list2 = (List<?>) value;
+ final List<?> list1 = (List<?>) config.getProperty(key);
+ final List<?> list2 = (List<?>) value;
assertEquals("The size of the list for the key '" + key + "' doesn't match", list1.size(), list2.size());
for (int i = 0; i < list2.size(); i++)
{
- Object value1 = list1.get(i);
- Object value2 = list2.get(i);
+ final Object value1 = list1.get(i);
+ final Object value2 = list2.get(i);
if (value1 instanceof Configuration)
{
- ConfigurationComparator comparator = new StrictConfigurationComparator();
+ final ConfigurationComparator comparator = new StrictConfigurationComparator();
assertTrue("The dictionnary at index " + i + " for the key '" + key + "' doesn't match", comparator.compare((Configuration) value1, (Configuration) value2));
}
else
@@ -304,14 +304,14 @@ public class TestPropertyListConfigurati
@Test
public void testSaveEmptyDictionary() throws Exception
{
- File savedFile = folder.newFile("testsave.plist");
+ final File savedFile = folder.newFile("testsave.plist");
// save the configuration
saveConfig(savedFile);
assertTrue("The saved file doesn't exist", savedFile.exists());
// read the configuration and compare the properties
- PropertyListConfiguration checkConfig = new PropertyListConfiguration();
+ final PropertyListConfiguration checkConfig = new PropertyListConfiguration();
load(checkConfig, savedFile);
assertFalse(getNamedChildren(config, "empty-dictionary").isEmpty());
@@ -327,9 +327,9 @@ public class TestPropertyListConfigurati
* @return the list with the corresponding child nodes
*/
private static List<ImmutableNode> getNamedChildren(
- HierarchicalConfiguration<ImmutableNode> config, String name)
+ final HierarchicalConfiguration<ImmutableNode> config, final String name)
{
- NodeHandler<ImmutableNode> handler =
+ final NodeHandler<ImmutableNode> handler =
config.getNodeModel().getNodeHandler();
return handler.getChildren(handler.getRootNode(), name);
}
@@ -351,15 +351,15 @@ public class TestPropertyListConfigurati
@Test
public void testSetDataProperty() throws Exception
{
- File saveFile = folder.newFile();
- byte[] expected = new byte[]{1, 2, 3, 4};
+ final File saveFile = folder.newFile();
+ final byte[] expected = new byte[]{1, 2, 3, 4};
config = new PropertyListConfiguration();
config.setProperty("foo", expected);
saveConfig(saveFile);
- PropertyListConfiguration config2 = new PropertyListConfiguration();
+ final PropertyListConfiguration config2 = new PropertyListConfiguration();
load(config2, saveFile);
- Object array = config2.getProperty("foo");
+ final Object array = config2.getProperty("foo");
assertNotNull("data not found", array);
assertEquals("property type", byte[].class, array.getClass());
@@ -372,15 +372,15 @@ public class TestPropertyListConfigurati
@Test
public void testAddDataProperty() throws Exception
{
- File saveFile = folder.newFile();
- byte[] expected = new byte[]{1, 2, 3, 4};
+ final File saveFile = folder.newFile();
+ final byte[] expected = new byte[]{1, 2, 3, 4};
config = new PropertyListConfiguration();
config.addProperty("foo", expected);
saveConfig(saveFile);
- PropertyListConfiguration config2 = new PropertyListConfiguration();
+ final PropertyListConfiguration config2 = new PropertyListConfiguration();
load(config2, saveFile);
- Object array = config2.getProperty("foo");
+ final Object array = config2.getProperty("foo");
assertNotNull("data not found", array);
assertEquals("property type", byte[].class, array.getClass());
@@ -390,7 +390,7 @@ public class TestPropertyListConfigurati
@Test
public void testInitCopy()
{
- PropertyListConfiguration copy = new PropertyListConfiguration(config);
+ final PropertyListConfiguration copy = new PropertyListConfiguration(config);
assertFalse("Nothing was copied", copy.isEmpty());
}
@@ -438,7 +438,7 @@ public class TestPropertyListConfigurati
@Test
public void testFormatDate()
{
- Calendar cal = Calendar.getInstance();
+ final Calendar cal = Calendar.getInstance();
cal.clear();
cal.set(2007, Calendar.OCTOBER, 29, 23, 4, 30);
cal.setTimeZone(TimeZone.getTimeZone("GMT-0230"));
Modified: commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration2/plist/TestPropertyListConfigurationEvents.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration2/plist/TestPropertyListConfigurationEvents.java?rev=1842194&r1=1842193&r2=1842194&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration2/plist/TestPropertyListConfigurationEvents.java (original)
+++ commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration2/plist/TestPropertyListConfigurationEvents.java Thu Sep 27 22:24:23 2018
@@ -40,11 +40,11 @@ public class TestPropertyListConfigurati
{
try
{
- PropertyListConfiguration c = new PropertyListConfiguration();
+ final PropertyListConfiguration c = new PropertyListConfiguration();
new FileHandler(c).load(TEST_FILE);
return c;
}
- catch (ConfigurationException cex)
+ catch (final ConfigurationException cex)
{
throw new ConfigurationRuntimeException(cex);
}
Modified: commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration2/plist/TestPropertyListParser.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration2/plist/TestPropertyListParser.java?rev=1842194&r1=1842193&r2=1842194&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration2/plist/TestPropertyListParser.java (original)
+++ commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration2/plist/TestPropertyListParser.java Thu Sep 27 22:24:23 2018
@@ -55,7 +55,7 @@ public class TestPropertyListParser
@Test
public void testParseDate() throws Exception
{
- Calendar calendar = Calendar.getInstance();
+ final Calendar calendar = Calendar.getInstance();
calendar.set(Calendar.YEAR, 2002);
calendar.set(Calendar.MONTH, Calendar.MARCH);
calendar.set(Calendar.DAY_OF_MONTH, 22);
@@ -71,7 +71,7 @@ public class TestPropertyListParser
@Test
public void testFilterData() throws Exception
{
- byte[] expected = new byte[] {0x20, 0x20};
+ final byte[] expected = new byte[] {0x20, 0x20};
ArrayAssert.assertEquals("null string", null, parser.filterData(null));
ArrayAssert.assertEquals("data with < >", expected, parser.filterData("<2020>"));
ArrayAssert.assertEquals("data without < >", expected, parser.filterData("2020"));
Modified: commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration2/plist/TestXMLPropertyListConfiguration.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration2/plist/TestXMLPropertyListConfiguration.java?rev=1842194&r1=1842193&r2=1842194&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration2/plist/TestXMLPropertyListConfiguration.java (original)
+++ commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration2/plist/TestXMLPropertyListConfiguration.java Thu Sep 27 22:24:23 2018
@@ -78,7 +78,7 @@ public class TestXMLPropertyListConfigur
* @param file the test file to be loaded
* @throws ConfigurationException if an error occurs
*/
- private static void load(XMLPropertyListConfiguration c, File file)
+ private static void load(final XMLPropertyListConfiguration c, final File file)
throws ConfigurationException
{
new FileHandler(c).load(file);
@@ -90,7 +90,7 @@ public class TestXMLPropertyListConfigur
* @param file the target file
* @throws ConfigurationException if an error occurs
*/
- private void save(File file) throws ConfigurationException
+ private void save(final File file) throws ConfigurationException
{
new FileHandler(config).save(file);
}
@@ -131,7 +131,7 @@ public class TestXMLPropertyListConfigur
@Test
public void testDate() throws Exception
{
- Calendar calendar = Calendar.getInstance();
+ final Calendar calendar = Calendar.getInstance();
calendar.clear();
calendar.setTimeZone(TimeZone.getTimeZone("UTC"));
calendar.set(2005, Calendar.JANUARY, 1, 12, 0, 0);
@@ -147,8 +147,8 @@ public class TestXMLPropertyListConfigur
@Test
public void testSubset()
{
- Configuration subset = config.subset("dictionary");
- Iterator<String> keys = subset.getKeys();
+ final Configuration subset = config.subset("dictionary");
+ final Iterator<String> keys = subset.getKeys();
String key = keys.next();
assertEquals("1st key", "key1", key);
@@ -168,11 +168,11 @@ public class TestXMLPropertyListConfigur
@Test
public void testArray()
{
- Object array = config.getProperty("array");
+ final Object array = config.getProperty("array");
assertNotNull("array not found", array);
ObjectAssert.assertInstanceOf("the array element is not parsed as a List", List.class, array);
- List<?> list = config.getList("array");
+ final List<?> list = config.getList("array");
assertFalse("empty array", list.isEmpty());
assertEquals("size", 3, list.size());
@@ -184,21 +184,21 @@ public class TestXMLPropertyListConfigur
@Test
public void testNestedArray()
{
- String key = "nested-array";
+ final String key = "nested-array";
- Object array = config.getProperty(key);
+ final Object array = config.getProperty(key);
// root array
assertNotNull("array not found", array);
ObjectAssert.assertInstanceOf("the array element is not parsed as a List", List.class, array);
- List<?> list = config.getList(key);
+ final List<?> list = config.getList(key);
assertFalse("empty array", list.isEmpty());
assertEquals("size", 2, list.size());
// 1st array
ObjectAssert.assertInstanceOf("the array element is not parsed as a List", List.class, list.get(0));
- List<?> list1 = (List<?>) list.get(0);
+ final List<?> list1 = (List<?>) list.get(0);
assertFalse("nested array 1 is empty", list1.isEmpty());
assertEquals("size", 2, list1.size());
assertEquals("1st element", "a", list1.get(0));
@@ -206,7 +206,7 @@ public class TestXMLPropertyListConfigur
// 2nd array
ObjectAssert.assertInstanceOf("the array element is not parsed as a List", List.class, list.get(1));
- List<?> list2 = (List<?>) list.get(1);
+ final List<?> list2 = (List<?>) list.get(1);
assertFalse("nested array 2 is empty", list2.isEmpty());
assertEquals("size", 2, list2.size());
assertEquals("1st element", "c", list2.get(0));
@@ -216,27 +216,27 @@ public class TestXMLPropertyListConfigur
@Test
public void testDictionaryArray()
{
- String key = "dictionary-array";
+ final String key = "dictionary-array";
- Object array = config.getProperty(key);
+ final Object array = config.getProperty(key);
// root array
assertNotNull("array not found", array);
ObjectAssert.assertInstanceOf("the array element is not parsed as a List", List.class, array);
- List<?> list = config.getList(key);
+ final List<?> list = config.getList(key);
assertFalse("empty array", list.isEmpty());
assertEquals("size", 2, list.size());
// 1st dictionary
ObjectAssert.assertInstanceOf("the dict element is not parsed as a Configuration", Configuration.class, list.get(0));
- Configuration conf1 = (Configuration) list.get(0);
+ final Configuration conf1 = (Configuration) list.get(0);
assertFalse("configuration 1 is empty", conf1.isEmpty());
assertEquals("configuration element", "bar", conf1.getProperty("foo"));
// 2nd dictionary
ObjectAssert.assertInstanceOf("the dict element is not parsed as a Configuration", Configuration.class, list.get(1));
- Configuration conf2 = (Configuration) list.get(1);
+ final Configuration conf2 = (Configuration) list.get(1);
assertFalse("configuration 2 is empty", conf2.isEmpty());
assertEquals("configuration element", "value", conf2.getProperty("key"));
}
@@ -250,7 +250,7 @@ public class TestXMLPropertyListConfigur
@Test
public void testSave() throws Exception
{
- File savedFile = folder.newFile();
+ final File savedFile = folder.newFile();
// add an array of strings to the configuration
/*
@@ -277,36 +277,36 @@ public class TestXMLPropertyListConfigur
assertTrue("The saved file doesn't exist", savedFile.exists());
// read the configuration and compare the properties
- XMLPropertyListConfiguration checkConfig = new XMLPropertyListConfiguration();
+ final XMLPropertyListConfiguration checkConfig = new XMLPropertyListConfiguration();
load(checkConfig, savedFile);
- Iterator<String> it = config.getKeys();
+ final Iterator<String> it = config.getKeys();
while (it.hasNext())
{
- String key = it.next();
+ final String key = it.next();
assertTrue("The saved configuration doesn't contain the key '" + key + "'", checkConfig.containsKey(key));
- Object value = checkConfig.getProperty(key);
+ final Object value = checkConfig.getProperty(key);
if (value instanceof byte[])
{
- byte[] array = (byte[]) value;
+ final byte[] array = (byte[]) value;
ArrayAssert.assertEquals("Value of the '" + key + "' property", (byte[]) config.getProperty(key), array);
}
else if (value instanceof List)
{
- List<?> list1 = (List<?>) config.getProperty(key);
- List<?> list2 = (List<?>) value;
+ final List<?> list1 = (List<?>) config.getProperty(key);
+ final List<?> list2 = (List<?>) value;
assertEquals("The size of the list for the key '" + key + "' doesn't match", list1.size(), list2.size());
for (int i = 0; i < list2.size(); i++)
{
- Object value1 = list1.get(i);
- Object value2 = list2.get(i);
+ final Object value1 = list1.get(i);
+ final Object value2 = list2.get(i);
if (value1 instanceof Configuration)
{
- ConfigurationComparator comparator = new StrictConfigurationComparator();
+ final ConfigurationComparator comparator = new StrictConfigurationComparator();
assertTrue("The dictionnary at index " + i + " for the key '" + key + "' doesn't match", comparator.compare((Configuration) value1, (Configuration) value2));
}
else
@@ -328,14 +328,14 @@ public class TestXMLPropertyListConfigur
@Test
public void testSaveEmptyDictionary() throws Exception
{
- File savedFile = folder.newFile();
+ final File savedFile = folder.newFile();
// save the configuration
save(savedFile);
assertTrue("The saved file doesn't exist", savedFile.exists());
// read the configuration and compare the properties
- XMLPropertyListConfiguration checkConfig = new XMLPropertyListConfiguration();
+ final XMLPropertyListConfiguration checkConfig = new XMLPropertyListConfiguration();
load(checkConfig, savedFile);
assertEquals(null, config.getProperty("empty-dictionary"));
@@ -349,15 +349,15 @@ public class TestXMLPropertyListConfigur
@Test
public void testSetDataProperty() throws Exception
{
- File savedFile = folder.newFile();
- byte[] expected = new byte[]{1, 2, 3, 4};
+ final File savedFile = folder.newFile();
+ final byte[] expected = new byte[]{1, 2, 3, 4};
config = new XMLPropertyListConfiguration();
config.setProperty("foo", expected);
save(savedFile);
- XMLPropertyListConfiguration config2 = new XMLPropertyListConfiguration();
+ final XMLPropertyListConfiguration config2 = new XMLPropertyListConfiguration();
load(config2, savedFile);
- Object array = config2.getProperty("foo");
+ final Object array = config2.getProperty("foo");
assertNotNull("data not found", array);
assertEquals("property type", byte[].class, array.getClass());
@@ -370,15 +370,15 @@ public class TestXMLPropertyListConfigur
@Test
public void testAddDataProperty() throws Exception
{
- File savedFile = folder.newFile();
- byte[] expected = new byte[]{1, 2, 3, 4};
+ final File savedFile = folder.newFile();
+ final byte[] expected = new byte[]{1, 2, 3, 4};
config = new XMLPropertyListConfiguration();
config.addProperty("foo", expected);
save(savedFile);
- XMLPropertyListConfiguration config2 = new XMLPropertyListConfiguration();
+ final XMLPropertyListConfiguration config2 = new XMLPropertyListConfiguration();
load(config2, savedFile);
- Object array = config2.getProperty("foo");
+ final Object array = config2.getProperty("foo");
assertNotNull("data not found", array);
assertEquals("property type", byte[].class, array.getClass());
@@ -388,8 +388,8 @@ public class TestXMLPropertyListConfigur
@Test
public void testInitCopy()
{
- XMLPropertyListConfiguration copy = new XMLPropertyListConfiguration(config);
- StrictConfigurationComparator comp = new StrictConfigurationComparator();
+ final XMLPropertyListConfiguration copy = new XMLPropertyListConfiguration(config);
+ final StrictConfigurationComparator comp = new StrictConfigurationComparator();
assertTrue("Configurations are not equal", comp.compare(config, copy));
}
@@ -401,7 +401,7 @@ public class TestXMLPropertyListConfigur
@Test
public void testLoadNoDict() throws ConfigurationException
{
- XMLPropertyListConfiguration plist = new XMLPropertyListConfiguration();
+ final XMLPropertyListConfiguration plist = new XMLPropertyListConfiguration();
load(plist, ConfigurationAssert.getTestFile("test2.plist.xml"));
assertFalse("Configuration is empty", plist.isEmpty());
}
@@ -414,7 +414,7 @@ public class TestXMLPropertyListConfigur
@Test
public void testLoadNoDictConstr() throws ConfigurationException
{
- XMLPropertyListConfiguration plist = new XMLPropertyListConfiguration();
+ final XMLPropertyListConfiguration plist = new XMLPropertyListConfiguration();
load(plist, ConfigurationAssert.getTestFile("test2.plist.xml"));
assertFalse("Configuration is empty", plist.isEmpty());
}
@@ -438,7 +438,7 @@ public class TestXMLPropertyListConfigur
@Test
public void testSaveNoEncoding() throws ConfigurationException
{
- StringWriter writer = new StringWriter();
+ final StringWriter writer = new StringWriter();
new FileHandler(config).save(writer);
assertTrue("Wrong document header",
writer.toString().indexOf("<?xml version=\"1.0\"?>") >= 0);
@@ -450,10 +450,10 @@ public class TestXMLPropertyListConfigur
@Test
public void testSaveWithEncoding() throws ConfigurationException
{
- String encoding = "UTF-8";
- FileHandler handler = new FileHandler(config);
+ final String encoding = "UTF-8";
+ final FileHandler handler = new FileHandler(config);
handler.setEncoding(encoding);
- StringWriter writer = new StringWriter();
+ final StringWriter writer = new StringWriter();
handler.save(writer);
assertTrue(
"Encoding not found",
@@ -468,17 +468,17 @@ public class TestXMLPropertyListConfigur
*
* @param expectedValues the expected values
*/
- private void checkArrayProperty(List<?> expectedValues)
+ private void checkArrayProperty(final List<?> expectedValues)
throws ConfigurationException
{
- StringWriter out = new StringWriter();
+ final StringWriter out = new StringWriter();
new FileHandler(config).save(out);
- StringBuilder values = new StringBuilder();
- for (Object v : expectedValues)
+ final StringBuilder values = new StringBuilder();
+ for (final Object v : expectedValues)
{
values.append("<string>").append(v).append("</string>");
}
- String content = out.toString().replaceAll("[ \n\r]", "");
+ final String content = out.toString().replaceAll("[ \n\r]", "");
assertThat(content, containsString(String.format(
"<key>array</key><array>%s</array>", values)));
}
@@ -490,7 +490,7 @@ public class TestXMLPropertyListConfigur
@Test
public void testSaveList() throws ConfigurationException
{
- List<String> elems =
+ final List<String> elems =
Arrays.asList("element1", "element2", "anotherElement");
config = new XMLPropertyListConfiguration();
config.addProperty("array", elems);
@@ -505,7 +505,7 @@ public class TestXMLPropertyListConfigur
@Test
public void testSaveArray() throws ConfigurationException
{
- Object[] elems = {
+ final Object[] elems = {
"arrayElem1", "arrayElem2", "arrayElem3"
};
config = new XMLPropertyListConfiguration();
@@ -524,13 +524,13 @@ public class TestXMLPropertyListConfigur
config = new XMLPropertyListConfiguration();
config.addProperty("foo", "bar");
- Writer out = new FileWriter(folder.newFile());
+ final Writer out = new FileWriter(folder.newFile());
try
{
config.write(out);
fail("No exception thrown!");
}
- catch (ConfigurationException e)
+ catch (final ConfigurationException e)
{
assertThat(e.getMessage(), containsString("FileHandler"));
}
Modified: commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration2/plist/TestXMLPropertyListConfigurationEvents.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration2/plist/TestXMLPropertyListConfigurationEvents.java?rev=1842194&r1=1842193&r2=1842194&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration2/plist/TestXMLPropertyListConfigurationEvents.java (original)
+++ commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration2/plist/TestXMLPropertyListConfigurationEvents.java Thu Sep 27 22:24:23 2018
@@ -40,11 +40,11 @@ public class TestXMLPropertyListConfigur
{
try
{
- XMLPropertyListConfiguration c = new XMLPropertyListConfiguration();
+ final XMLPropertyListConfiguration c = new XMLPropertyListConfiguration();
new FileHandler(c).load(TEST_FILE);
return c;
}
- catch (ConfigurationException cex)
+ catch (final ConfigurationException cex)
{
throw new ConfigurationRuntimeException(cex);
}
Modified: commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration2/reloading/TestCombinedReloadingController.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration2/reloading/TestCombinedReloadingController.java?rev=1842194&r1=1842193&r2=1842194&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration2/reloading/TestCombinedReloadingController.java (original)
+++ commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration2/reloading/TestCombinedReloadingController.java Thu Sep 27 22:24:23 2018
@@ -74,10 +74,10 @@ public class TestCombinedReloadingContro
private CombinedReloadingController setUpController()
{
initSubControllers();
- List<ReloadingController> lstCtrls =
+ final List<ReloadingController> lstCtrls =
new ArrayList<>(
Arrays.asList(subControllers));
- CombinedReloadingController result =
+ final CombinedReloadingController result =
new CombinedReloadingController(lstCtrls);
// check whether a defensive copy is created
lstCtrls.clear();
@@ -100,7 +100,7 @@ public class TestCombinedReloadingContro
public void testInitNullEntries()
{
initSubControllers();
- Collection<ReloadingController> ctrls =
+ final Collection<ReloadingController> ctrls =
new ArrayList<>(
Arrays.asList(subControllers));
ctrls.add(null);
@@ -113,7 +113,7 @@ public class TestCombinedReloadingContro
@Test
public void testCheckForReloadingTrue()
{
- CombinedReloadingController ctrl = setUpController();
+ final CombinedReloadingController ctrl = setUpController();
EasyMock.expect(subControllers[0].checkForReloading(null)).andReturn(
Boolean.FALSE);
EasyMock.expect(subControllers[1].checkForReloading(null)).andReturn(
@@ -131,8 +131,8 @@ public class TestCombinedReloadingContro
@Test
public void testCheckForReloadingFalse()
{
- CombinedReloadingController ctrl = setUpController();
- for (ReloadingController rc : subControllers)
+ final CombinedReloadingController ctrl = setUpController();
+ for (final ReloadingController rc : subControllers)
{
EasyMock.expect(rc.checkForReloading(null))
.andReturn(Boolean.FALSE);
@@ -148,14 +148,14 @@ public class TestCombinedReloadingContro
@Test
public void testResetReloadingState()
{
- CombinedReloadingController ctrl = setUpController();
+ final CombinedReloadingController ctrl = setUpController();
EasyMock.expect(subControllers[0].checkForReloading(null)).andReturn(
Boolean.TRUE);
EasyMock.expect(subControllers[1].checkForReloading(null)).andReturn(
Boolean.FALSE);
EasyMock.expect(subControllers[2].checkForReloading(null)).andReturn(
Boolean.FALSE);
- for (ReloadingController rc : subControllers)
+ for (final ReloadingController rc : subControllers)
{
rc.resetReloadingState();
}
@@ -172,8 +172,8 @@ public class TestCombinedReloadingContro
@Test
public void testResetInitialReloadingState()
{
- CombinedReloadingController ctrl = setUpController();
- for (ReloadingController rc : subControllers)
+ final CombinedReloadingController ctrl = setUpController();
+ for (final ReloadingController rc : subControllers)
{
rc.resetReloadingState();
}
@@ -188,9 +188,9 @@ public class TestCombinedReloadingContro
@Test
public void testGetSubControllers()
{
- CombinedReloadingController ctrl = setUpController();
+ final CombinedReloadingController ctrl = setUpController();
replaySubControllers();
- Collection<ReloadingController> subs = ctrl.getSubControllers();
+ final Collection<ReloadingController> subs = ctrl.getSubControllers();
assertEquals("Wrong number of sub controllers", subControllers.length,
subs.size());
assertTrue("Wrong sub controllers",
@@ -203,7 +203,7 @@ public class TestCombinedReloadingContro
@Test(expected = UnsupportedOperationException.class)
public void testGetSubControllersModify()
{
- Collection<ReloadingController> subs =
+ final Collection<ReloadingController> subs =
setUpController().getSubControllers();
subs.clear();
}
Modified: commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration2/reloading/TestFileHandlerReloadingDetector.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration2/reloading/TestFileHandlerReloadingDetector.java?rev=1842194&r1=1842193&r2=1842194&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration2/reloading/TestFileHandlerReloadingDetector.java (original)
+++ commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration2/reloading/TestFileHandlerReloadingDetector.java Thu Sep 27 22:24:23 2018
@@ -46,8 +46,8 @@ public class TestFileHandlerReloadingDet
@Test
public void testInitWithFileHandler()
{
- FileHandler handler = new FileHandler();
- FileHandlerReloadingDetector detector = new FileHandlerReloadingDetector(
+ final FileHandler handler = new FileHandler();
+ final FileHandlerReloadingDetector detector = new FileHandlerReloadingDetector(
handler);
assertSame("Different file handler", handler, detector.getFileHandler());
}
@@ -58,7 +58,7 @@ public class TestFileHandlerReloadingDet
@Test
public void testDefaultRefreshDelay()
{
- FileHandlerReloadingDetector detector = new FileHandlerReloadingDetector();
+ final FileHandlerReloadingDetector detector = new FileHandlerReloadingDetector();
assertEquals("Wrong delay", 5000, detector.getRefreshDelay());
}
@@ -68,7 +68,7 @@ public class TestFileHandlerReloadingDet
@Test
public void testLocationAfterInit()
{
- FileHandlerReloadingDetector detector = new FileHandlerReloadingDetector();
+ final FileHandlerReloadingDetector detector = new FileHandlerReloadingDetector();
assertFalse("Got a location", detector.getFileHandler()
.isLocationDefined());
}
@@ -79,7 +79,7 @@ public class TestFileHandlerReloadingDet
@Test
public void testIsReloadingRequiredNoLocation()
{
- FileHandlerReloadingDetector detector = new FileHandlerReloadingDetector();
+ final FileHandlerReloadingDetector detector = new FileHandlerReloadingDetector();
assertFalse("Reloading", detector.isReloadingRequired());
}
@@ -89,12 +89,12 @@ public class TestFileHandlerReloadingDet
@Test
public void testIsReloadingRequiredTrue() throws Exception
{
- File f = EasyMock.createMock(File.class);
+ final File f = EasyMock.createMock(File.class);
EasyMock.expect(f.exists()).andReturn(Boolean.TRUE).anyTimes();
EasyMock.expect(f.lastModified()).andReturn(LAST_MODIFIED);
EasyMock.expect(f.lastModified()).andReturn(LAST_MODIFIED + 1);
EasyMock.replay(f);
- FileHandlerReloadingDetector detector = new FileHandlerReloadingDetectorTestImpl(f);
+ final FileHandlerReloadingDetector detector = new FileHandlerReloadingDetectorTestImpl(f);
assertFalse("Reloading required", detector.isReloadingRequired());
assertTrue("Reloading not detected", detector.isReloadingRequired());
}
@@ -106,13 +106,13 @@ public class TestFileHandlerReloadingDet
@Test
public void testReloadingAndReset() throws Exception
{
- File f = EasyMock.createMock(File.class);
+ final File f = EasyMock.createMock(File.class);
EasyMock.expect(f.exists()).andReturn(Boolean.TRUE).anyTimes();
EasyMock.expect(f.lastModified()).andReturn(LAST_MODIFIED);
EasyMock.expect(f.lastModified()).andReturn(LAST_MODIFIED + 1).times(3);
EasyMock.expect(f.lastModified()).andReturn(LAST_MODIFIED + 2);
EasyMock.replay(f);
- FileHandlerReloadingDetector detector = new FileHandlerReloadingDetectorTestImpl(f);
+ final FileHandlerReloadingDetector detector = new FileHandlerReloadingDetectorTestImpl(f);
assertFalse("Reloading required", detector.isReloadingRequired());
assertTrue("Reloading not detected", detector.isReloadingRequired());
detector.reloadingPerformed();
@@ -128,12 +128,12 @@ public class TestFileHandlerReloadingDet
@Test
public void testRefreshIsReloadingRequiredTrue() throws Exception
{
- File f = EasyMock.createMock(File.class);
+ final File f = EasyMock.createMock(File.class);
EasyMock.expect(f.exists()).andReturn(Boolean.TRUE).anyTimes();
EasyMock.expect(f.lastModified()).andReturn(LAST_MODIFIED);
EasyMock.expect(f.lastModified()).andReturn(LAST_MODIFIED + 1);
EasyMock.replay(f);
- FileHandlerReloadingDetector detector = new FileHandlerReloadingDetectorTestImpl(f);
+ final FileHandlerReloadingDetector detector = new FileHandlerReloadingDetectorTestImpl(f);
detector.refresh();
assertTrue("Reloading not detected", detector.isReloadingRequired());
}
@@ -145,13 +145,13 @@ public class TestFileHandlerReloadingDet
@Test
public void testRefreshReloadingAndReset() throws Exception
{
- File f = EasyMock.createMock(File.class);
+ final File f = EasyMock.createMock(File.class);
EasyMock.expect(f.exists()).andReturn(Boolean.TRUE).anyTimes();
EasyMock.expect(f.lastModified()).andReturn(LAST_MODIFIED).times(2);
EasyMock.expect(f.lastModified()).andReturn(LAST_MODIFIED + 1).times(3);
EasyMock.expect(f.lastModified()).andReturn(LAST_MODIFIED + 2);
EasyMock.replay(f);
- FileHandlerReloadingDetector detector = new FileHandlerReloadingDetectorTestImpl(f);
+ final FileHandlerReloadingDetector detector = new FileHandlerReloadingDetectorTestImpl(f);
detector.refresh();
assertFalse("Reloading required", detector.isReloadingRequired());
assertTrue("Reloading not detected", detector.isReloadingRequired());
@@ -167,11 +167,11 @@ public class TestFileHandlerReloadingDet
@Test
public void testRefreshDelay() throws Exception
{
- File f = EasyMock.createMock(File.class);
+ final File f = EasyMock.createMock(File.class);
EasyMock.expect(f.exists()).andReturn(Boolean.TRUE).anyTimes();
EasyMock.expect(f.lastModified()).andReturn(LAST_MODIFIED).times(2);
EasyMock.replay(f);
- FileHandlerReloadingDetector detector = new FileHandlerReloadingDetectorTestImpl(
+ final FileHandlerReloadingDetector detector = new FileHandlerReloadingDetectorTestImpl(
f, 60 * 60 * 1000L);
detector.reloadingPerformed();
assertFalse("Reloading initially required",
@@ -185,7 +185,7 @@ public class TestFileHandlerReloadingDet
@Test
public void testIsReloadingRequiredFileDoesNotExist()
{
- FileHandlerReloadingDetector detector = new FileHandlerReloadingDetector();
+ final FileHandlerReloadingDetector detector = new FileHandlerReloadingDetector();
detector.getFileHandler().setFile(new File("NonExistingFile.txt"));
detector.reloadingPerformed();
assertFalse("Reloading required", detector.isReloadingRequired());
@@ -197,13 +197,13 @@ public class TestFileHandlerReloadingDet
@Test
public void testGetFileJarURL() throws Exception
{
- FileHandlerReloadingDetector detector = new FileHandlerReloadingDetector();
- URL url =
+ final FileHandlerReloadingDetector detector = new FileHandlerReloadingDetector();
+ final URL url =
new URL("jar:"
+ new File("conf/resources.jar").getAbsoluteFile()
.toURI().toURL() + "!/test-jar.xml");
detector.getFileHandler().setURL(url);
- File file = detector.getFile();
+ final File file = detector.getFile();
assertNotNull("Detector's file is null", file);
assertEquals("Detector does not monitor the jar file", "resources.jar",
file.getName());
@@ -224,7 +224,7 @@ public class TestFileHandlerReloadingDet
*
* @param file the mock file
*/
- public FileHandlerReloadingDetectorTestImpl(File file) {
+ public FileHandlerReloadingDetectorTestImpl(final File file) {
this(file, 0);
}
@@ -236,7 +236,7 @@ public class TestFileHandlerReloadingDet
* @param file the mock file
* @param delay the delay
*/
- public FileHandlerReloadingDetectorTestImpl(File file, long delay)
+ public FileHandlerReloadingDetectorTestImpl(final File file, final long delay)
{
super(null, delay);
mockFile = file;
Modified: commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration2/reloading/TestPeriodicReloadingTrigger.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration2/reloading/TestPeriodicReloadingTrigger.java?rev=1842194&r1=1842193&r2=1842194&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration2/reloading/TestPeriodicReloadingTrigger.java (original)
+++ commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration2/reloading/TestPeriodicReloadingTrigger.java Thu Sep 27 22:24:23 2018
@@ -76,7 +76,7 @@ public class TestPeriodicReloadingTrigge
@Test
public void testDefaultExecutor()
{
- PeriodicReloadingTrigger trigger =
+ final PeriodicReloadingTrigger trigger =
new PeriodicReloadingTrigger(controller, CTRL_PARAM, PERIOD, UNIT);
assertNotNull("No executor service", trigger.getExecutorService());
}
@@ -107,6 +107,7 @@ public class TestPeriodicReloadingTrigge
private static ScheduledFuture<Void> createFutureMock()
{
@SuppressWarnings("unchecked")
+ final
ScheduledFuture<Void> mock = EasyMock.createMock(ScheduledFuture.class);
return mock;
}
@@ -117,7 +118,7 @@ public class TestPeriodicReloadingTrigge
*
* @param future the future object to return
*/
- private void expectSchedule(ScheduledFuture<Void> future)
+ private void expectSchedule(final ScheduledFuture<Void> future)
{
executor.scheduleAtFixedRate(EasyMock.anyObject(Runnable.class),
EasyMock.eq(PERIOD), EasyMock.eq(PERIOD), EasyMock.eq(UNIT));
@@ -150,7 +151,7 @@ public class TestPeriodicReloadingTrigge
EasyMock.expect(controller.checkForReloading(CTRL_PARAM)).andReturn(
Boolean.FALSE);
EasyMock.replay(future, controller, executor);
- PeriodicReloadingTrigger trigger = createTrigger();
+ final PeriodicReloadingTrigger trigger = createTrigger();
trigger.start();
assertTrue("Not started", trigger.isRunning());
refTask.getValue().run();
@@ -163,10 +164,10 @@ public class TestPeriodicReloadingTrigge
@Test
public void testStartTwice()
{
- ScheduledFuture<Void> future = createFutureMock();
+ final ScheduledFuture<Void> future = createFutureMock();
expectSchedule(future);
EasyMock.replay(future, controller, executor);
- PeriodicReloadingTrigger trigger = createTrigger();
+ final PeriodicReloadingTrigger trigger = createTrigger();
trigger.start();
trigger.start();
EasyMock.verify(future, controller, executor);
@@ -188,11 +189,11 @@ public class TestPeriodicReloadingTrigge
@Test
public void testStop()
{
- ScheduledFuture<Void> future = createFutureMock();
+ final ScheduledFuture<Void> future = createFutureMock();
expectSchedule(future);
EasyMock.expect(future.cancel(false)).andReturn(Boolean.TRUE);
EasyMock.replay(future, controller, executor);
- PeriodicReloadingTrigger trigger = createTrigger();
+ final PeriodicReloadingTrigger trigger = createTrigger();
trigger.start();
trigger.stop();
assertFalse("Still running", trigger.isRunning());
@@ -205,12 +206,12 @@ public class TestPeriodicReloadingTrigge
@Test
public void testShutdown()
{
- ScheduledFuture<Void> future = createFutureMock();
+ final ScheduledFuture<Void> future = createFutureMock();
expectSchedule(future);
EasyMock.expect(future.cancel(false)).andReturn(Boolean.TRUE);
executor.shutdown();
EasyMock.replay(future, controller, executor);
- PeriodicReloadingTrigger trigger = createTrigger();
+ final PeriodicReloadingTrigger trigger = createTrigger();
trigger.start();
trigger.shutdown();
EasyMock.verify(future, controller, executor);
Modified: commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration2/reloading/TestReloadingController.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration2/reloading/TestReloadingController.java?rev=1842194&r1=1842193&r2=1842194&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration2/reloading/TestReloadingController.java (original)
+++ commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration2/reloading/TestReloadingController.java Thu Sep 27 22:24:23 2018
@@ -82,6 +82,7 @@ public class TestReloadingController
private static EventListener<ReloadingEvent> createListenerMock()
{
@SuppressWarnings("unchecked")
+ final
EventListener<ReloadingEvent> listener =
EasyMock.createMock(EventListener.class);
return listener;
@@ -94,7 +95,7 @@ public class TestReloadingController
* @param l the listener mock
* @param evRef the reference where to store the event
*/
- private void expectEvent(EventListener<ReloadingEvent> l,
+ private void expectEvent(final EventListener<ReloadingEvent> l,
final MutableObject<ReloadingEvent> evRef)
{
l.onEvent(EasyMock.anyObject(ReloadingEvent.class));
@@ -115,18 +116,18 @@ public class TestReloadingController
@Test
public void testCheckForReloadingTrue()
{
- EventListener<ReloadingEvent> l = createListenerMock();
- EventListener<ReloadingEvent> lRemoved = createListenerMock();
- MutableObject<ReloadingEvent> evRef = new MutableObject<>();
+ final EventListener<ReloadingEvent> l = createListenerMock();
+ final EventListener<ReloadingEvent> lRemoved = createListenerMock();
+ final MutableObject<ReloadingEvent> evRef = new MutableObject<>();
expectEvent(l, evRef);
EasyMock.expect(detector.isReloadingRequired()).andReturn(Boolean.TRUE);
EasyMock.replay(detector, l, lRemoved);
- ReloadingController ctrl = createController();
+ final ReloadingController ctrl = createController();
ctrl.addEventListener(ReloadingEvent.ANY, lRemoved);
ctrl.addEventListener(ReloadingEvent.ANY, l);
assertTrue("Wrong result",
ctrl.removeEventListener(ReloadingEvent.ANY, lRemoved));
- Object testData = "Some test data";
+ final Object testData = "Some test data";
assertTrue("Wrong result", ctrl.checkForReloading(testData));
assertTrue("Not in reloading state", ctrl.isInReloadingState());
assertSame("Wrong event source", ctrl, evRef.getValue().getSource());
@@ -141,11 +142,11 @@ public class TestReloadingController
@Test
public void testCheckForReloadingFalse()
{
- EventListener<ReloadingEvent> l = createListenerMock();
+ final EventListener<ReloadingEvent> l = createListenerMock();
EasyMock.expect(detector.isReloadingRequired())
.andReturn(Boolean.FALSE);
EasyMock.replay(detector, l);
- ReloadingController ctrl = createController();
+ final ReloadingController ctrl = createController();
ctrl.addEventListener(ReloadingEvent.ANY, l);
assertFalse("Wrong result", ctrl.checkForReloading(null));
assertFalse("In reloading state", ctrl.isInReloadingState());
@@ -159,11 +160,11 @@ public class TestReloadingController
@Test
public void testCheckForReloadingInReloadingState()
{
- EventListener<ReloadingEvent> l = createListenerMock();
+ final EventListener<ReloadingEvent> l = createListenerMock();
EasyMock.expect(detector.isReloadingRequired()).andReturn(Boolean.TRUE);
expectEvent(l, new MutableObject<ReloadingEvent>());
EasyMock.replay(detector, l);
- ReloadingController ctrl = createController();
+ final ReloadingController ctrl = createController();
ctrl.addEventListener(ReloadingEvent.ANY, l);
assertTrue("Wrong result (1)", ctrl.checkForReloading(1));
assertTrue("Wrong result (2)", ctrl.checkForReloading(2));
@@ -179,7 +180,7 @@ public class TestReloadingController
EasyMock.expect(detector.isReloadingRequired()).andReturn(Boolean.TRUE);
detector.reloadingPerformed();
EasyMock.replay(detector);
- ReloadingController ctrl = createController();
+ final ReloadingController ctrl = createController();
ctrl.checkForReloading(null);
ctrl.resetReloadingState();
assertFalse("In reloading state", ctrl.isInReloadingState());
Modified: commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration2/reloading/TestVFSFileHandlerReloadingDetector.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration2/reloading/TestVFSFileHandlerReloadingDetector.java?rev=1842194&r1=1842193&r2=1842194&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration2/reloading/TestVFSFileHandlerReloadingDetector.java (original)
+++ commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration2/reloading/TestVFSFileHandlerReloadingDetector.java Thu Sep 27 22:24:23 2018
@@ -63,9 +63,9 @@ public class TestVFSFileHandlerReloading
* @param value the value of the test property
* @throws IOException if an error occurs
*/
- private void writeTestFile(File file, String value) throws IOException
+ private void writeTestFile(final File file, final String value) throws IOException
{
- FileWriter out = new FileWriter(file);
+ final FileWriter out = new FileWriter(file);
out.write(String.format(FMT_XML, value));
out.close();
}
@@ -77,13 +77,13 @@ public class TestVFSFileHandlerReloading
@Test
public void testLastModificationDateExisting() throws IOException
{
- File file = folder.newFile();
+ final File file = folder.newFile();
writeTestFile(file, "value1");
- VFSFileHandlerReloadingDetector strategy =
+ final VFSFileHandlerReloadingDetector strategy =
new VFSFileHandlerReloadingDetector();
strategy.getFileHandler().setFile(file);
strategy.getFileHandler().setFileSystem(new VFSFileSystem());
- long modificationDate = strategy.getLastModificationDate();
+ final long modificationDate = strategy.getLastModificationDate();
assertEquals("Wrong modification date", file.lastModified(),
modificationDate);
}
@@ -94,11 +94,11 @@ public class TestVFSFileHandlerReloading
@Test
public void testLastModificationDateNonExisting()
{
- File file = ConfigurationAssert.getOutFile("NonExistingFile.xml");
- FileHandler handler = new FileHandler();
+ final File file = ConfigurationAssert.getOutFile("NonExistingFile.xml");
+ final FileHandler handler = new FileHandler();
handler.setFileSystem(new VFSFileSystem());
handler.setFile(file);
- VFSFileHandlerReloadingDetector strategy =
+ final VFSFileHandlerReloadingDetector strategy =
new VFSFileHandlerReloadingDetector(handler);
assertEquals("Got a modification date", 0,
strategy.getLastModificationDate());
@@ -110,7 +110,7 @@ public class TestVFSFileHandlerReloading
@Test
public void testLastModificationDateUndefinedHandler()
{
- VFSFileHandlerReloadingDetector strategy =
+ final VFSFileHandlerReloadingDetector strategy =
new VFSFileHandlerReloadingDetector();
assertEquals("Got a modification date", 0,
strategy.getLastModificationDate());
@@ -125,14 +125,14 @@ public class TestVFSFileHandlerReloading
throws FileSystemException
{
final FileObject fo = EasyMock.createMock(FileObject.class);
- FileName name = EasyMock.createMock(FileName.class);
+ final FileName name = EasyMock.createMock(FileName.class);
EasyMock.expect(fo.exists()).andReturn(Boolean.TRUE);
EasyMock.expect(fo.getContent()).andThrow(
new FileSystemException("error"));
EasyMock.expect(fo.getName()).andReturn(name);
EasyMock.expect(name.getURI()).andReturn("someURI");
EasyMock.replay(fo, name);
- VFSFileHandlerReloadingDetector strategy =
+ final VFSFileHandlerReloadingDetector strategy =
new VFSFileHandlerReloadingDetector()
{
@Override
@@ -152,7 +152,7 @@ public class TestVFSFileHandlerReloading
@Test(expected = ConfigurationRuntimeException.class)
public void testLastModificationDateUnresolvableURI()
{
- VFSFileHandlerReloadingDetector strategy =
+ final VFSFileHandlerReloadingDetector strategy =
new VFSFileHandlerReloadingDetector()
{
@Override
@@ -173,7 +173,7 @@ public class TestVFSFileHandlerReloading
public void testGetRefreshDelay() throws Exception
{
final long delay = 20130325L;
- VFSFileHandlerReloadingDetector strategy =
+ final VFSFileHandlerReloadingDetector strategy =
new VFSFileHandlerReloadingDetector(null, delay);
assertNotNull("No file handler was created", strategy.getFileHandler());
assertEquals("Wrong refresh delay", delay, strategy.getRefreshDelay());
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=1842194&r1=1842193&r2=1842194&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 Thu Sep 27 22:24:23 2018
@@ -67,13 +67,13 @@ public class TestConfigurationProperties
@Test
public void testMergeConfigurations() throws Exception
{
- Configuration one = new BaseConfiguration();
+ final Configuration one = new BaseConfiguration();
one.setProperty("foo", "bar");
- String properties =
+ final String properties =
"## some header \n" + "foo = bar1\n" + "bar = foo\n";
- PropertiesConfiguration two = new PropertiesConfiguration();
- PropertiesConfigurationLayout layout =
+ final PropertiesConfiguration two = new PropertiesConfiguration();
+ final PropertiesConfigurationLayout layout =
new PropertiesConfigurationLayout();
layout.load(two, new StringReader(properties));
@@ -81,7 +81,7 @@ public class TestConfigurationProperties
one, two
});
configurationFactory.afterPropertiesSet();
- Properties props = configurationFactory.getObject();
+ final Properties props = configurationFactory.getObject();
Assert.assertEquals("foo", props.getProperty("bar"));
Assert.assertEquals("bar", props.getProperty("foo"));
}
@@ -97,7 +97,7 @@ public class TestConfigurationProperties
});
configurationFactory.afterPropertiesSet();
- Properties props = configurationFactory.getObject();
+ final Properties props = configurationFactory.getObject();
Assert.assertEquals("duke", props.getProperty("java"));
}
@@ -113,10 +113,10 @@ public class TestConfigurationProperties
@Test
public void testSetLocationsDefensiveCopy()
{
- Resource[] locations = {
+ final Resource[] locations = {
new ClassPathResource("f1"), new ClassPathResource("f2")
};
- Resource[] locationsUpdate = locations.clone();
+ final Resource[] locationsUpdate = locations.clone();
configurationFactory.setLocations(locationsUpdate);
locationsUpdate[0] = new ClassPathResource("other");
@@ -134,12 +134,12 @@ public class TestConfigurationProperties
@Test
public void testGetLocationsDefensiveCopy()
{
- Resource[] locations = {
+ final Resource[] locations = {
new ClassPathResource("f1"), new ClassPathResource("f2")
};
configurationFactory.setLocations(locations);
- Resource[] locationsGet = configurationFactory.getLocations();
+ final Resource[] locationsGet = configurationFactory.getLocations();
locationsGet[1] = null;
assertArrayEquals("Locations were changed", locations,
configurationFactory.getLocations());
@@ -148,10 +148,10 @@ public class TestConfigurationProperties
@Test
public void testSetConfigurationsDefensiveCopy()
{
- Configuration[] configs = {
+ final Configuration[] configs = {
new PropertiesConfiguration(), new XMLConfiguration()
};
- Configuration[] configsUpdate = configs.clone();
+ final Configuration[] configsUpdate = configs.clone();
configurationFactory.setConfigurations(configsUpdate);
configsUpdate[0] = null;
@@ -162,12 +162,12 @@ public class TestConfigurationProperties
@Test
public void testGetConfigurationDefensiveCopy()
{
- Configuration[] configs = {
+ final Configuration[] configs = {
new PropertiesConfiguration(), new XMLConfiguration()
};
configurationFactory.setConfigurations(configs);
- Configuration[] configsGet = configurationFactory.getConfigurations();
+ final Configuration[] configsGet = configurationFactory.getConfigurations();
configsGet[0] = null;
assertArrayEquals("Configurations were changed", configs,
configurationFactory.getConfigurations());
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=1842194&r1=1842193&r2=1842194&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 Thu Sep 27 22:24:23 2018
@@ -56,13 +56,13 @@ public class TestConfigurationPropertySo
@Bean
public PropertySourcesPlaceholderConfigurer propertySourcesPlaceholderConfigurer(
- ConfigurableEnvironment env)
+ final ConfigurableEnvironment env)
{
- PropertySourcesPlaceholderConfigurer configurer =
+ final PropertySourcesPlaceholderConfigurer configurer =
new PropertySourcesPlaceholderConfigurer();
// https://jira.spring.io/browse/SPR-9631 may simplify this in
// future
- MutablePropertySources sources = new MutablePropertySources();
+ final MutablePropertySources sources = new MutablePropertySources();
sources.addLast(createConfigPropertySource());
configurer.setPropertySources(sources);
configurer.setEnvironment(env);
@@ -72,7 +72,7 @@ public class TestConfigurationPropertySo
private static ConfigurationPropertySource createConfigPropertySource()
{
- PropertiesConfiguration propertiesConfiguration =
+ final PropertiesConfiguration propertiesConfiguration =
new PropertiesConfiguration();
propertiesConfiguration.addProperty(TEST_PROPERTY, TEST_VALUE);
return new ConfigurationPropertySource("test configuration",