tamaya-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ple...@apache.org
Subject incubator-tamaya git commit: More assertions.
Date Fri, 09 Jan 2015 22:09:50 GMT
Repository: incubator-tamaya
Updated Branches:
  refs/heads/master 0870a7267 -> 2dd0c13e5


More assertions.


Project: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/commit/2dd0c13e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/tree/2dd0c13e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/diff/2dd0c13e

Branch: refs/heads/master
Commit: 2dd0c13e5de8ed73f82240da586a642b33632902
Parents: 0870a72
Author: Oliver B. Fischer <plexus@apache.org>
Authored: Fri Jan 9 23:09:39 2015 +0100
Committer: Oliver B. Fischer <plexus@apache.org>
Committed: Fri Jan 9 23:09:39 2015 +0100

----------------------------------------------------------------------
 java8/core/pom.xml                                       |  8 ++++++++
 .../tamaya/core/provider/JavaConfigurationProvider.java  |  3 ++-
 .../test/provider/JavaConfigurationProviderTest.java     | 11 +++++++++--
 3 files changed, 19 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/2dd0c13e/java8/core/pom.xml
----------------------------------------------------------------------
diff --git a/java8/core/pom.xml b/java8/core/pom.xml
index eec2b81..029b2ff 100644
--- a/java8/core/pom.xml
+++ b/java8/core/pom.xml
@@ -41,6 +41,14 @@ under the License.
             <groupId>junit</groupId>
             <artifactId>junit</artifactId>
         </dependency>
+        <dependency>
+            <groupId>org.hamcrest</groupId>
+            <artifactId>hamcrest-library</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.hamcrest</groupId>
+            <artifactId>hamcrest-core</artifactId>
+        </dependency>
     </dependencies>
 
 </project>

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/2dd0c13e/java8/core/src/main/java/org/apache/tamaya/core/provider/JavaConfigurationProvider.java
----------------------------------------------------------------------
diff --git a/java8/core/src/main/java/org/apache/tamaya/core/provider/JavaConfigurationProvider.java
b/java8/core/src/main/java/org/apache/tamaya/core/provider/JavaConfigurationProvider.java
index 0341c0e..3cca3eb 100644
--- a/java8/core/src/main/java/org/apache/tamaya/core/provider/JavaConfigurationProvider.java
+++ b/java8/core/src/main/java/org/apache/tamaya/core/provider/JavaConfigurationProvider.java
@@ -18,6 +18,7 @@
  */
 package org.apache.tamaya.core.provider;
 
+import org.apache.tamaya.ConfigException;
 import org.apache.tamaya.core.internal.PropertiesFileLoader;
 import org.apache.tamaya.core.propertysource.PropertiesFilePropertySource;
 import org.apache.tamaya.spi.PropertySource;
@@ -52,7 +53,7 @@ public class JavaConfigurationProvider implements PropertySourceProvider
{
 
 
         } catch (IOException e) {
-            throw new IllegalStateException("error loading javaconfiguration.properties",
e);
+            throw new ConfigException("Error while loading javaconfiguration.properties",
e);
         }
 
         return Collections.unmodifiableList(propertySources);

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/2dd0c13e/java8/core/src/test/java/org/apache/tamaya/core/test/provider/JavaConfigurationProviderTest.java
----------------------------------------------------------------------
diff --git a/java8/core/src/test/java/org/apache/tamaya/core/test/provider/JavaConfigurationProviderTest.java
b/java8/core/src/test/java/org/apache/tamaya/core/test/provider/JavaConfigurationProviderTest.java
index ae9dccb..bfd9fd0 100644
--- a/java8/core/src/test/java/org/apache/tamaya/core/test/provider/JavaConfigurationProviderTest.java
+++ b/java8/core/src/test/java/org/apache/tamaya/core/test/provider/JavaConfigurationProviderTest.java
@@ -26,6 +26,10 @@ import org.junit.Test;
 
 import java.util.Collection;
 
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.hasSize;
+import static org.hamcrest.Matchers.notNullValue;
+
 public class JavaConfigurationProviderTest {
 
     @Test
@@ -33,10 +37,13 @@ public class JavaConfigurationProviderTest {
 
         Collection<PropertySource> propertySources = new JavaConfigurationProvider().getPropertySources();
 
-        Assert.assertNotNull(propertySources);
-        Assert.assertEquals(1, propertySources.size());
+        assertThat(propertySources, notNullValue());
+        assertThat(propertySources, hasSize(1));
 
         PropertySource propertySource = propertySources.iterator().next();
+
+        assertThat(propertySource.getProperties().keySet(), hasSize(5));
+
         for (int i = 1; i < 6; i++) {
             String key = "confkey" + i;
             String value = "javaconf-value" + i;


Mime
View raw message