Repository: incubator-tamaya Updated Branches: refs/heads/master 61753ed7e -> ab4835d31
TAMAYA-57 Renamed test class. Project: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/commit/ff6e9f2f Tree: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/tree/ff6e9f2f Diff: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/diff/ff6e9f2f Branch: refs/heads/master Commit: ff6e9f2f6381c1c55ada16cd7fa5c1de4c35be39 Parents: 61753ed Author: Oliver B. Fischer <[email protected]> Authored: Tue Feb 10 07:37:20 2015 +0100 Committer: Oliver B. Fischer <[email protected]> Committed: Tue Feb 10 07:37:20 2015 +0100 ---------------------------------------------------------------------- .../core/internal/PropertiesFileLoaderTest.java | 79 ++++++++++++++++++++ .../core/internal/PropetiesFileLoaderTest.java | 79 -------------------- 2 files changed, 79 insertions(+), 79 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/ff6e9f2f/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 new file mode 100644 index 0000000..8660915 --- /dev/null +++ b/java8/core/src/test/java/org/apache/tamaya/core/internal/PropertiesFileLoaderTest.java @@ -0,0 +1,79 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tamaya.core.internal; + +import org.junit.Assert; +import org.junit.Test; + +import java.net.URL; +import java.util.Enumeration; +import java.util.Properties; + +public class PropertiesFileLoaderTest { + + + @Test + public void testResolvePropertiesFiles() 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()); + + Assert.assertFalse(urls.hasMoreElements()); + } + + { + // without .properties + Enumeration<URL> urls = PropertiesFileLoader.resolvePropertiesFiles("testfile"); + Assert.assertNotNull(urls); + Assert.assertTrue(urls.hasMoreElements()); + + Properties properties = PropertiesFileLoader.load(urls.nextElement()); + Assert.assertEquals(expectedProperties.size(), properties.size()); + + Assert.assertFalse(urls.hasMoreElements()); + } + + { + // with a while which doesn't exist + Enumeration<URL> urls = PropertiesFileLoader.resolvePropertiesFiles("nonexistingfile.properties"); + Assert.assertNotNull(urls); + Assert.assertFalse(urls.hasMoreElements()); + } + + } + + @Test + public void testLoad() { + Properties properties = PropertiesFileLoader.load(Thread.currentThread().getContextClassLoader().getResource("testfile.properties")); + + Assert.assertNotNull(properties); + Assert.assertEquals(5, properties.size()); + + for (int i = 1; i < 6; i++) { + Assert.assertEquals(properties.getProperty("key" + i), "val" + i); + } + } +} http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/ff6e9f2f/java8/core/src/test/java/org/apache/tamaya/core/internal/PropetiesFileLoaderTest.java ---------------------------------------------------------------------- diff --git a/java8/core/src/test/java/org/apache/tamaya/core/internal/PropetiesFileLoaderTest.java b/java8/core/src/test/java/org/apache/tamaya/core/internal/PropetiesFileLoaderTest.java deleted file mode 100644 index a86473e..0000000 --- a/java8/core/src/test/java/org/apache/tamaya/core/internal/PropetiesFileLoaderTest.java +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tamaya.core.internal; - -import org.junit.Assert; -import org.junit.Test; - -import java.net.URL; -import java.util.Enumeration; -import java.util.Properties; - -public class PropetiesFileLoaderTest { - - - @Test - public void testResolvePropertiesFiles() 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()); - - Assert.assertFalse(urls.hasMoreElements()); - } - - { - // without .properties - Enumeration<URL> urls = PropertiesFileLoader.resolvePropertiesFiles("testfile"); - Assert.assertNotNull(urls); - Assert.assertTrue(urls.hasMoreElements()); - - Properties properties = PropertiesFileLoader.load(urls.nextElement()); - Assert.assertEquals(expectedProperties.size(), properties.size()); - - Assert.assertFalse(urls.hasMoreElements()); - } - - { - // with a while which doesn't exist - Enumeration<URL> urls = PropertiesFileLoader.resolvePropertiesFiles("nonexistingfile.properties"); - Assert.assertNotNull(urls); - Assert.assertFalse(urls.hasMoreElements()); - } - - } - - @Test - public void testLoad() { - Properties properties = PropertiesFileLoader.load(Thread.currentThread().getContextClassLoader().getResource("testfile.properties")); - - Assert.assertNotNull(properties); - Assert.assertEquals(5, properties.size()); - - for (int i = 1; i < 6; i++) { - Assert.assertEquals(properties.getProperty("key" + i), "val" + i); - } - } -}
