tamaya-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pottlin...@apache.org
Subject [4/4] incubator-tamaya git commit: TAMAYA-288: Additional test coverage
Date Sun, 25 Feb 2018 20:04:33 GMT
TAMAYA-288: Additional test coverage

This closes #14

Things that this PR does
* Significant increase in test coverage, especially mutation coverage
** API from 57% to 92%
** Core from 38% to 82%
** SPI-Support from ??% (mutation coverage disabled) to 86%
* Tests now succeed with OpenJDK, Hotspot, and OpenJ9.
* Generated a series of additional bug tickets. :-)

What this does not do:
* Touch any implementation code.  This is only tests.
* Reduce code duplication, especially between API/Core and SPI-Support.
* Have a great answer for OSGI testing.  It ends up being a pile of mocks.


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

Branch: refs/heads/master
Commit: 125eed2029c4d92e07e4aba1c1ac8b9576a576db
Parents: 5136203
Author: William Lieurance <william.lieurance@namikoda.com>
Authored: Sat Feb 24 23:19:18 2018 -0600
Committer: Phil Ottlinger <pottlinger@apache.org>
Committed: Sun Feb 25 21:02:22 2018 +0100

----------------------------------------------------------------------
 .gitignore                                      |   3 +-
 .../tamaya/ConfigurationProviderTest.java       | 103 +++
 .../org/apache/tamaya/ConfigurationTest.java    |  45 +-
 .../org/apache/tamaya/TestConfiguration.java    | 133 ++--
 .../tamaya/TestConfigurationProvider.java       |  29 +-
 .../java/org/apache/tamaya/TypeLiteralTest.java |  67 +-
 .../spi/ConfigurationProviderSpiTest.java       |  58 ++
 .../tamaya/spi/PropertySourceProviderTest.java  |  35 +
 .../apache/tamaya/spi/PropertySourceTest.java   |  71 ++
 .../tamaya/spi/PropertyValueBuilderTest.java    |  59 +-
 .../apache/tamaya/core/OSGIActivatorTest.java   |  81 +++
 .../internal/CoreConfigurationBuilderTest.java  |  36 +-
 .../apache/tamaya/core/internal/MockBundle.java | 225 +++++++
 .../tamaya/core/internal/MockBundleContext.java | 202 ++++++
 .../internal/OSGIServiceComparatorTest.java     | 114 ++++
 .../core/internal/OSGIServiceContextTest.java   | 129 ++++
 .../core/internal/OSGIServiceLoaderTest.java    | 114 ++++
 .../converters/BigDecimalConverterTest.java     |   6 +
 .../converters/BigIntegerConverterTest.java     | 161 +++++
 .../converters/BooleanConverterTest.java        |  36 +
 .../internal/converters/ByteConverterTest.java  |  32 +
 .../internal/converters/CharConverterTest.java  |  75 ++-
 .../internal/converters/ClassConverterTest.java |  15 +
 .../internal/converters/ConvertQueryTest.java   |  80 +++
 .../ConverterTestsPropertySource.java           |  62 +-
 .../converters/CurrencyConverterTest.java       |  60 +-
 .../converters/DoubleConverterTest.java         |  51 +-
 .../converters/DurationConverterTest.java       |  16 +
 .../internal/converters/FileConverterTest.java  |  58 ++
 .../internal/converters/FloatConverterTest.java |  51 +-
 .../converters/InstantConverterTest.java        |  16 +
 .../converters/IntegerConverterTest.java        |  26 +
 .../converters/LocalDateConverterTest.java      |  15 +
 .../converters/LocalDateTimeConverterTest.java  |  15 +
 .../converters/LocalTimeConverterTest.java      |  15 +
 .../internal/converters/LongConverterTest.java  |  26 +
 .../converters/NumberConverterTest.java         |  78 ++-
 .../converters/OffsetDateTimeConverterTest.java |  16 +
 .../converters/OffsetTimeConverterTest.java     |  18 +-
 .../converters/OptionalConverterTest.java       |  43 +-
 .../internal/converters/PathConverterTest.java  |  33 +-
 .../internal/converters/ShortConverterTest.java |  27 +
 .../converters/SupplierConverterTest.java       |  84 +++
 .../internal/converters/URIConverterTest.java   |  27 +
 .../internal/converters/URLConverterTest.java   |  25 +
 code/core/src/test/resources/mockbundle.service |  18 +
 code/spi-support/pom.xml                        |  14 -
 .../BuildablePropertySourceProviderTest.java    |  26 +-
 .../spisupport/BuildablePropertySourceTest.java |  63 +-
 .../DefaultConfigValueEvaluatorTest.java        |  61 ++
 .../DefaultConfigurationBuilderTest.java        | 302 +++++++--
 .../DefaultConfigurationContextBuilderTest.java | 675 +++++++++++++++++++
 .../DefaultConfigurationContextTest.java        |  59 ++
 .../spisupport/DefaultConfigurationTest.java    | 177 ++---
 .../tamaya/spisupport/EnumConverterTest.java    |  60 +-
 .../tamaya/spisupport/IntegerTestConverter.java |  41 ++
 .../spisupport/MockedConfigurationContext.java  |  96 +++
 .../tamaya/spisupport/MockedPropertyFilter.java |  39 ++
 .../tamaya/spisupport/MockedPropertySource.java |  83 +++
 .../PropertyConverterManagerTest.java           |  60 ++
 .../tamaya/spisupport/ReflectionUtilTest.java   |  55 ++
 .../spisupport/RegexPropertyFilterTest.java     |  15 +
 .../propertysource/BasePropertySourceTest.java  |  47 +-
 .../propertysource/CLIPropertySourceTest.java   |  84 ++-
 .../EnvironmentPropertySourceTest.java          |  93 ++-
 .../JavaConfigurationProviderTest.java          |  47 +-
 .../PropertiesResourcePropertySourceTest.java   |  82 +++
 .../SimplePropertySourceTest.java               | 109 ++-
 .../SystemPropertySourceTest.java               |  75 ++-
 .../WrappedPropertySourceTest.java              | 168 +++++
 .../org.apache.tamaya.spi.PropertyConverter     |   3 +-
 .../org.apache.tamaya.spi.PropertyFilter        |  19 +
 .../org.apache.tamaya.spi.PropertySource        |  19 +
 73 files changed, 4859 insertions(+), 402 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/125eed20/.gitignore
----------------------------------------------------------------------
diff --git a/.gitignore b/.gitignore
index 274ebae..5a53be5 100644
--- a/.gitignore
+++ b/.gitignore
@@ -20,4 +20,5 @@ modules/integration/commons-config/commons-configuration.iml
 examples/simple-propertysource/tamaya-example-simple-propertysource.iml
 **/*.checkstyle
 **/*.fbExcludeFilterFile
