TAMAYA-57 Splittet hughe test case in multiple smaller ones.
Project: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/commit/ab4835d3 Tree: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/tree/ab4835d3 Diff: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/diff/ab4835d3 Branch: refs/heads/master Commit: ab4835d3152e28279c3f1aad297f1f5897ed304a Parents: ff6e9f2 Author: Oliver B. Fischer <[email protected]> Authored: Tue Feb 10 07:41:36 2015 +0100 Committer: Oliver B. Fischer <[email protected]> Committed: Tue Feb 10 07:41:36 2015 +0100 ---------------------------------------------------------------------- .../core/internal/PropertiesFileLoaderTest.java | 59 +++++++++++--------- 1 file changed, 32 insertions(+), 27 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/ab4835d3/java8/core/src/test/java/org/apache/tamaya/core/internal/PropertiesFileLoaderTest.java ---------------------------------------------------------------------- diff --git a/java8/core/src/test/java/org/apache/tamaya/core/internal/PropertiesFileLoaderTest.java b/java8/core/src/test/java/org/apache/tamaya/core/internal/PropertiesFileLoaderTest.java index 8660915..436c0dd 100644 --- a/java8/core/src/test/java/org/apache/tamaya/core/internal/PropertiesFileLoaderTest.java +++ b/java8/core/src/test/java/org/apache/tamaya/core/internal/PropertiesFileLoaderTest.java @@ -27,42 +27,47 @@ import java.util.Properties; public class PropertiesFileLoaderTest { - @Test - public void testResolvePropertiesFiles() throws Exception { - Properties expectedProperties = PropertiesFileLoader.load(Thread.currentThread().getContextClassLoader().getResource("testfile.properties")); + public void resolveExistingPropertiesFileWithExtension() throws Exception { + Properties expectedProperties = PropertiesFileLoader.load(Thread.currentThread() + .getContextClassLoader() + .getResource("testfile.properties")); - { - // with .properties - Enumeration<URL> urls = PropertiesFileLoader.resolvePropertiesFiles("testfile.properties"); - Assert.assertNotNull(urls); - Assert.assertTrue(urls.hasMoreElements()); - Properties properties = PropertiesFileLoader.load(urls.nextElement()); - Assert.assertEquals(expectedProperties.size(), properties.size()); + // with .properties + Enumeration<URL> urls = PropertiesFileLoader.resolvePropertiesFiles("testfile.properties"); + Assert.assertNotNull(urls); + Assert.assertTrue(urls.hasMoreElements()); - Assert.assertFalse(urls.hasMoreElements()); - } + Properties properties = PropertiesFileLoader.load(urls.nextElement()); + Assert.assertEquals(expectedProperties.size(), properties.size()); - { - // without .properties - Enumeration<URL> urls = PropertiesFileLoader.resolvePropertiesFiles("testfile"); - Assert.assertNotNull(urls); - Assert.assertTrue(urls.hasMoreElements()); + Assert.assertFalse(urls.hasMoreElements()); + } - Properties properties = PropertiesFileLoader.load(urls.nextElement()); - Assert.assertEquals(expectedProperties.size(), properties.size()); + @Test + public void resolveExistingPropertiesFileWithoutExtension() throws Exception { + Properties expectedProperties = PropertiesFileLoader.load(Thread.currentThread() + .getContextClassLoader() + .getResource("testfile.properties")); - Assert.assertFalse(urls.hasMoreElements()); - } + // without .properties + Enumeration<URL> urls = PropertiesFileLoader.resolvePropertiesFiles("testfile"); + Assert.assertNotNull(urls); + Assert.assertTrue(urls.hasMoreElements()); - { - // with a while which doesn't exist - Enumeration<URL> urls = PropertiesFileLoader.resolvePropertiesFiles("nonexistingfile.properties"); - Assert.assertNotNull(urls); - Assert.assertFalse(urls.hasMoreElements()); - } + Properties properties = PropertiesFileLoader.load(urls.nextElement()); + Assert.assertEquals(expectedProperties.size(), properties.size()); + + Assert.assertFalse(urls.hasMoreElements()); + } + @Test + public void resolveNonExistingPropertiesFile() throws Exception { + // with a while which doesn't exist + Enumeration<URL> urls = PropertiesFileLoader.resolvePropertiesFiles("nonexistingfile.properties"); + Assert.assertNotNull(urls); + Assert.assertFalse(urls.hasMoreElements()); } @Test