-
+nbproject
+nb-configuration.xml

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/125eed20/code/api/src/test/java/org/apache/tamaya/ConfigurationProviderTest.java
----------------------------------------------------------------------
diff --git a/code/api/src/test/java/org/apache/tamaya/ConfigurationProviderTest.java b/code/api/src/test/java/org/apache/tamaya/ConfigurationProviderTest.java
new file mode 100644
index 0000000..e58806e
--- /dev/null
+++ b/code/api/src/test/java/org/apache/tamaya/ConfigurationProviderTest.java
@@ -0,0 +1,103 @@
+/*
+ * 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;
+
+import org.apache.tamaya.spi.ConfigurationBuilder;
+import org.apache.tamaya.spi.ConfigurationContext;
+import org.apache.tamaya.spi.ConfigurationContextBuilder;
+import org.junit.Test;
+import static org.junit.Assert.*;
+import org.mockito.Mockito;
+
+/**
+ *
+ * Test the {@link ConfigurationProivder} class. The tests end up being tests of
+ * the default methods in the {@link ConfigurationProivder} interface as they
+ * pass through to the {@link TestConfigurationProvider} mocked object.
+ */
+public class ConfigurationProviderTest {
+
+
+    /**
+     * Test of createConfiguration method, of class ConfigurationProvider.
+     */
+    @Test
+    public void testCreateConfiguration() {
+        Configuration result = ConfigurationProvider.createConfiguration(ConfigurationProvider.getConfiguration().getContext());
+        assertNotNull(result);
+    }
+    
+    /**
+     * Test of getConfigurationContext and setConfigurationContext method, of
+     * class ConfigurationProvider.
+     */
+    @Test
+    public void testGetSetConfigurationContext() {
+        ConfigurationContext currentContext = ConfigurationProvider.getConfigurationContext();
+        assertTrue(currentContext instanceof ConfigurationContext);
+        ConfigurationContext newContext = Mockito.mock(ConfigurationContext.class);
+        try{
+            ConfigurationProvider.setConfigurationContext(newContext);
+            assertEquals(newContext, ConfigurationProvider.getConfigurationContext());
+        }finally{
+            ConfigurationProvider.setConfigurationContext(currentContext);
+        }
+        assertEquals(currentContext, ConfigurationProvider.getConfigurationContext());
+    }
+
+    /**
+     * Test of getConfiguration method, of class ConfigurationProvider.
+     */
+    @Test
+    public void testGetSetConfiguration() {
+        Configuration currentConfig = ConfigurationProvider.getConfiguration();
+        assertTrue(currentConfig instanceof Configuration);
+        Configuration newConfig = Mockito.mock(Configuration.class);
+        try{
+            ConfigurationProvider.setConfiguration(newConfig);
+            assertEquals(newConfig, ConfigurationProvider.getConfiguration());
+        }finally{
+            ConfigurationProvider.setConfiguration(currentConfig);
+        }
+        assertEquals(currentConfig, ConfigurationProvider.getConfiguration());
+    }
+
+    /**
+     * Test of getConfigurationBuilder method, of class ConfigurationProvider.
+     */
+    @Test
+    public void testGetConfigurationBuilder() {
+        ConfigurationBuilder result = ConfigurationProvider.getConfigurationBuilder();
+        assertTrue(result instanceof ConfigurationBuilder);
+    }
+
+    /**
+     * Test of getConfigurationContextBuilder method, of class ConfigurationProvider.
+     */
+    @Test
+    public void testGetConfigurationContextBuilder() {
+        ConfigurationContextBuilder result = ConfigurationProvider.getConfigurationContextBuilder();
+        assertTrue(result instanceof ConfigurationContextBuilder);
+    }
+
+    @Test
+    public void testConstructorFails(){
+        assertTrue(ConfigurationProvider.class.getConstructors().length == 0);
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/125eed20/code/api/src/test/java/org/apache/tamaya/ConfigurationTest.java
----------------------------------------------------------------------
diff --git a/code/api/src/test/java/org/apache/tamaya/ConfigurationTest.java b/code/api/src/test/java/org/apache/tamaya/ConfigurationTest.java
index ecbb75c..26e2058 100644
--- a/code/api/src/test/java/org/apache/tamaya/ConfigurationTest.java
+++ b/code/api/src/test/java/org/apache/tamaya/ConfigurationTest.java
@@ -22,8 +22,10 @@ import org.junit.Test;
 import static org.junit.Assert.*;
 
 /**
- * Test class that tests the default methods implemented on {@link org.apache.tamaya.Configuration}. The provided
- * {@link org.apache.tamaya.TestConfiguration} is implemeted with maximal use of the default methods.
+ * Test class that tests the default methods implemented on
+ * {@link org.apache.tamaya.Configuration}. The provided
+ * {@link org.apache.tamaya.TestConfiguration} is implemented with maximal use of
+ * the default methods.
  */
 public class ConfigurationTest {
 
@@ -31,11 +33,12 @@ public class ConfigurationTest {
     public void testget() throws Exception {
         assertEquals(Boolean.TRUE, ConfigurationProvider.getConfiguration().get("booleanTrue", Boolean.class));
         assertEquals(Boolean.FALSE, ConfigurationProvider.getConfiguration().get("booleanFalse", Boolean.class));
-        assertEquals((int)Byte.MAX_VALUE, (int)ConfigurationProvider.getConfiguration().get("byte", Byte.class));
-        assertEquals(Integer.MAX_VALUE, (int)ConfigurationProvider.getConfiguration().get("int", Integer.class));
-        assertEquals(Long.MAX_VALUE, (long)ConfigurationProvider.getConfiguration().get("long", Long.class));
-        assertEquals(Float.MAX_VALUE, (double)ConfigurationProvider.getConfiguration().get("float", Float.class), 0.0d);
+        assertEquals((int) Byte.MAX_VALUE, (int) ConfigurationProvider.getConfiguration().get("byte", Byte.class));
+        assertEquals(Integer.MAX_VALUE, (int) ConfigurationProvider.getConfiguration().get("int", Integer.class));
+        assertEquals(Long.MAX_VALUE, (long) ConfigurationProvider.getConfiguration().get("long", Long.class));
+        assertEquals(Float.MAX_VALUE, (double) ConfigurationProvider.getConfiguration().get("float", Float.class), 0.0d);
         assertEquals(Double.MAX_VALUE, ConfigurationProvider.getConfiguration().get("double", Double.class), 0.0d);
+        assertEquals("aStringValue", ConfigurationProvider.getConfiguration().get("String"));
     }
 
     @Test
@@ -47,17 +50,39 @@ public class ConfigurationTest {
 
     @Test
     public void testGetInteger() throws Exception {
-        assertEquals(Integer.MAX_VALUE,(int) ConfigurationProvider.getConfiguration().get("int", Integer.class));
+        assertEquals(Integer.MAX_VALUE, (int) ConfigurationProvider.getConfiguration().get("int", Integer.class));
     }
 
     @Test
     public void testGetLong() throws Exception {
-        assertEquals(Long.MAX_VALUE,(long) ConfigurationProvider.getConfiguration().get("long", Long.class));
+        assertEquals(Long.MAX_VALUE, (long) ConfigurationProvider.getConfiguration().get("long", Long.class));
     }
 
     @Test
     public void testGetDouble() throws Exception {
-        assertEquals(Double.MAX_VALUE,ConfigurationProvider.getConfiguration().get("double", Double.class), 0.0d);
+        assertEquals(Double.MAX_VALUE, ConfigurationProvider.getConfiguration().get("double", Double.class), 0.0d);
     }
 
-}
\ No newline at end of file
+    @Test
+    public void testGetOrDefault() throws Exception {
+        assertEquals("StringIfThereWasNotAValueThere", ConfigurationProvider.getConfiguration().getOrDefault("nonexistant", "StringIfThereWasNotAValueThere"));
+        assertEquals("StringIfThereWasNotAValueThere", ConfigurationProvider.getConfiguration().getOrDefault("nonexistant", String.class, "StringIfThereWasNotAValueThere"));
+    }
+
+    @Test
+    public void testToBuilder() throws Exception {
+        assertNotNull(ConfigurationProvider.getConfiguration().toBuilder());
+    }
+    
+    @Test
+    public void testWith() throws Exception {
+        ConfigOperator noop = (Configuration config) -> config;
+        assertNotNull(ConfigurationProvider.getConfiguration().with(noop));
+    }
+    
+    @Test
+    public void testQuery() throws Exception {
+        ConfigQuery<String> stringQuery = (ConfigQuery) (Configuration config) -> config.get("String");
+        assertEquals("aStringValue", ConfigurationProvider.getConfiguration().query(stringQuery));
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/125eed20/code/api/src/test/java/org/apache/tamaya/TestConfiguration.java
----------------------------------------------------------------------
diff --git a/code/api/src/test/java/org/apache/tamaya/TestConfiguration.java b/code/api/src/test/java/org/apache/tamaya/TestConfiguration.java
index f50c1dc..dd85a8d 100644
--- a/code/api/src/test/java/org/apache/tamaya/TestConfiguration.java
+++ b/code/api/src/test/java/org/apache/tamaya/TestConfiguration.java
@@ -18,120 +18,97 @@
  */
 package org.apache.tamaya;
 
-
 import org.apache.tamaya.spi.ConfigurationContext;
 
 import java.util.HashMap;
 import java.util.Map;
+import java.util.stream.Collectors;
+import org.mockito.Mockito;
 
 /**
- * Test Configuration class, that is used to testdata the default methods provided by the API.
+ * Test Configuration class, that is used to testdata the default methods
+ * provided by the API.
  */
-public class TestConfiguration implements Configuration{
+public class TestConfiguration implements Configuration {
+
+    private static final Map<String, Object> VALUES;
 
-    private static final Map<String, String> VALUES;
     static {
         VALUES = new HashMap<>();
-        VALUES.put("long", String.valueOf(Long.MAX_VALUE));
-        VALUES.put("int", String.valueOf(Integer.MAX_VALUE));
-        VALUES.put("double", String.valueOf(Double.MAX_VALUE));
-        VALUES.put("float", String.valueOf(Float.MAX_VALUE));
-        VALUES.put("short", String.valueOf(Short.MAX_VALUE));
-        VALUES.put("byte", String.valueOf(Byte.MAX_VALUE));
-        VALUES.put("booleanTrue", "true");
-        VALUES.put("booleanFalse", "false");
+        VALUES.put("long", Long.MAX_VALUE);
+        VALUES.put("int", Integer.MAX_VALUE);
+        VALUES.put("double", Double.MAX_VALUE);
+        VALUES.put("float", Float.MAX_VALUE);
+        VALUES.put("short", Short.MAX_VALUE);
+        VALUES.put("byte", Byte.MAX_VALUE);
         VALUES.put("String", "aStringValue");
     }
 
-    @Override
-    public String get(String key) {
-        return VALUES.get(key);
-    }
-
-    @Override
-    public String getOrDefault(String key, String defaultValue) {
-        String val = get(key);
-        if(val==null){
-            return defaultValue;
-        }
-        return val;
-    }
-
-    @Override
-    public <T> T getOrDefault(String key, Class<T> type, T defaultValue) {
-        T val = get(key, type);
-        if(val==null){
-            return defaultValue;
-        }
-        return val;
-    }
-
     @SuppressWarnings("unchecked")
-	@Override
-    public <T> T get(String key, Class<T> type) {
-        if(type.equals(Long.class)){
-            return (T)(Object)Long.MAX_VALUE;
-        }
-        else if(type.equals(Integer.class)){
-            return (T)(Object) Integer.MAX_VALUE;
-        }
-        else if(type.equals(Double.class)){
-            return (T)(Object) Double.MAX_VALUE;
-        }
-        else if(type.equals(Float.class)){
-            return (T)(Object) Float.MAX_VALUE;
-        }
-        else if(type.equals(Short.class)){
-            return (T)(Object) Short.MAX_VALUE;
-        }
-        else if(type.equals(Byte.class)){
-            return (T)(Object) Byte.MAX_VALUE;
-        }
-        else if(type.equals(Boolean.class)){
-            if("booleanTrue".equals(key)) {
-                return (T)Boolean.TRUE;
-            }
-            else{
-                return (T)Boolean.FALSE;
+    @Override
+    public <T> T get(String key, TypeLiteral<T> type) {
+        if (type.getRawType().equals(Long.class)) {
+            return (T) VALUES.get(key);
+        } else if (type.getRawType().equals(Integer.class)) {
+            return (T) VALUES.get(key);
+        } else if (type.getRawType().equals(Double.class)) {
+            return (T) VALUES.get(key);
+        } else if (type.getRawType().equals(Float.class)) {
+            return (T) VALUES.get(key);
+        } else if (type.getRawType().equals(Short.class)) {
+            return (T) VALUES.get(key);
+        } else if (type.getRawType().equals(Byte.class)) {
+            return (T) VALUES.get(key);
+        } else if (type.getRawType().equals(Boolean.class)) {
+            if ("booleanTrue".equals(key)) {
+                return (T) Boolean.TRUE;
+            } else {
+                return (T) Boolean.FALSE;
             }
-        }
-        else if(type.equals(String.class)){
-            return (T)"aStringValue";
+        } else if (type.getRawType().equals(String.class)) {
+            return (T) VALUES.get(key);
         }
         throw new ConfigException("No such property: " + key);
     }
 
     @Override
-    public <T> T get(String key, TypeLiteral<T> type) {
-        throw new RuntimeException("Method not implemented yet.");
-    }
-
-    @Override
     public <T> T getOrDefault(String key, TypeLiteral<T> type, T defaultValue) {
         T val = get(key, type);
-        if(val==null){
+        if (val == null) {
             return defaultValue;
         }
         return val;
     }
 
     @Override
-    public Configuration with(ConfigOperator operator) {
-        return null;
+    public ConfigurationContext getContext() {
+        return Mockito.mock(ConfigurationContext.class);
     }
 
     @Override
-    public <T> T query(ConfigQuery<T> query) {
-        throw new RuntimeException("Method not implemented yet.");
+    public Map<String, String> getProperties() {
+        // run toString on each value of the (key, value) set in VALUES
+        return VALUES.entrySet().stream().collect(
+                Collectors.toMap(
+                        Map.Entry::getKey,
+                        e -> e.getValue().toString()));
     }
 
     @Override
-    public ConfigurationContext getContext() {
-        return null;
+    public boolean equals(Object o) {
+        if (this == o) {
+            return true;
+        }
+        if (!(o instanceof TestConfiguration)) {
+            return false;
+        }
+        TestConfiguration that = (TestConfiguration) o;
+        return that.getProperties().equals(this.getProperties());
     }
 
     @Override
-    public Map<String, String> getProperties() {
-        throw new RuntimeException("Method not implemented yet.");
+    public int hashCode() {
+        return VALUES.hashCode();
     }
+
 }

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/125eed20/code/api/src/test/java/org/apache/tamaya/TestConfigurationProvider.java
----------------------------------------------------------------------
diff --git a/code/api/src/test/java/org/apache/tamaya/TestConfigurationProvider.java b/code/api/src/test/java/org/apache/tamaya/TestConfigurationProvider.java
index 1ccce31..2136129 100644
--- a/code/api/src/test/java/org/apache/tamaya/TestConfigurationProvider.java
+++ b/code/api/src/test/java/org/apache/tamaya/TestConfigurationProvider.java
@@ -24,14 +24,17 @@ import org.apache.tamaya.spi.ConfigurationContext;
 import org.apache.tamaya.spi.ConfigurationBuilder;
 import org.apache.tamaya.spi.ConfigurationContextBuilder;
 import org.apache.tamaya.spi.ConfigurationProviderSpi;
+import org.mockito.Mockito;
 
 /**
- * Test Configuration class, that is used to testdata the default methods provided by the API.
+ * Test Configuration class, that is used to testdata the default methods
+ * provided by the API.
  */
 @Priority(-1)
 public class TestConfigurationProvider implements ConfigurationProviderSpi {
 
-    private static final Configuration config = new TestConfiguration();
+    private Configuration config = new TestConfiguration();
+    private ConfigurationContext context = Mockito.mock(ConfigurationContext.class);
 
     @Override
     public Configuration getConfiguration() {
@@ -45,35 +48,31 @@ public class TestConfigurationProvider implements ConfigurationProviderSpi {
 
     @Override
     public ConfigurationContext getConfigurationContext() {
-        return config.getContext();
+        return context;
+    }
+    
+    public ConfigurationContext getConfigurationContextFromInterface(){
+        return ConfigurationProviderSpi.super.getConfigurationContext();
     }
 
     @Override
     public void setConfigurationContext(ConfigurationContext context) {
-        throw new UnsupportedOperationException();
+        this.context = context;
     }
 
-    @Override
-    public boolean isConfigurationContextSettable() {
-        return false;
-    }
 
     @Override
     public ConfigurationBuilder getConfigurationBuilder() {
-        return null;
+        return Mockito.mock(ConfigurationBuilder.class, Mockito.RETURNS_DEEP_STUBS);
     }
 
     @Override
     public ConfigurationContextBuilder getConfigurationContextBuilder() {
-        return null;
+        return Mockito.mock(ConfigurationContextBuilder.class);
     }
 
     @Override
     public void setConfiguration(Configuration config) {
-    }
-
-    @Override
-    public boolean isConfigurationSettable() {
-        return false;
+        this.config = config;
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/125eed20/code/api/src/test/java/org/apache/tamaya/TypeLiteralTest.java
----------------------------------------------------------------------
diff --git a/code/api/src/test/java/org/apache/tamaya/TypeLiteralTest.java b/code/api/src/test/java/org/apache/tamaya/TypeLiteralTest.java
index 7435e08..65fe706 100644
--- a/code/api/src/test/java/org/apache/tamaya/TypeLiteralTest.java
+++ b/code/api/src/test/java/org/apache/tamaya/TypeLiteralTest.java
@@ -18,6 +18,7 @@
  */
 package org.apache.tamaya;
 
+import java.lang.reflect.Type;
 import static org.apache.tamaya.TypeLiteral.getGenericInterfaceTypeParameters;
 import static org.apache.tamaya.TypeLiteral.getTypeParameters;
 import static org.junit.Assert.assertEquals;
@@ -25,8 +26,10 @@ import static org.junit.Assert.assertEquals;
 import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.List;
+import java.util.Map;
 
 import org.junit.Test;
+import static org.junit.Assert.*;
 
 /**
  * Tests for the {@link TypeLiteral} class.
@@ -34,21 +37,21 @@ import org.junit.Test;
 @SuppressWarnings("serial")
 public class TypeLiteralTest {
 
-	@Test(expected = NullPointerException.class)
+    @Test(expected = NullPointerException.class)
     public void constructorRequiresNonNullParameter() {
-       new TypeLiteral<List<String>>(null){};
+        new TypeLiteral<List<String>>(null) { };
     }
 
     @Test
-    public void test_constrcutor(){
-        TypeLiteral<List<String>> listTypeLiteral = new TypeLiteral<List<String>>(){};
+    public void test_constructor() {
+        TypeLiteral<List<String>> listTypeLiteral = new TypeLiteral<List<String>>() { };
         assertEquals(List.class, listTypeLiteral.getRawType());
         assertEquals(String.class, TypeLiteral.getTypeParameters(listTypeLiteral.getType())[0]);
     }
 
     @Test
-    public void test_of(){
-        class MyListClass extends ArrayList<String>{}
+    public void test_of() {
+        class MyListClass extends ArrayList<String> { }
         TypeLiteral<MyListClass> listTypeLiteral = TypeLiteral.of(MyListClass.class);
         assertEquals(MyListClass.class, listTypeLiteral.getRawType());
         assertEquals(MyListClass.class, listTypeLiteral.getType());
@@ -60,18 +63,28 @@ public class TypeLiteralTest {
     }
 
     @Test
-    public void test_getTypeParameter(){
-        TypeLiteral<List<String>> listTypeLiteral = new TypeLiteral<List<String>>(){};
+    public void test_getTypeParameters() {
+        TypeLiteral<List<String>> listTypeLiteral = new TypeLiteral<List<String>>() { };
         assertEquals(List.class, listTypeLiteral.getRawType());
         assertEquals(String.class, TypeLiteral.getTypeParameters(listTypeLiteral.getType())[0]);
     }
 
     @Test
-    public void test_getGenericInterfaceTypeParameter(){
-        class MyListClass extends ArrayList<String> implements List<String>{}
+    public void testGetTypeParametersNoGenerics() {
+        assertEquals(0, getTypeParameters(String.class).length);
+    }
+
+    @Test
+    public void test_getGenericInterfaceTypeParameter() {
+        class MyListClass extends ArrayList<String> implements List<String> { }
         assertEquals(String.class, getGenericInterfaceTypeParameters(MyListClass.class, List.class)[0]);
     }
 
+    @Test
+    public void testGetGenericInterfaceTypeParameterNoGenerics() {
+        assertEquals(0, getGenericInterfaceTypeParameters(String.class, String.class).length);
+    }
+
     @Test(expected = NullPointerException.class)
     public void getGenericInterfaceTypeParametersRequiredNonNullValueForClassParameter() {
         getGenericInterfaceTypeParameters(null, Iterator.class);
@@ -87,4 +100,38 @@ public class TypeLiteralTest {
         getTypeParameters(null);
     }
 
+    @Test
+    public void testTypeTakingParametersMustBeSubclassOfParameterizedType() {
+        //Reflection on ArrayList<String> gives a ParameterizedType
+        class A extends ArrayList<String> { };
+        class B extends A { };
+        TypeLiteral<List<String>> checker = new TypeLiteral<List<String>>() { };
+        Type t = checker.getDefinedType(B.class);
+        assertEquals(t.getTypeName(), "java.lang.String");
+    }
+
+    @Test(expected = RuntimeException.class)
+    public void testTypeTakingParametersMustNotBeSubclassOfObject() {
+        //Create a class hierarchy where B is a subclass of Object and not
+        // ParameterizedType, but still takes parameters.
+        class A<T> { };
+        class B extends A { };
+        TypeLiteral<List<String>> checker = new TypeLiteral<List<String>>() { };
+        checker.getDefinedType(B.class);
+    }
+    
+    @Test
+    public void testHashAndEquals(){
+        TypeLiteral a = TypeLiteral.of(List.class);
+        TypeLiteral b = TypeLiteral.of(List.class);
+        TypeLiteral c = TypeLiteral.of(Map.class);
+        assertEquals(a.hashCode(), b.hashCode());
+        assertNotEquals(a.hashCode(), c.hashCode());
+        assertTrue(a.equals(a));
+        assertTrue(a.equals(b));
+        assertFalse(a.equals(null));
+        assertFalse(a.equals("SomeString"));
+        assertFalse(a.equals(c));
+    }
+
 }

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/125eed20/code/api/src/test/java/org/apache/tamaya/spi/ConfigurationProviderSpiTest.java
----------------------------------------------------------------------
diff --git a/code/api/src/test/java/org/apache/tamaya/spi/ConfigurationProviderSpiTest.java b/code/api/src/test/java/org/apache/tamaya/spi/ConfigurationProviderSpiTest.java
new file mode 100644
index 0000000..2e1a836
--- /dev/null
+++ b/code/api/src/test/java/org/apache/tamaya/spi/ConfigurationProviderSpiTest.java
@@ -0,0 +1,58 @@
+/*
+ * 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.spi;
+
+import org.apache.tamaya.TestConfigurationProvider;
+import org.junit.Test;
+import static org.junit.Assert.*;
+import org.mockito.Mockito;
+
+public class ConfigurationProviderSpiTest {
+    
+TestConfigurationProvider configProvider = new TestConfigurationProvider();
+
+    @Test
+    public void testIsConfigurationSettableByDefault(){
+        assertTrue(configProvider.isConfigurationSettable());
+    }
+    
+    @Test
+    public void testIsConfigurationContextSettable(){
+        assertTrue(configProvider.isConfigurationContextSettable());
+    }    
+    
+    /**
+     * Test of getConfigurationContext and setConfigurationContext method, of
+     * class ConfigurationProviderSpi.
+     */
+    @Test
+    public void testGetSetConfigurationContext() {
+        ConfigurationContext currentContext = configProvider.getConfigurationContextFromInterface();
+        assertTrue(currentContext instanceof ConfigurationContext);
+        ConfigurationContext newContext = Mockito.mock(ConfigurationContext.class);
+        try{
+            configProvider.setConfigurationContext(newContext);
+            //The mocked TestConfigurationProvider doesn't set the context on the
+            // inner Configuration object, as that's deprecated.
+            assertEquals(newContext, configProvider.getConfigurationContext());
+        }finally{
+            configProvider.setConfigurationContext(currentContext);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/125eed20/code/api/src/test/java/org/apache/tamaya/spi/PropertySourceProviderTest.java
----------------------------------------------------------------------
diff --git a/code/api/src/test/java/org/apache/tamaya/spi/PropertySourceProviderTest.java b/code/api/src/test/java/org/apache/tamaya/spi/PropertySourceProviderTest.java
new file mode 100644
index 0000000..0e8bcfb
--- /dev/null
+++ b/code/api/src/test/java/org/apache/tamaya/spi/PropertySourceProviderTest.java
@@ -0,0 +1,35 @@
+/*
+ * 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.spi;
+
+import org.junit.Test;
+import static org.junit.Assert.*;
+
+public class PropertySourceProviderTest {
+    
+    /**
+     * Test of EMPTY instance of PropertySourceProvider
+     */
+    @Test
+    public void testEmptySourceProvider() {
+        PropertySourceProvider instance = PropertySourceProvider.EMPTY;
+        assertTrue(instance.getPropertySources().isEmpty());
+        assertEquals("PropertySourceProvider(empty)", instance.toString());
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/125eed20/code/api/src/test/java/org/apache/tamaya/spi/PropertySourceTest.java
----------------------------------------------------------------------
diff --git a/code/api/src/test/java/org/apache/tamaya/spi/PropertySourceTest.java b/code/api/src/test/java/org/apache/tamaya/spi/PropertySourceTest.java
new file mode 100644
index 0000000..3b7c0ff
--- /dev/null
+++ b/code/api/src/test/java/org/apache/tamaya/spi/PropertySourceTest.java
@@ -0,0 +1,71 @@
+/*
+ * 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.spi;
+
+import java.util.Map;
+import org.junit.Test;
+import static org.junit.Assert.*;
+
+public class PropertySourceTest {
+
+
+    /**
+     * Test of EMPTY instance of PropertySource
+     */
+    @Test
+    public void testEmptySource() {
+        PropertySource instance = PropertySource.EMPTY;
+        assertEquals(Integer.MIN_VALUE, instance.getOrdinal());
+        assertEquals("<empty>", instance.getName());
+        assertNull(instance.get("key"));
+        assertTrue(instance.getProperties().isEmpty());
+        assertFalse(instance.isScannable());
+        assertEquals("PropertySource.EMPTY", instance.toString());
+        
+    }
+
+    /**
+     * Test of default isScannable method, of class PropertySource.
+     */
+    @Test
+    public void testIsScannableByDefault() {
+        PropertySource instance = new PropertySourceImpl();
+        assertEquals(true, instance.isScannable());
+    }
+
+    public class PropertySourceImpl implements PropertySource {
+
+        public int getOrdinal() {
+            return 0;
+        }
+
+        public String getName() {
+            return "";
+        }
+
+        public PropertyValue get(String key) {
+            return null;
+        }
+
+        public Map<String, PropertyValue> getProperties() {
+            return null;
+        }
+    }
+    
+}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/125eed20/code/api/src/test/java/org/apache/tamaya/spi/PropertyValueBuilderTest.java
----------------------------------------------------------------------
diff --git a/code/api/src/test/java/org/apache/tamaya/spi/PropertyValueBuilderTest.java b/code/api/src/test/java/org/apache/tamaya/spi/PropertyValueBuilderTest.java
index cd187db..8f983bc 100644
--- a/code/api/src/test/java/org/apache/tamaya/spi/PropertyValueBuilderTest.java
+++ b/code/api/src/test/java/org/apache/tamaya/spi/PropertyValueBuilderTest.java
@@ -18,9 +18,7 @@
  */
 package org.apache.tamaya.spi;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
+import static org.junit.Assert.*;
 
 import java.util.HashMap;
 import java.util.Map;
@@ -89,7 +87,7 @@ public class PropertyValueBuilderTest {
     public void setKeyRequiresNonNullParameterForValue() {
         new PropertyValueBuilder("a", "b", "s").setValue(null);
     }
-
+    
     /*
      * Tests für addMetaEntries(Map)
      */
@@ -124,21 +122,26 @@ public class PropertyValueBuilderTest {
         PropertyValueBuilder b = new PropertyValueBuilder("k", "testKey").setValue("v");
         PropertyValue val = b.build();
         assertEquals(val.getKey(),"k");
+        assertEquals(val.getValue(),"v");
+        assertNull(val.getMetaEntries().get("k"));
     }
-
+    
     @Test
-    public void testSource() throws Exception {
-        PropertyValueBuilder b = new PropertyValueBuilder("k", "testSource").setValue("v");
+    public void testSetKey() {
+        PropertyValueBuilder b = new PropertyValueBuilder("k", "testSetKey").setKey("key");
         PropertyValue val = b.build();
-        assertEquals(val.getSource(),"testSource");
+        assertEquals(val.getKey(),"key");
     }
 
     @Test
-    public void testValue() throws Exception {
-        PropertyValueBuilder b = new PropertyValueBuilder("k", "testValue").setValue("v");
+    public void testSource() throws Exception {
+        PropertyValueBuilder b = new PropertyValueBuilder("k", "testSource").setValue("v");
         PropertyValue val = b.build();
-        assertEquals(val.getValue(),"v");
-        assertNull(val.getMetaEntries().get("k"));
+        assertEquals(val.getSource(),"testSource");
+        
+        PropertyValueBuilder b2 = b.setSource("differentSource");
+        val = b2.build();
+        assertEquals(val.getSource(),"differentSource");
     }
 
     @Test(expected=NullPointerException.class)
@@ -157,8 +160,9 @@ public class PropertyValueBuilderTest {
                 .setMetaEntries(meta).build();
         assertEquals("v", pv.getValue());
         assertEquals("k", pv.getKey());
-        assertNull("v2", pv.getMetaEntry("k"));
+        assertNull(pv.getMetaEntry("k"));
         assertEquals("testGetKey", pv.getSource());
+        assertEquals(2, pv.getMetaEntries().size());
         assertEquals("2", pv.getMetaEntry("1"));
         assertEquals("b", pv.getMetaEntry("a"));
     }
@@ -207,9 +211,11 @@ public class PropertyValueBuilderTest {
         Map<String,String> meta = new HashMap<>();
         meta.put("1","2");
         meta.put("a", "b");
-        PropertyValue pv = PropertyValue.builder("k", "testGetKey")
+        PropertyValueBuilder b = PropertyValue.builder("k", "testGetKey")
                 .setValue("v")
-                .setMetaEntries(meta).build();
+                .setMetaEntries(meta);
+        PropertyValue pv = b.build();
+        assertEquals(meta, b.getMetaEntries());
         assertEquals(meta, pv.getMetaEntries());
     }
 
@@ -242,5 +248,28 @@ public class PropertyValueBuilderTest {
         assertNotNull(contextData.getMetaEntry("ts"));
         assertEquals(contextData.getMetaEntry("y"), "y2");
     }
+    
+    @Test
+    public void testMapKey() {
+        PropertyValueBuilder b = new PropertyValueBuilder("key", "testMapKey")
+                .setValue("value")
+                .addMetaEntry("_keyAndThenSome", "mappedvalue")
+                .addMetaEntry("somethingelse", "othervalue")
+                .mapKey("mappedkey");
+        PropertyValue pv = b.build();     
+        assertEquals("mappedkey", pv.getKey());
+        assertEquals("value", pv.getValue());
+        assertEquals(2, pv.getMetaEntries().size());
+        assertEquals("mappedvalue", pv.getMetaEntry("_mappedkey.AndThenSome"));
+        assertEquals("othervalue", pv.getMetaEntry("somethingelse"));
+    }
+    
+    @Test
+    public void testToString(){
+        PropertyValueBuilder b = new PropertyValueBuilder("k")
+                .setValue("v")
+                .addMetaEntry("metak", "metav");
+        assertEquals("PropertyValueBuilder{key='k'value='v', metaEntries={metak=metav}}", b.toString());
+    }
 
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/125eed20/code/core/src/test/java/org/apache/tamaya/core/OSGIActivatorTest.java
----------------------------------------------------------------------
diff --git a/code/core/src/test/java/org/apache/tamaya/core/OSGIActivatorTest.java b/code/core/src/test/java/org/apache/tamaya/core/OSGIActivatorTest.java
new file mode 100644
index 0000000..1d59c68
--- /dev/null
+++ b/code/core/src/test/java/org/apache/tamaya/core/OSGIActivatorTest.java
@@ -0,0 +1,81 @@
+/*
+ * 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;
+
+import org.apache.tamaya.Configuration;
+import org.apache.tamaya.ConfigurationProvider;
+import org.apache.tamaya.core.internal.MockBundle;
+import org.apache.tamaya.core.internal.MockBundleContext;
+import org.apache.tamaya.spi.ServiceContext;
+import org.apache.tamaya.spi.ServiceContextManager;
+import org.junit.After;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotSame;
+import org.junit.Before;
+import org.junit.Test;
+import org.osgi.framework.Bundle;
+
+/**
+ *
+ * @author William.Lieurance 2018-02-05
+ */
+public class OSGIActivatorTest {
+
+    ServiceContext prevServiceContext;
+    Configuration prevConfiguration;
+
+    @Before
+    public void setUp() throws Exception {
+        prevServiceContext = ServiceContextManager.getServiceContext();
+        prevConfiguration = ConfigurationProvider.getConfiguration();
+    }
+
+    @After
+    public void tearDown() throws Exception {
+        ServiceContextManager.set(prevServiceContext);
+        ConfigurationProvider.setConfiguration(prevConfiguration);
+    }
+
+    /**
+     * Test of start and stop methods, of class OSGIActivator.
+     */
+    @Test
+    public void testStartThenStop() {
+        //Set up the mock
+        MockBundleContext mockBundleContext = new MockBundleContext();
+        MockBundle startedBundle = new MockBundle();
+        startedBundle.setState(Bundle.ACTIVE);
+        startedBundle.setBundleId(1);
+        startedBundle.setBundleContext(mockBundleContext);
+        mockBundleContext.installBundle(startedBundle);
+        OSGIActivator instance = new OSGIActivator();
+
+        //Start
+        instance.start(mockBundleContext);
+        assertEquals(1, mockBundleContext.getBundleListenersCount());
+        assertFalse(ConfigurationProvider.getConfiguration().getContext().getPropertyConverters().isEmpty());
+        assertNotSame(prevConfiguration, ConfigurationProvider.getConfiguration());
+
+        //Stop
+        instance.stop(mockBundleContext);
+        assertEquals(0, mockBundleContext.getBundleListenersCount());
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/125eed20/code/core/src/test/java/org/apache/tamaya/core/internal/CoreConfigurationBuilderTest.java
----------------------------------------------------------------------
diff --git a/code/core/src/test/java/org/apache/tamaya/core/internal/CoreConfigurationBuilderTest.java b/code/core/src/test/java/org/apache/tamaya/core/internal/CoreConfigurationBuilderTest.java
index 37dc2cb..2e9fcd0 100644
--- a/code/core/src/test/java/org/apache/tamaya/core/internal/CoreConfigurationBuilderTest.java
+++ b/code/core/src/test/java/org/apache/tamaya/core/internal/CoreConfigurationBuilderTest.java
@@ -18,6 +18,13 @@
  */
 package org.apache.tamaya.core.internal;
 
+import java.io.File;
+import java.math.BigDecimal;
+import java.math.BigInteger;
+import java.net.URI;
+import java.net.URL;
+import java.nio.file.Path;
+import java.util.Collection;
 import org.apache.tamaya.Configuration;
 import org.apache.tamaya.ConfigurationProvider;
 import org.apache.tamaya.TypeLiteral;
@@ -25,7 +32,9 @@ import org.apache.tamaya.spi.*;
 import org.junit.Test;
 
 import java.util.Collections;
+import java.util.Currency;
 import java.util.Map;
+import org.apache.tamaya.core.internal.converters.BigDecimalConverter;
 
 import static org.junit.Assert.*;
 
@@ -52,6 +61,7 @@ public class CoreConfigurationBuilderTest {
         assertEquals(cfg, b.build());
     }
 
+    
     @Test
     public void addPropertySources_Array() throws Exception {
         PropertySource testPS2 = new TestPropertySource("addPropertySources_Array_2");
@@ -173,10 +183,34 @@ public class CoreConfigurationBuilderTest {
     }
 
     @Test
-    public void bla() throws Exception {
+    public void addDefaultPropertyConverters() throws Exception {
         ConfigurationBuilder builder = ConfigurationProvider.getConfigurationBuilder();
         builder.addDefaultPropertyConverters();
     }
+    
+    @Test
+    public void addCorePropertyConverters() throws Exception {
+        CoreConfigurationBuilder b = new CoreConfigurationBuilder();
+        b.addCorePropertyConverters();
+        Map<TypeLiteral<?>, Collection<PropertyConverter<?>>> converters = b.getPropertyConverter();
+        assertTrue(converters.containsKey(TypeLiteral.<BigDecimal>of(BigDecimal.class)));
+        assertTrue(converters.containsKey(TypeLiteral.<BigInteger>of(BigInteger.class)));
+        assertTrue(converters.containsKey(TypeLiteral.<Boolean>of(Boolean.class)));
+        assertTrue(converters.containsKey(TypeLiteral.<Byte>of(Byte.class)));
+        assertTrue(converters.containsKey(TypeLiteral.<Character>of(Character.class)));
+        assertTrue(converters.containsKey(TypeLiteral.<Class<?>>of(Class.class)));
+        assertTrue(converters.containsKey(TypeLiteral.<Currency>of(Currency.class)));
+        assertTrue(converters.containsKey(TypeLiteral.<Double>of(Double.class)));
+        assertTrue(converters.containsKey(TypeLiteral.<File>of(File.class)));
+        assertTrue(converters.containsKey(TypeLiteral.<Float>of(Float.class)));
+        assertTrue(converters.containsKey(TypeLiteral.<Integer>of(Integer.class)));
+        assertTrue(converters.containsKey(TypeLiteral.<Long>of(Long.class)));
+        assertTrue(converters.containsKey(TypeLiteral.<Number>of(Number.class)));
+        assertTrue(converters.containsKey(TypeLiteral.<Path>of(Path.class)));
+        assertTrue(converters.containsKey(TypeLiteral.<Short>of(Short.class)));
+        assertTrue(converters.containsKey(TypeLiteral.<URI>of(URI.class)));
+        assertTrue(converters.containsKey(TypeLiteral.<URL>of(URL.class)));
+    }
 
     private static class TestPropertySource implements PropertySource{
 

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/125eed20/code/core/src/test/java/org/apache/tamaya/core/internal/MockBundle.java
----------------------------------------------------------------------
diff --git a/code/core/src/test/java/org/apache/tamaya/core/internal/MockBundle.java b/code/core/src/test/java/org/apache/tamaya/core/internal/MockBundle.java
new file mode 100644
index 0000000..415a323
--- /dev/null
+++ b/code/core/src/test/java/org/apache/tamaya/core/internal/MockBundle.java
@@ -0,0 +1,225 @@
+/*
+ * 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 java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.security.cert.X509Certificate;
+import java.util.Dictionary;
+import java.util.Enumeration;
+import java.util.Hashtable;
+import java.util.List;
+import java.util.Map;
+import java.util.Vector;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.BundleException;
+import org.osgi.framework.ServiceReference;
+import org.osgi.framework.Version;
+
+/**
+ *
+ * @author William.Lieurance 2018-02-05
+ */
+public class MockBundle implements Bundle {
+
+    private int state = Bundle.ACTIVE;
+
+    @Override
+    public int getState() {
+        return state;
+    }
+
+    public void setState(int state) {
+        this.state = state;
+    }
+
+    @Override
+    public void start(int i) throws BundleException {
+        throw new UnsupportedOperationException("Not supported (MockBundle)");
+    }
+
+    @Override
+    public void start() throws BundleException {
+        throw new UnsupportedOperationException("Not supported (MockBundle)");
+    }
+
+    @Override
+    public void stop(int i) throws BundleException {
+        throw new UnsupportedOperationException("Not supported (MockBundle)");
+    }
+
+    @Override
+    public void stop() throws BundleException {
+        throw new UnsupportedOperationException("Not supported (MockBundle)");
+    }
+
+    @Override
+    public void update(InputStream in) throws BundleException {
+        throw new UnsupportedOperationException("Not supported (MockBundle)");
+    }
+
+    @Override
+    public void update() throws BundleException {
+        throw new UnsupportedOperationException("Not supported (MockBundle)");
+    }
+
+    @Override
+    public void uninstall() throws BundleException {
+        throw new UnsupportedOperationException("Not supported (MockBundle)");
+    }
+
+    @Override
+    public Dictionary<String, String> getHeaders() {
+        return new Hashtable<>();
+    }
+
+    private long bundleId = 1L;
+
+    @Override
+    public long getBundleId() {
+        return bundleId;
+    }
+
+    public void setBundleId(long bundleId) {
+        this.bundleId = bundleId;
+    }
+
+    @Override
+    public String getLocation() {
+        throw new UnsupportedOperationException("Not supported (MockBundle)");
+    }
+
+    @Override
+    public ServiceReference<?>[] getRegisteredServices() {
+        throw new UnsupportedOperationException("Not supported (MockBundle)");
+    }
+
+    @Override
+    public ServiceReference<?>[] getServicesInUse() {
+        throw new UnsupportedOperationException("Not supported (MockBundle)");
+    }
+
+    @Override
+    public boolean hasPermission(Object o) {
+        throw new UnsupportedOperationException("Not supported (MockBundle)");
+    }
+
+    @Override
+    public URL getResource(String string) {
+        throw new UnsupportedOperationException("Not supported (MockBundle)");
+    }
+
+    @Override
+    public Dictionary<String, String> getHeaders(String string) {
+        return new Hashtable<>();
+    }
+
+    @Override
+    public String getSymbolicName() {
+        return "MockBundle";
+    }
+
+    @Override
+    public Class<?> loadClass(String string) throws ClassNotFoundException {
+        if (string.contains("org.something.else") || string.endsWith("/")) {
+            throw new UnsupportedOperationException("Requested class that should not be requested: " + string);
+        }
+        return String.class;
+    }
+
+    @Override
+    public Enumeration<URL> getResources(String string) throws IOException {
+        throw new UnsupportedOperationException("Not supported (MockBundle)");
+    }
+
+    @Override
+    public Enumeration<String> getEntryPaths(String string) {
+        Vector<String> v = new Vector<>();
+        v.add("META-INF/services/" + "someslash/");
+        v.add("META-INF/services/" + "org.apache.tamaya");
+        v.add("META-INF/services/" + "org.something.else");
+        return v.elements();
+    }
+
+    @Override
+    public URL getEntry(String string) {
+        if (string.equals("META-INF/services/")) {
+            try {
+                return new URL("file:///");
+            } catch (MalformedURLException ex) {
+                return null;
+            }
+        }
+        if (string.contains("org.something.else") || string.endsWith("/")) {
+            throw new UnsupportedOperationException("Requested entry that should not be requested: " + string);
+        }
+        return getClass().getClassLoader().getResource("mockbundle.service");
+    }
+
+    @Override
+    public long getLastModified() {
+        throw new UnsupportedOperationException("Not supported (MockBundle)");
+    }
+
+    @Override
+    public Enumeration<URL> findEntries(String string, String string1, boolean bln) {
+        throw new UnsupportedOperationException("Not supported (MockBundle)");
+    }
+
+    private BundleContext bundleContext = new MockBundleContext();
+
+    @Override
+    public BundleContext getBundleContext() {
+        return bundleContext;
+    }
+
+    public void setBundleContext(BundleContext bundleContext) {
+        this.bundleContext = bundleContext;
+    }
+
+    @Override
+    public Map<X509Certificate, List<X509Certificate>> getSignerCertificates(int i) {
+        throw new UnsupportedOperationException("Not supported (MockBundle)");
+    }
+
+    @Override
+    public Version getVersion() {
+        return new Version(0, 0, 1);
+    }
+
+    @Override
+    public <A> A adapt(Class<A> type) {
+        throw new UnsupportedOperationException("Not supported (MockBundle)");
+    }
+
+    @Override
+    public File getDataFile(String string) {
+        throw new UnsupportedOperationException("Not supported (MockBundle)");
+    }
+
+    @Override
+    public int compareTo(Bundle o) {
+        return Long.compare(this.getBundleId(), o.getBundleId());
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/125eed20/code/core/src/test/java/org/apache/tamaya/core/internal/MockBundleContext.java
----------------------------------------------------------------------
diff --git a/code/core/src/test/java/org/apache/tamaya/core/internal/MockBundleContext.java b/code/core/src/test/java/org/apache/tamaya/core/internal/MockBundleContext.java
new file mode 100644
index 0000000..3d16ebf
--- /dev/null
+++ b/code/core/src/test/java/org/apache/tamaya/core/internal/MockBundleContext.java
@@ -0,0 +1,202 @@
+/*
+ * 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 java.io.File;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Dictionary;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.BundleException;
+import org.osgi.framework.BundleListener;
+import org.osgi.framework.Filter;
+import org.osgi.framework.FrameworkListener;
+import org.osgi.framework.InvalidSyntaxException;
+import org.osgi.framework.ServiceListener;
+import org.osgi.framework.ServiceReference;
+import org.osgi.framework.ServiceRegistration;
+
+/**
+ *
+ * @author William.Lieurance 2018-02-05
+ */
+public class MockBundleContext implements BundleContext {
+
+    private ArrayList<Bundle> bundles = new ArrayList<>();
+
+    @Override
+    public String getProperty(String string) {
+        throw new UnsupportedOperationException("Not supported (MockBundleContext getProperty)");
+    }
+
+    @Override
+    public Bundle getBundle() {
+        return bundles.get(0);
+    }
+
+    @Override
+    public Bundle installBundle(String string, InputStream in) throws BundleException {
+        throw new UnsupportedOperationException("Not supported (MockBundleContext installBundle)");
+    }
+
+    @Override
+    public Bundle installBundle(String string) throws BundleException {
+        throw new UnsupportedOperationException("Not supported (MockBundleContext installBundle)");
+    }
+
+    public Bundle installBundle(Bundle bundle) {
+        bundles.add(bundle);
+        return bundle;
+    }
+
+    @Override
+    public Bundle getBundle(long l) {
+        return bundles.get(0);
+    }
+
+    @Override
+    public Bundle[] getBundles() {
+        return bundles.toArray(new Bundle[bundles.size()]);
+    }
+
+    @Override
+    public void addServiceListener(ServiceListener sl, String string) throws InvalidSyntaxException {
+        throw new UnsupportedOperationException("Not supported (MockBundleContext addServiceListener)");
+    }
+
+    @Override
+    public void addServiceListener(ServiceListener sl) {
+        throw new UnsupportedOperationException("Not supported (MockBundleContext addServiceListener)");
+    }
+
+    @Override
+    public void removeServiceListener(ServiceListener sl) {
+        throw new UnsupportedOperationException("Not supported (MockBundleContext removeServiceListener)");
+    }
+    
+    int bundleListenersCount = 0;
+
+    public int getBundleListenersCount() {
+        return bundleListenersCount;
+    }
+
+    public void setBundleListenersCount(int bundleListenersCount) {
+        this.bundleListenersCount = bundleListenersCount;
+    }
+
+    @Override
+    public void addBundleListener(BundleListener bl) {
+        bundleListenersCount++;
+    }
+
+    @Override
+    public void removeBundleListener(BundleListener bl) {
+        bundleListenersCount--;
+    }
+
+    @Override
+    public void addFrameworkListener(FrameworkListener fl) {
+        throw new UnsupportedOperationException("Not supported (MockBundleContext addFrameworkListener)");
+    }
+
+    @Override
+    public void removeFrameworkListener(FrameworkListener fl) {
+        throw new UnsupportedOperationException("Not supported (MockBundleContext removeFrameworkListener)");
+    }
+
+    int serviceCount = 0;
+
+    public int getServiceCount() {
+        return serviceCount;
+    }
+
+    public void setServiceCount(int serviceCount) {
+        this.serviceCount = serviceCount;
+    }
+
+    @Override
+    public ServiceRegistration<?> registerService(String[] strings, Object o, Dictionary<String, ?> dctnr) {
+        serviceCount++;
+        return null;
+    }
+
+    @Override
+    public ServiceRegistration<?> registerService(String string, Object o, Dictionary<String, ?> dctnr) {
+        serviceCount++;
+        return null;
+    }
+
+    @Override
+    public <S> ServiceRegistration<S> registerService(Class<S> type, S s, Dictionary<String, ?> dctnr) {
+        serviceCount++;
+        return null;
+    }
+
+    @Override
+    public ServiceReference<?>[] getServiceReferences(String string, String string1) throws InvalidSyntaxException {
+        return new ServiceReference[0];
+    }
+
+    @Override
+    public ServiceReference<?>[] getAllServiceReferences(String string, String string1) throws InvalidSyntaxException {
+        throw new UnsupportedOperationException("Not supported (MockBundleContext getAllServiceReferences)");
+    }
+
+    @Override
+    public ServiceReference<?> getServiceReference(String string) {
+        throw new UnsupportedOperationException("Not supported (MockBundleContext getServiceReference)");
+    }
+
+    @Override
+    public <S> ServiceReference<S> getServiceReference(Class<S> type) {
+        return null;
+    }
+
+    @Override
+    public <S> Collection<ServiceReference<S>> getServiceReferences(Class<S> type, String string) throws InvalidSyntaxException {
+        return new ArrayList();
+    }
+
+    @Override
+    public <S> S getService(ServiceReference<S> sr) {
+        throw new UnsupportedOperationException("Not supported (MockBundleContext getService)");
+    }
+
+    @Override
+    public boolean ungetService(ServiceReference<?> sr) {
+        throw new UnsupportedOperationException("Not supported (MockBundleContext ungetService)");
+    }
+
+    @Override
+    public File getDataFile(String string) {
+        throw new UnsupportedOperationException("Not supported (MockBundleContext getDataFile)");
+    }
+
+    @Override
+    public Filter createFilter(String string) throws InvalidSyntaxException {
+        throw new UnsupportedOperationException("Not supported (MockBundleContext createFilter)");
+    }
+
+    @Override
+    public Bundle getBundle(String string) {
+        return bundles.get(0);
+    }
+};

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/125eed20/code/core/src/test/java/org/apache/tamaya/core/internal/OSGIServiceComparatorTest.java
----------------------------------------------------------------------
diff --git a/code/core/src/test/java/org/apache/tamaya/core/internal/OSGIServiceComparatorTest.java b/code/core/src/test/java/org/apache/tamaya/core/internal/OSGIServiceComparatorTest.java
new file mode 100644
index 0000000..f956d1a
--- /dev/null
+++ b/code/core/src/test/java/org/apache/tamaya/core/internal/OSGIServiceComparatorTest.java
@@ -0,0 +1,114 @@
+/*
+ * 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 javax.annotation.Priority;
+import org.junit.Test;
+import static org.junit.Assert.*;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.ServiceReference;
+
+/**
+ *
+ * @author William.Lieurance 2018-02-05
+ */
+public class OSGIServiceComparatorTest {
+
+    /**
+     * Test of compare method, of class OSGIServiceComparator.
+     */
+    @Test
+    public void testCompare() {
+        ServiceReference low = new MockLowPriorityServiceReference();
+        ServiceReference nullPriority = new MockServiceReference();
+        ServiceReference high = new MockHighPriorityServiceReference();
+        OSGIServiceComparator instance = new OSGIServiceComparator();
+        
+        assertEquals(1, instance.compare(low, high));
+        assertEquals(-1, instance.compare(high, low));
+        assertEquals(0, instance.compare(low, low));
+        
+        assertEquals(1, instance.compare(nullPriority, high));
+        assertEquals(-1, instance.compare(high, nullPriority));
+        assertEquals(0, instance.compare(nullPriority, low));
+    }
+
+    /**
+     * Test of getPriority method, of class OSGIServiceComparator.
+     */
+    @Test
+    public void testGetPriority_Object() {
+        ServiceReference low = new MockLowPriorityServiceReference();
+        assertEquals(1, OSGIServiceComparator.getPriority(low));
+        
+        ServiceReference nullPriority = new MockServiceReference();
+        assertEquals(1, OSGIServiceComparator.getPriority(nullPriority));
+        
+        ServiceReference high = new MockHighPriorityServiceReference();
+        assertEquals(10, OSGIServiceComparator.getPriority(high));
+    }
+
+    /**
+     * Test of getPriority method, of class OSGIServiceComparator.
+     */
+    @Test
+    public void testGetPriority_Class() {
+        assertEquals(10, OSGIServiceComparator.getPriority(MockHighPriorityServiceReference.class));
+        assertEquals(1, OSGIServiceComparator.getPriority(MockLowPriorityServiceReference.class));
+        assertEquals(1, OSGIServiceComparator.getPriority(MockServiceReference.class));
+    }
+    
+    private class MockServiceReference implements ServiceReference {
+        @Override
+        public Object getProperty(String string) {
+            throw new UnsupportedOperationException("Not supported.");
+        }
+
+        @Override
+        public String[] getPropertyKeys() {
+            throw new UnsupportedOperationException("Not supported.");
+        }
+
+        @Override
+        public Bundle getBundle() {
+            throw new UnsupportedOperationException("Not supported.");
+        }
+
+        @Override
+        public Bundle[] getUsingBundles() {
+            throw new UnsupportedOperationException("Not supported.");
+        }
+
+        @Override
+        public boolean isAssignableTo(Bundle bundle, String string) {
+            throw new UnsupportedOperationException("Not supported.");
+        }
+
+        @Override
+        public int compareTo(Object o) {
+            throw new UnsupportedOperationException("Not supported.");
+        }
+    }
+    
+    @Priority(1)
+    private class MockLowPriorityServiceReference extends MockServiceReference {};
+    @Priority(10)
+    private class MockHighPriorityServiceReference extends MockServiceReference {};
+    
+}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/125eed20/code/core/src/test/java/org/apache/tamaya/core/internal/OSGIServiceContextTest.java
----------------------------------------------------------------------
diff --git a/code/core/src/test/java/org/apache/tamaya/core/internal/OSGIServiceContextTest.java b/code/core/src/test/java/org/apache/tamaya/core/internal/OSGIServiceContextTest.java
new file mode 100644
index 0000000..2507672
--- /dev/null
+++ b/code/core/src/test/java/org/apache/tamaya/core/internal/OSGIServiceContextTest.java
@@ -0,0 +1,129 @@
+/*
+ * 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 java.io.IOException;
+import java.net.URL;
+import java.util.Enumeration;
+import java.util.List;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import static org.junit.Assert.*;
+import org.mockito.Mockito;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+
+/**
+ *
+ * @author William.Lieurance 2018-02-10
+ */
+public class OSGIServiceContextTest {
+
+    /**
+     * Test of isInitialized method, of class OSGIServiceContext.
+     */
+    @Test
+    public void testIsInitialized() {
+        OSGIServiceContext instance = new OSGIServiceContext(Mockito.mock(OSGIServiceLoader.class));
+        assertTrue(instance.isInitialized());
+    }
+
+    /**
+     * Test of ordinal method, of class OSGIServiceContext.
+     */
+    @Test
+    public void testOrdinal() {
+        OSGIServiceContext instance = new OSGIServiceContext(Mockito.mock(OSGIServiceLoader.class));
+        assertEquals(10, instance.ordinal());
+    }
+
+    /**
+     * Test of create method, of class OSGIServiceContext.
+     */
+    @Test
+    public void testCreateThenGet() {
+        BundleContext mockBundleContext = new MockBundleContext();
+        OSGIServiceLoader loader = new OSGIServiceLoader(mockBundleContext);
+        OSGIServiceContext instance = new OSGIServiceContext(loader);
+
+        Integer value = instance.create(Integer.class);
+        assertNull(value);
+        value = instance.getService(Integer.class);
+        assertNull(value);
+    }
+
+    /**
+     * Test of getServices method, of class OSGIServiceContext.
+     */
+    @Test
+    public void testGetServices() {
+        BundleContext mockBundleContext = new MockBundleContext();
+        OSGIServiceLoader loader = new OSGIServiceLoader(mockBundleContext);
+        OSGIServiceContext instance = new OSGIServiceContext(loader);
+
+        List services = instance.getServices(Integer.class);
+        assertNotNull(services);
+        assertTrue(services.isEmpty());
+    }
+
+    /**
+     * Test of getResources method, of class OSGIServiceContext.
+     * @throws java.io.IOException
+     */
+    @Test
+    public void testGetResources() throws IOException {
+        MockBundleContext mockBundleContext = new MockBundleContext();
+        OSGIServiceLoader loader = new OSGIServiceLoader(mockBundleContext);
+        MockBundle startedBundle = new MockBundle();
+        startedBundle.setState(Bundle.ACTIVE);
+        startedBundle.setBundleId(1);
+        startedBundle.setBundleContext(mockBundleContext);
+        mockBundleContext.installBundle(startedBundle);
+        OSGIServiceContext instance = new OSGIServiceContext(loader);
+
+        Enumeration<URL> resources = instance.getResources("dummy" , ClassLoader.getSystemClassLoader());
+        assertNotNull(resources);
+        URL resource = (URL)resources.nextElement();
+        assertTrue(resource.toString().contains("mockbundle.service"));
+        assertFalse(resources.hasMoreElements());
+    }
+
+    /**
+     * Test of getResource method, of class OSGIServiceContext.
+     */
+    @Test
+    public void testGetResource() {
+        MockBundleContext mockBundleContext = new MockBundleContext();
+        OSGIServiceLoader loader = new OSGIServiceLoader(mockBundleContext);
+        MockBundle startedBundle = new MockBundle();
+        startedBundle.setState(Bundle.ACTIVE);
+        startedBundle.setBundleId(1);
+        startedBundle.setBundleContext(mockBundleContext);
+        mockBundleContext.installBundle(startedBundle);
+        OSGIServiceContext instance = new OSGIServiceContext(loader);
+
+        URL resource = instance.getResource("mockbundle.service", ClassLoader.getSystemClassLoader());
+        assertNotNull(resource);
+        assertTrue(resource.toString().contains("mockbundle.service"));
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/125eed20/code/core/src/test/java/org/apache/tamaya/core/internal/OSGIServiceLoaderTest.java
----------------------------------------------------------------------
diff --git a/code/core/src/test/java/org/apache/tamaya/core/internal/OSGIServiceLoaderTest.java b/code/core/src/test/java/org/apache/tamaya/core/internal/OSGIServiceLoaderTest.java
new file mode 100644
index 0000000..4da6b34
--- /dev/null
+++ b/code/core/src/test/java/org/apache/tamaya/core/internal/OSGIServiceLoaderTest.java
@@ -0,0 +1,114 @@
+/*
+ * 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 java.util.Set;
+import org.junit.Test;
+import static org.junit.Assert.*;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.BundleEvent;
+
+/**
+ *
+ * @author William.Lieurance 2018-02-06
+ */
+public class OSGIServiceLoaderTest {
+
+    /**
+     * Test of getBundleContext method, of class OSGIServiceLoader.
+     */
+    @Test
+    public void testGetBundleContext() {
+        BundleContext mockBundleContext = new MockBundleContext();
+        OSGIServiceLoader instance = new OSGIServiceLoader(mockBundleContext);
+        BundleContext result = instance.getBundleContext();
+        assertEquals(mockBundleContext, result);
+    }
+
+    /**
+     * Test of getResourceBundles method, of class OSGIServiceLoader.
+     *
+     * @throws java.lang.Exception
+     */
+    @Test
+    public void testGetResourceBundles() throws Exception {
+        MockBundleContext mockBundleContext = new MockBundleContext();
+        MockBundle startedBundle = new MockBundle();
+        startedBundle.setState(Bundle.ACTIVE);
+        startedBundle.setBundleId(1);
+        startedBundle.setBundleContext(mockBundleContext);
+        mockBundleContext.installBundle(startedBundle);
+        OSGIServiceLoader instance = new OSGIServiceLoader(mockBundleContext);
+        Set<Bundle> result = instance.getResourceBundles();
+        assertFalse(result.isEmpty());
+    }
+
+    /**
+     * Test of bundleChanged method, of class OSGIServiceLoader.
+     *
+     * @throws java.lang.Exception
+     */
+    @Test
+    public void testBundleChanged() throws Exception {
+        //Set up mocks
+        Set<Bundle> resultBundles;
+        MockBundleContext mockBundleContext = new MockBundleContext();
+        MockBundle startedBundle = new MockBundle();
+        startedBundle.setState(Bundle.ACTIVE);
+        startedBundle.setBundleId(1);
+        startedBundle.setBundleContext(mockBundleContext);
+        MockBundle stoppedBundle = new MockBundle();
+        stoppedBundle.setState(Bundle.INSTALLED);
+        stoppedBundle.setBundleId(2);
+        stoppedBundle.setBundleContext(mockBundleContext);
+        MockBundle flipBundle = new MockBundle();
+        flipBundle.setState(Bundle.INSTALLED);
+        flipBundle.setBundleId(3);
+        flipBundle.setBundleContext(mockBundleContext);
+        mockBundleContext.installBundle(startedBundle);
+        mockBundleContext.installBundle(stoppedBundle);
+        mockBundleContext.installBundle(flipBundle);
+
+        //Default case
+        mockBundleContext.setServiceCount(0);
+        OSGIServiceLoader instance = new OSGIServiceLoader(mockBundleContext);
+        resultBundles = instance.getResourceBundles();
+        assertEquals(1, resultBundles.size());
+        assertEquals(2, mockBundleContext.getServiceCount());
+
+        //After start
+        mockBundleContext.setServiceCount(0);
+        BundleEvent startedEvent = new BundleEvent(BundleEvent.STARTED, flipBundle);
+        instance.bundleChanged(startedEvent);
+        resultBundles = instance.getResourceBundles();
+        assertEquals(2, resultBundles.size());
+        assertEquals(2, mockBundleContext.getServiceCount());
+
+        //After stop
+        mockBundleContext.setServiceCount(0);
+        BundleEvent stoppedEvent = new BundleEvent(BundleEvent.STOPPED, flipBundle);
+        instance.bundleChanged(stoppedEvent);
+        resultBundles = instance.getResourceBundles();
+        assertEquals(1, resultBundles.size());
+        assertEquals(0, mockBundleContext.getServiceCount());
+    }
+
+    
+}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/125eed20/code/core/src/test/java/org/apache/tamaya/core/internal/converters/BigDecimalConverterTest.java
----------------------------------------------------------------------
diff --git a/code/core/src/test/java/org/apache/tamaya/core/internal/converters/BigDecimalConverterTest.java b/code/core/src/test/java/org/apache/tamaya/core/internal/converters/BigDecimalConverterTest.java
index 91d3bb8..5cae3da 100644
--- a/code/core/src/test/java/org/apache/tamaya/core/internal/converters/BigDecimalConverterTest.java
+++ b/code/core/src/test/java/org/apache/tamaya/core/internal/converters/BigDecimalConverterTest.java
@@ -65,6 +65,12 @@ public class BigDecimalConverterTest {
 		valueRead = config.get("tests.converter.bd.hex.upperX", BigDecimal.class);
 		assertThat(valueRead).isNotNull();
 		assertEquals(new BigDecimal("63"), valueRead);
+		valueRead = config.get("tests.converter.bd.hex.negLowerX", BigDecimal.class);
+		assertThat(valueRead).isNotNull();
+		assertEquals(new BigDecimal("-47"), valueRead);
+		valueRead = config.get("tests.converter.bd.hex.negUpperX", BigDecimal.class);
+		assertThat(valueRead).isNotNull();
+		assertEquals(new BigDecimal("-63"), valueRead);
 	}
 
 	/**

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/125eed20/code/core/src/test/java/org/apache/tamaya/core/internal/converters/BigIntegerConverterTest.java
----------------------------------------------------------------------
diff --git a/code/core/src/test/java/org/apache/tamaya/core/internal/converters/BigIntegerConverterTest.java b/code/core/src/test/java/org/apache/tamaya/core/internal/converters/BigIntegerConverterTest.java
new file mode 100644
index 0000000..108159c
--- /dev/null
+++ b/code/core/src/test/java/org/apache/tamaya/core/internal/converters/BigIntegerConverterTest.java
@@ -0,0 +1,161 @@
+/*
+ * 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.converters;
+
+import java.math.BigInteger;
+import org.apache.tamaya.ConfigException;
+import org.apache.tamaya.Configuration;
+import org.apache.tamaya.ConfigurationProvider;
+import org.apache.tamaya.TypeLiteral;
+import org.apache.tamaya.spi.ConversionContext;
+import static org.assertj.core.api.Assertions.assertThat;
+import org.junit.Test;
+import static org.junit.Assert.*;
+import org.junit.Ignore;
+import static org.mockito.Mockito.mock;
+
+/**
+ *
+ * @author William.Lieurance 2018-02-01
+ */
+public class BigIntegerConverterTest {
+
+    /**
+     * Test conversion. The value are provided by
+     * {@link org.apache.tamaya.core.internal.converters.ConverterTestsPropertySource}.
+     *
+     * @throws Exception
+     */
+    @Test
+    public void testConvert_BigInteger_Decimal() throws Exception {
+        Configuration config = ConfigurationProvider.getConfiguration();
+        BigInteger valueRead = config.get("tests.converter.bd.decimal", BigInteger.class);
+        assertThat(valueRead).isNotNull();
+        assertEquals(BigInteger.valueOf(101), valueRead);
+    }
+
+    /**
+     * Test conversion. The value are provided by
+     * {@link org.apache.tamaya.core.internal.converters.ConverterTestsPropertySource}.
+     *
+     * @throws Exception
+     */
+    @Test
+    public void testConvert_BigInteger_Hex() throws Exception {
+        Configuration config = ConfigurationProvider.getConfiguration();
+        BigInteger valueRead = config.get("tests.converter.bd.hex.lowerX", BigInteger.class);
+        assertThat(valueRead).isNotNull();
+        assertEquals(new BigInteger("47"), valueRead);
+        valueRead = config.get("tests.converter.bd.hex.upperX", BigInteger.class);
+        assertThat(valueRead).isNotNull();
+        assertEquals(new BigInteger("63"), valueRead);
+        valueRead = config.get("tests.converter.bd.hex.negLowerX", BigInteger.class);
+        assertThat(valueRead).isNotNull();
+        assertEquals(new BigInteger("-47"), valueRead);
+        valueRead = config.get("tests.converter.bd.hex.negUpperX", BigInteger.class);
+        assertThat(valueRead).isNotNull();
+        assertEquals(new BigInteger("-63"), valueRead);
+
+    }
+
+    /**
+     * Test conversion. The value are provided by
+     * {@link org.apache.tamaya.core.internal.converters.ConverterTestsPropertySource}.
+     *
+     * @throws Exception
+     */
+    @Ignore
+    @Test
+    public void testConvert_BigInteger_BigHex() throws Exception {
+        Configuration config = ConfigurationProvider.getConfiguration();
+        BigInteger valueRead = config.get("tests.converter.bd.hex.subTenX", BigInteger.class);
+        assertThat(valueRead).isNotNull();
+        assertEquals(new BigInteger("16777215"), valueRead);
+        valueRead = config.get("tests.converter.bd.hex.negSubTenX", BigInteger.class);
+        assertThat(valueRead).isNotNull();
+        assertEquals(new BigInteger("-263"), valueRead);
+    }
+
+    @Test(expected = ConfigException.class)
+    public void badPositiveHex() {
+        Configuration config = ConfigurationProvider.getConfiguration();
+        config.get("tests.converter.bd.hex.badX", BigInteger.class);
+    }
+
+    @Test(expected = ConfigException.class)
+    public void badNegativeHex() {
+        Configuration config = ConfigurationProvider.getConfiguration();
+        config.get("tests.converter.bd.hex.negBadX", BigInteger.class);
+    }
+
+    /**
+     * Test conversion. The value are provided by
+     * {@link org.apache.tamaya.core.internal.converters.ConverterTestsPropertySource}.
+     *
+     * @throws Exception
+     */
+    @Test
+    public void testConvert_NotPresent() throws Exception {
+        Configuration config = ConfigurationProvider.getConfiguration();
+        BigInteger valueRead = config.get("tests.converter.bd.foo", BigInteger.class);
+        assertNull(valueRead);
+    }
+
+    /**
+     * Test conversion. The value are provided by
+     * {@link ConverterTestsPropertySource}.
+     *
+     * @throws Exception
+     */
+    @Test
+    public void testConvert_BigInteger_BigValue() throws Exception {
+        Configuration config = ConfigurationProvider.getConfiguration();
+        BigInteger valueRead = config.get("tests.converter.bd.big", BigInteger.class);
+        assertThat(valueRead).isNotNull();
+        assertEquals(new BigInteger("101666666666666662333337263723628763821638923628193612983618293628763"),
+                valueRead);
+    }
+
+    @Test
+    public void converterHandlesNullValueCorrectly() throws Exception {
+        ConversionContext context = mock(ConversionContext.class);
+
+        BigIntegerConverter converter = new BigIntegerConverter();
+        BigInteger value = converter.convert("", context);
+
+        assertThat(value).isNull();
+    }
+
+    @Test
+    public void callToConvertAddsMoreSupportedFormatsToTheContext() throws Exception {
+        ConversionContext context = new ConversionContext.Builder(TypeLiteral.of(BigInteger.class)).build();
+        BigIntegerConverter converter = new BigIntegerConverter();
+        BigInteger value = converter.convert("", context);
+
+        assertThat(value).isNull();
+        assertTrue(context.getSupportedFormats().contains("<bigint> -> new BigInteger(bigint) (BigIntegerConverter)"));
+    }
+
+    @Test
+    public void testHashCode() {
+        BigIntegerConverter instance = new BigIntegerConverter();
+        assertEquals(BigIntegerConverter.class.hashCode(), instance.hashCode());
+    }
+
+}


Mime
View raw message