http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/063f8ada/code/base/src/main/java/org/apache/tamaya/spi/package-info.java
----------------------------------------------------------------------
diff --git a/code/base/src/main/java/org/apache/tamaya/spi/package-info.java 
b/code/base/src/main/java/org/apache/tamaya/spi/package-info.java
new file mode 100644
index 0000000..cc6feee
--- /dev/null
+++ b/code/base/src/main/java/org/apache/tamaya/spi/package-info.java
@@ -0,0 +1,23 @@
+/*
+ * 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.
+ */
+
+/**
+ * Tamaya extended configuration SPI.
+ */
+package org.apache.tamaya.spi;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/063f8ada/code/base/src/test/java/org/apache/tamaya/base/DefaultConfigBuilderTest.java
----------------------------------------------------------------------
diff --git 
a/code/base/src/test/java/org/apache/tamaya/base/DefaultConfigBuilderTest.java 
b/code/base/src/test/java/org/apache/tamaya/base/DefaultConfigBuilderTest.java
new file mode 100644
index 0000000..84c1e70
--- /dev/null
+++ 
b/code/base/src/test/java/org/apache/tamaya/base/DefaultConfigBuilderTest.java
@@ -0,0 +1,198 @@
+/*
+ * 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.base;
+
+import org.apache.tamaya.spi.TamayaConfigBuilder;
+import org.apache.tamaya.spi.ConfigContext;
+import org.apache.tamaya.spi.ConfigValueCombinationPolicy;
+import org.apache.tamaya.spi.TypeLiteral;
+import org.apache.tamaya.spi.Filter;
+import org.apache.tamaya.base.DefaultConfigBuilder;
+import org.junit.Test;
+
+import javax.config.Config;
+import javax.config.ConfigProvider;
+import javax.config.spi.ConfigBuilder;
+import javax.config.spi.ConfigProviderResolver;
+import javax.config.spi.ConfigSource;
+import javax.config.spi.Converter;
+import java.util.Collections;
+import java.util.Map;
+
+import static org.junit.Assert.*;
+
+/**
+ * Tests for {@link  DefaultConfigBuilder} by atsticks on 06.09.16.
+ */
+public class DefaultConfigBuilderTest {
+
+    private TestPropertySource testPropertySource = new TestPropertySource(){};
+
+
+    @Test
+    public void addPropertySources_Array() throws Exception {
+        ConfigSource testPS2 = new 
TestPropertySource("addPropertySources_Array_2");
+        TamayaConfigBuilder b = new DefaultConfigBuilder()
+                .withSources(testPropertySource, testPS2);
+        ConfigContext ctx = b.getConfigContext();
+        assertEquals(2, ctx.getSources().size());
+        assertTrue(ctx.getSources().contains(testPropertySource));
+        assertTrue(ctx.getSources().contains(testPS2));
+    }
+
+    @Test
+    public void removePropertySources_Array() throws Exception {
+        ConfigSource testPS2 = new 
TestPropertySource("addPropertySources_Array_2");
+        TamayaConfigBuilder b = new DefaultConfigBuilder()
+                .withSources(testPropertySource, testPS2);
+        ConfigContext ctx = b.getConfigContext();
+        assertEquals(2, ctx.getSources().size());
+        assertTrue(ctx.getSources().contains(testPropertySource));
+        assertTrue(ctx.getSources().contains(testPS2));
+        b = new DefaultConfigBuilder()
+                .withSources(testPropertySource, testPS2);
+        b.removeSources(testPropertySource);
+        ctx = b.getConfigContext();
+        assertEquals(1, ctx.getSources().size());
+        assertFalse(ctx.getSources().contains(testPropertySource));
+        assertTrue(ctx.getSources().contains(testPS2));
+    }
+
+    @Test
+    public void addPropertyFilters_Array() throws Exception {
+        Filter filter1 = (value) -> value;
+        Filter filter2 = (value) -> value;
+        DefaultConfigBuilder b = new DefaultConfigBuilder();
+        b.withFilters(filter1, filter2);
+        ConfigContext ctx = b.getConfigContext();
+        assertTrue(ctx.getFilters().contains(filter1));
+        assertTrue(ctx.getFilters().contains(filter2));
+        assertEquals(2, ctx.getFilters().size());
+        b = new DefaultConfigBuilder();
+        b.withFilters(filter1, filter2);
+        b.withFilters(filter1, filter2);
+        assertEquals(2, ctx.getFilters().size());
+    }
+
+    @Test
+    public void removePropertyFilters_Array() throws Exception {
+        Filter filter1 = (value) -> value;
+        Filter filter2 = (value) -> value;
+        TamayaConfigBuilder b = new DefaultConfigBuilder()
+                .withFilters(filter1, filter2);
+        ConfigContext ctx = b.getConfigContext();
+        assertTrue(ctx.getFilters().contains(filter1));
+        assertTrue(ctx.getFilters().contains(filter2));
+        assertEquals(2, ctx.getFilters().size());
+        b = new DefaultConfigBuilder()
+                .withFilters(filter1, filter2);
+        b.removeFilters(filter1);
+        ctx = b.getConfigContext();
+        assertEquals(1, ctx.getFilters().size());
+        assertFalse(ctx.getFilters().contains(filter1));
+        assertTrue(ctx.getFilters().contains(filter2));
+    }
+
+    @Test
+    @SuppressWarnings({ "rawtypes", "unchecked" })
+    public void addPropertyConverter() throws Exception {
+               Converter converter = (value) -> value.toLowerCase();
+               TamayaConfigBuilder b = new DefaultConfigBuilder()
+                .withConverters(String.class, converter);
+        ConfigContext ctx = b.getConfigContext();
+        assertTrue(ctx.getConverters(String.class).contains(converter));
+        assertEquals(1, ctx.getConverters().size());
+        b = new DefaultConfigBuilder()
+                .withConverters(String.class, converter);
+        b.withConverters(String.class, converter);
+        assertEquals(1, ctx.getConverters().size());
+    }
+
+    @Test
+    @SuppressWarnings({ "rawtypes", "unchecked" })
+    public void removePropertyConverters_Array() throws Exception {
+        Converter converter = (value) -> value.toLowerCase();
+        TamayaConfigBuilder b = new DefaultConfigBuilder()
+                .withConverters(String.class, converter);
+        ConfigContext ctx = b.getConfigContext();
+        assertTrue(ctx.getConverters(String.class).contains(converter));
+        assertEquals(1, ctx.getConverters().get(String.class).size());
+        b = new DefaultConfigBuilder()
+                .withConverters(String.class, converter);
+        b.removeConverters(String.class, converter);
+        ctx = b.getConfigContext();
+        assertFalse(ctx.getConverters(String.class).contains(converter));
+        assertTrue(ctx.getConverters(String.class).isEmpty());
+    }
+
+    @Test
+    public void setPropertyValueCombinationPolicy() throws Exception {
+        ConfigValueCombinationPolicy combPol = (currentValue, key, 
propertySource) -> currentValue;
+        TamayaConfigBuilder b = new DefaultConfigBuilder()
+                .withPropertyValueCombinationPolicy(combPol);
+        ConfigContext ctx = b.getConfigContext();
+        assertEquals(ctx.getConfigValueCombinationPolicy(), combPol);
+    }
+
+    @Test
+    public void build() throws Exception {
+        assertNotNull(new DefaultConfigBuilder().build());
+    }
+
+    @Test
+    public void addDiscoveredConverters() throws Exception {
+        ConfigBuilder builder = ConfigProviderResolver.instance().getBuilder();
+        builder.addDiscoveredConverters();
+    }
+
+    private static class TestPropertySource implements ConfigSource{
+
+        private String id;
+
+        public TestPropertySource(){
+            this(null);
+        }
+
+        public TestPropertySource(String id){
+            this.id = id;
+        }
+
+        @Override
+        public int getOrdinal() {
+            return 200;
+        }
+
+        @Override
+        public String getName() {
+            return id!=null?id:"TestPropertySource";
+        }
+
+        @Override
+        public String getValue(String key) {
+            return key + "Value";
+        }
+
+        @Override
+        public Map<String, String> getProperties() {
+            return Collections.emptyMap();
+        }
+
+    }
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/063f8ada/code/base/src/test/java/org/apache/tamaya/base/DefaultConfigTest.java
----------------------------------------------------------------------
diff --git 
a/code/base/src/test/java/org/apache/tamaya/base/DefaultConfigTest.java 
b/code/base/src/test/java/org/apache/tamaya/base/DefaultConfigTest.java
new file mode 100644
index 0000000..587fe5a
--- /dev/null
+++ b/code/base/src/test/java/org/apache/tamaya/base/DefaultConfigTest.java
@@ -0,0 +1,130 @@
+/*
+ * 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.base;
+
+import org.apache.tamaya.spi.TypeLiteral;
+import org.junit.Test;
+
+
+import static org.junit.Assert.assertNull;
+
+public class DefaultConfigTest {
+
+    /**
+     * Tests for get(String)
+     */
+    @Test(expected = NullPointerException.class)
+    public void getDoesNotAcceptNull1() {
+        DefaultConfig c =  new DefaultConfig(new 
DefaultConfigBuilder().getConfigContext());
+        c.getValue("a", (Class)null);
+    }
+
+    /**
+     * Tests for get(String)
+     */
+    @Test(expected = NullPointerException.class)
+    public void getDoesNotAcceptNull2() {
+        DefaultConfig c =  new DefaultConfig(new 
DefaultConfigBuilder().getConfigContext());
+        c.getValue(null, String.class);
+    }
+
+    /**
+     * Tests for get(String, Class)
+     */
+    @SuppressWarnings({ "rawtypes", "unchecked" })
+       @Test(expected = NullPointerException.class)
+    public void getDoesNotAcceptNullForClassTargetType() {
+        DefaultConfig c = new DefaultConfig(new 
DefaultConfigBuilder().getConfigContext());
+        c.getValue("a", (Class) null);
+    }
+
+    /**
+     * Tests for get(String, TypeLiteral)
+     */
+    @Test(expected = NullPointerException.class)
+    public void getDoesNotAcceptNullForTypeLiteralTargetType() {
+        DefaultConfig c =  new DefaultConfig(new 
DefaultConfigBuilder().getConfigContext());
+        c.getValue("a", (Class)null);
+    }
+
+    /**
+     * Tests for getOrDefault(String, Class, String)
+     */
+    @Test(expected = NullPointerException.class)
+    public void getOrDefaultDoesNotAcceptNullAsKeyForThreeParameterVariant() {
+        DefaultConfig c = new DefaultConfig(new 
DefaultConfigBuilder().getConfigContext());
+
+        c.getOptionalValue(null, String.class).orElse("ok");
+    }
+
+    @Test
+    public void 
getOrDefaultDoesAcceptNullAsDefaultValueForThreeParameterVariant() {
+        DefaultConfig c = new DefaultConfig(new 
DefaultConfigBuilder().getConfigContext());
+
+        assertNull(c.getOptionalValue("a", String.class).orElse(null));
+    }
+
+    @SuppressWarnings({ "unchecked", "rawtypes" })
+       @Test(expected = NullPointerException.class)
+    public void 
getOrDefaultDoesAcceptNullAsTargetTypeForThreeParameterVariant() {
+        DefaultConfig c = new DefaultConfig(new 
DefaultConfigBuilder().getConfigContext());
+        c.getOptionalValue("a", (Class)null).orElse("b");
+    }
+
+//    /**
+//     * Tests for getOrDefault(String, TypeLiteral, String)
+//     */
+//    @Test(expected = NullPointerException.class)
+//    public void 
getOrDefaultDoesNotAcceptNullAsKeyForThreeParameterVariantSecondIsTypeLiteral() 
{
+//        DefaultConfiguration c = new DefaultConfiguration(new 
ConfigurationContextBuilder().build());
+//
+//        c.getOptionalValue(null, TypeLiteral.of(String.class)).orElse("ok");
+//    }
+//
+//    @Test
+//    public void 
getOrDefaultDoesAcceptNullAsDefaultValueForThreeParameterVariantSecondIsTypeLiteral()
 {
+//        DefaultConfiguration c = new DefaultConfiguration(new 
ConfigurationContextBuilder().build());
+//
+//        assertNull(c.getOptionalValue("a", 
TypeLiteral.of(String.class)).orElse( null));
+//    }
+//
+//    @Test(expected = NullPointerException.class)
+//    public void 
getOrDefaultDoesNotAcceptNullAsTargetTypeForThreeParameterVariantSecondIsTypeLiteral()
 {
+//        DefaultConfiguration c = new DefaultConfiguration(new 
ConfigurationContextBuilder().build());
+//
+//        c.getOptionalValue("a", (TypeLiteral<String>) null).orElse( "b");
+//    }
+
+    /**
+     * Tests for getOrDefault(String, String)
+     */
+    @Test(expected = NullPointerException.class)
+    public void 
getOrDefaultDoesNotAcceptNullAsKeyForTwoParameterVariantDefaultValueIsSecond() {
+        DefaultConfig c = new DefaultConfig(new 
DefaultConfigBuilder().getConfigContext());
+
+        c.getOptionalValue(null, String.class).orElse("ok");
+    }
+
+    @Test(expected = NullPointerException.class)
+    public void 
getOrDefaultDoesAcceptNullAsDefaultValueForTwoParameterVariantDefaultValueIsSecond()
 {
+        DefaultConfig c = new DefaultConfig(new 
DefaultConfigBuilder().getConfigContext());
+       assertNull(c.getOptionalValue("a", null));
+    }
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/063f8ada/code/base/src/test/java/org/apache/tamaya/base/DefaultServiceContextTest.java
----------------------------------------------------------------------
diff --git 
a/code/base/src/test/java/org/apache/tamaya/base/DefaultServiceContextTest.java 
b/code/base/src/test/java/org/apache/tamaya/base/DefaultServiceContextTest.java
new file mode 100644
index 0000000..7758c3e
--- /dev/null
+++ 
b/code/base/src/test/java/org/apache/tamaya/base/DefaultServiceContextTest.java
@@ -0,0 +1,137 @@
+/*
+ * 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.base;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+import javax.annotation.Priority;
+import javax.config.spi.ConfigProviderResolver;
+import java.util.Collection;
+import java.util.List;
+
+public class DefaultServiceContextTest {
+
+    /**
+     * context to test
+     */
+    private final DefaultServiceContext context = new DefaultServiceContext();
+
+
+    @Test
+    public void testGetService() {
+        ConfigProviderResolver providerSpi = 
context.getService(ConfigProviderResolver.class);
+        Assert.assertNotNull(providerSpi);
+        Assert.assertTrue(providerSpi instanceof TestConfigurationProvider);
+    }
+
+    @Test(expected = IllegalStateException.class)
+    public void 
testGetService_multipleServicesWithoutPriority_shouldThrowConfigException() {
+        context.getService(InvalidPriorityInterface.class);
+    }
+
+    @Test
+    public void 
testGetService_multipleService_shouldReturnServiceWithHighestPriority() {
+        MultiImplsInterface service = 
context.getService(MultiImplsInterface.class);
+
+        Assert.assertNotNull(service);
+        Assert.assertTrue(service instanceof MultiImpl2);
+    }
+
+    @Test
+    public void testGetService_noImpl_shouldReturnEmptyOpional() {
+        NoImplInterface service = context.getService(NoImplInterface.class);
+        Assert.assertNull(service);
+    }
+
+
+    @Test
+    public void testGetServices_shouldReturnServices() {
+        {
+            Collection<InvalidPriorityInterface> services = 
context.getServices(InvalidPriorityInterface.class);
+            Assert.assertNotNull(services);
+            Assert.assertEquals(2, services.size());
+
+            for (InvalidPriorityInterface service : services) {
+                Assert.assertTrue(service instanceof InvalidPriorityImpl1 || 
service instanceof InvalidPriorityImpl2);
+            }
+        }
+
+        {
+            List<MultiImplsInterface> services = 
context.getServices(MultiImplsInterface.class);
+            Assert.assertNotNull(services);
+            Assert.assertEquals(3, services.size());
+
+            Assert.assertTrue(services.get(0) instanceof MultiImpl2);
+            Assert.assertTrue(services.get(1) instanceof MultiImpl1);
+            Assert.assertTrue(services.get(2) instanceof MultiImpl3);
+        }
+    }
+
+    @Test
+    public void testGetServices_redundantAccessToServices() {
+        for(int i=0;i<10;i++){
+            Collection<InvalidPriorityInterface> services = 
context.getServices(InvalidPriorityInterface.class);
+            Assert.assertNotNull(services);
+            Assert.assertEquals(2, services.size());
+            for (InvalidPriorityInterface service : services) {
+                Assert.assertTrue(service instanceof InvalidPriorityImpl1 || 
service instanceof InvalidPriorityImpl2);
+            }
+        }
+    }
+
+    @Test
+    public void testGetServices_noImpl_shouldReturnEmptyList() {
+        Collection<NoImplInterface> services = 
context.getServices(NoImplInterface.class);
+        Assert.assertNotNull(services);
+        Assert.assertTrue(services.isEmpty());
+    }
+
+
+    // some test interfaces and classes
+
+    public interface InvalidPriorityInterface {
+    }
+
+    @Priority(value = 50)
+    public static class InvalidPriorityImpl1 implements 
InvalidPriorityInterface {
+    }
+
+    @Priority(value = 50)
+    public static class InvalidPriorityImpl2 implements 
InvalidPriorityInterface {
+    }
+
+
+    public interface MultiImplsInterface {
+    }
+
+    public static class MultiImpl1 implements MultiImplsInterface {
+    }
+
+    @Priority(value = 500)
+    public static class MultiImpl2 implements MultiImplsInterface {
+    }
+
+    @Priority(value = -10)
+    public static class MultiImpl3 implements MultiImplsInterface {
+    }
+
+    private interface NoImplInterface {
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/063f8ada/code/base/src/test/java/org/apache/tamaya/base/PriorityServiceComparatorTest.java
----------------------------------------------------------------------
diff --git 
a/code/base/src/test/java/org/apache/tamaya/base/PriorityServiceComparatorTest.java
 
b/code/base/src/test/java/org/apache/tamaya/base/PriorityServiceComparatorTest.java
new file mode 100644
index 0000000..4206592
--- /dev/null
+++ 
b/code/base/src/test/java/org/apache/tamaya/base/PriorityServiceComparatorTest.java
@@ -0,0 +1,45 @@
+/*
+ * 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.base;
+
+import org.apache.tamaya.base.configsource.SystemConfigSource;
+import org.apache.tamaya.base.PriorityServiceComparator;
+import org.junit.Test;
+
+import javax.annotation.Priority;
+
+import static org.junit.Assert.*;
+
+/**
+ * Created by atsticks on 12.09.16.
+ */
+public class PriorityServiceComparatorTest {
+
+    @Test
+    public void compare() throws Exception {
+        assertTrue(PriorityServiceComparator.getInstance().compare("a", 
"b")==0);
+        assertTrue(PriorityServiceComparator.getInstance().compare(getClass(), 
getClass())==0);
+        assertTrue(PriorityServiceComparator.getInstance().compare(new A(), 
new SystemConfigSource())==-1);
+        assertTrue(PriorityServiceComparator.getInstance().compare(new 
SystemConfigSource(), new A())==1);
+    }
+
+    @Priority(100)
+    private static final class A{}
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/063f8ada/code/base/src/test/java/org/apache/tamaya/base/TestConfigurationProvider.java
----------------------------------------------------------------------
diff --git 
a/code/base/src/test/java/org/apache/tamaya/base/TestConfigurationProvider.java 
b/code/base/src/test/java/org/apache/tamaya/base/TestConfigurationProvider.java
new file mode 100644
index 0000000..be10fb7
--- /dev/null
+++ 
b/code/base/src/test/java/org/apache/tamaya/base/TestConfigurationProvider.java
@@ -0,0 +1,82 @@
+/*
+ * 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.base;
+
+import org.apache.tamaya.spi.Filter;
+import org.apache.tamaya.spi.ServiceContext;
+import org.apache.tamaya.base.DefaultConfigBuilder;
+
+import javax.config.Config;
+import javax.config.spi.ConfigBuilder;
+import javax.config.spi.ConfigProviderResolver;
+import java.util.Map;
+import java.util.Objects;
+import java.util.concurrent.ConcurrentHashMap;
+
+/**
+ * Implementation of the Configuration API. This class uses the current {@link 
Config} to evaluate the
+ * chain of {@link javax.config.spi.ConfigSource} and {@link Filter}
+ * instance to evaluate the current Configuration.
+ */
+public class TestConfigurationProvider extends ConfigProviderResolver {
+
+    private static final Map<ClassLoader,Config> configurations = new 
ConcurrentHashMap<>();
+
+    @Override
+    public Config getConfig() {
+        return getConfig(ServiceContext.defaultClassLoader());
+    }
+
+    @Override
+    public Config getConfig(ClassLoader classLoader){
+        Config config = configurations.get(classLoader);
+        if(config==null){
+            synchronized (configurations) {
+                config = configurations.get(classLoader);
+                if(config==null) {
+                    config = new DefaultConfigBuilder()
+                            .addDiscoveredConverters()
+                            .addDiscoveredFilters()
+                            .addDefaultSources()
+                            .addDiscoveredSources()
+                            .build();
+                    configurations.put(classLoader, config);
+                }
+            }
+        }
+        return config;
+    }
+
+    @Override
+    public ConfigBuilder getBuilder() {
+        return new DefaultConfigBuilder();
+    }
+
+    @Override
+    public void registerConfig(Config config, ClassLoader classLoader) {
+        Objects.requireNonNull(config);
+        this.configurations.put(classLoader, Objects.requireNonNull(config));
+    }
+
+    @Override
+    public void releaseConfig(Config config) {
+        configurations.forEach((k,v) -> 
{if(v.equals(config)){configurations.remove(k);}});
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/063f8ada/code/base/src/test/java/org/apache/tamaya/base/configsource/BaseConfigSourceTest.java
----------------------------------------------------------------------
diff --git 
a/code/base/src/test/java/org/apache/tamaya/base/configsource/BaseConfigSourceTest.java
 
b/code/base/src/test/java/org/apache/tamaya/base/configsource/BaseConfigSourceTest.java
new file mode 100644
index 0000000..d2bbf0c
--- /dev/null
+++ 
b/code/base/src/test/java/org/apache/tamaya/base/configsource/BaseConfigSourceTest.java
@@ -0,0 +1,124 @@
+/*
+ * 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.base.configsource;
+
+import org.apache.tamaya.base.configsource.BaseConfigSource;
+import org.apache.tamaya.base.configsource.ConfigSourceComparator;
+import org.junit.Assert;
+import org.junit.Test;
+
+import javax.config.spi.ConfigSource;
+import java.util.*;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+public class BaseConfigSourceTest {
+
+    @Test
+    public void givenOrdinalOverwritesGivenDefaulOrdinal() {
+        BaseConfigSource bs = new BaseConfigSource() {
+            @Override
+            public Map<String, String> getProperties() {
+                return Collections.emptyMap();
+            }
+        };
+
+        bs.setDefaultOrdinal(10);
+
+        assertThat(bs.getDefaultOrdinal()).isEqualTo(10);
+        assertThat(bs.getOrdinal()).isEqualTo(10);
+
+        bs.setOrdinal(20);
+
+        assertThat(bs.getOrdinal()).isEqualTo(20);
+    }
+
+    @Test
+    public void testGetOrdinal() {
+
+        ConfigSource defaultPropertySource = new BaseConfigSource(56) {
+
+            @Override
+            public String getName() {
+                return "testWithDefault";
+            }
+
+            @Override
+            public String getValue(String key) {
+                return null;
+            }
+
+            @Override
+            public Map<String,String> getProperties() {
+                return Collections.emptyMap();
+            }
+        };
+
+        Assert.assertEquals(56, 
ConfigSourceComparator.getOrdinal(defaultPropertySource));
+        Assert.assertEquals(1000, new 
OverriddenOrdinalConfigSource().getOrdinal());
+
+        // propertySource with invalid ordinal
+        Assert.assertEquals(1, new 
OverriddenInvalidOrdinalConfigSource().getOrdinal());
+    }
+
+    @Test
+    public void testGet() {
+        Assert.assertEquals(1000, new 
OverriddenOrdinalConfigSource().getOrdinal());
+    }
+
+    private static class OverriddenOrdinalConfigSource extends 
BaseConfigSource {
+
+        private OverriddenOrdinalConfigSource() {
+            super(250);
+        }
+
+        @Override
+        public String getName() {
+            return "overriddenOrdinal";
+        }
+
+        @Override
+        public Map<String,String> getProperties() {
+            Map<String,String> result = new HashMap<>(1);
+            result.put(CONFIG_ORDINAL, "1000");
+            return result;
+        }
+    }
+
+    private static class OverriddenInvalidOrdinalConfigSource extends 
BaseConfigSource {
+
+        private OverriddenInvalidOrdinalConfigSource() {
+            super(1);
+        }
+
+        @Override
+        public String getName() {
+            return "overriddenInvalidOrdinal";
+        }
+
+        @Override
+        public Map<String, String> getProperties() {
+            Map<String,String> result = new HashMap<>(1);
+            result.put(CONFIG_ORDINAL, "invalid");
+            return result;
+        }
+    }
+
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/063f8ada/code/base/src/test/java/org/apache/tamaya/base/configsource/BuildableConfigSourceProviderTest.java
----------------------------------------------------------------------
diff --git 
a/code/base/src/test/java/org/apache/tamaya/base/configsource/BuildableConfigSourceProviderTest.java
 
b/code/base/src/test/java/org/apache/tamaya/base/configsource/BuildableConfigSourceProviderTest.java
new file mode 100644
index 0000000..4ebe6f7
--- /dev/null
+++ 
b/code/base/src/test/java/org/apache/tamaya/base/configsource/BuildableConfigSourceProviderTest.java
@@ -0,0 +1,78 @@
+/*
+ * 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.base.configsource;
+
+import org.apache.tamaya.base.configsource.BuildableConfigSource;
+import org.apache.tamaya.base.configsource.BuildableConfigSourceProvider;
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+public class BuildableConfigSourceProviderTest {
+
+    @Test
+    public void getPropertySources() throws Exception {
+        BuildableConfigSource ps = BuildableConfigSource.builder()
+                .withName("test1").build();
+        BuildableConfigSourceProvider prov = 
BuildableConfigSourceProvider.builder()
+                .withPropertySourcs(ps).build();
+        assertNotNull(prov);
+        assertEquals(prov.getConfigSources(null).iterator().next(), ps);
+    }
+
+    @Test
+    public void equals() throws Exception {
+        BuildableConfigSource ps = BuildableConfigSource.builder()
+                .withName("test1").build();
+        BuildableConfigSourceProvider prov1 = 
BuildableConfigSourceProvider.builder()
+                .withPropertySourcs(ps).build();
+        BuildableConfigSourceProvider prov2 = 
BuildableConfigSourceProvider.builder()
+                .withPropertySourcs(ps).build();
+        assertEquals(prov1, prov2);
+        BuildableConfigSource ps2 = BuildableConfigSource.builder()
+                .withName("test12").build();
+        prov2 = BuildableConfigSourceProvider.builder()
+                .withPropertySourcs(ps2).build();
+        assertNotEquals(prov1, prov2);
+    }
+
+    @Test
+    public void testHashCode() throws Exception {
+        BuildableConfigSource ps = BuildableConfigSource.builder()
+                .withName("test1").build();
+        BuildableConfigSourceProvider prov1 = 
BuildableConfigSourceProvider.builder()
+                .withPropertySourcs(ps).build();
+        BuildableConfigSourceProvider prov2 = 
BuildableConfigSourceProvider.builder()
+                .withPropertySourcs(ps).build();
+        assertEquals(prov1.hashCode(), prov2.hashCode());
+        BuildableConfigSource ps2 = BuildableConfigSource.builder()
+                .withName("test12").build();
+        prov2 = BuildableConfigSourceProvider.builder()
+                .withPropertySourcs(ps2).build();
+        assertNotEquals(prov1.hashCode(), prov2.hashCode());
+    }
+
+
+    @Test
+    public void builder() throws Exception {
+        assertNotNull(BuildableConfigSource.builder());
+        assertNotEquals(BuildableConfigSource.builder(), 
BuildableConfigSource.builder());
+    }
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/063f8ada/code/base/src/test/java/org/apache/tamaya/base/configsource/BuildableConfigSourceTest.java
----------------------------------------------------------------------
diff --git 
a/code/base/src/test/java/org/apache/tamaya/base/configsource/BuildableConfigSourceTest.java
 
b/code/base/src/test/java/org/apache/tamaya/base/configsource/BuildableConfigSourceTest.java
new file mode 100644
index 0000000..3786a89
--- /dev/null
+++ 
b/code/base/src/test/java/org/apache/tamaya/base/configsource/BuildableConfigSourceTest.java
@@ -0,0 +1,89 @@
+/*
+ * 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.base.configsource;
+
+import org.apache.tamaya.base.configsource.BuildableConfigSource;
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+public class BuildableConfigSourceTest {
+    @Test
+    public void getOrdinal() throws Exception {
+        BuildableConfigSource ps1 = BuildableConfigSource.builder()
+                .withOrdinal(55).build();
+        assertEquals(55, ps1.getOrdinal());
+    }
+
+    @Test
+    public void getName() throws Exception {
+        BuildableConfigSource ps1 = BuildableConfigSource.builder()
+                .withName("test1").build();
+        assertEquals("test1", ps1.getName());
+        ps1 = BuildableConfigSource.builder().build();
+        assertNotNull(ps1.getName());
+    }
+
+    @Test
+    public void get() throws Exception {
+        BuildableConfigSource ps1 = BuildableConfigSource.builder()
+                .withProperty("a", "b").build();
+        assertEquals("b", ps1.getValue("a"));
+    }
+
+    @Test
+    public void getProperties() throws Exception {
+        BuildableConfigSource ps1 = BuildableConfigSource.builder()
+                .withProperty("a", "b").build();
+        assertNotNull(ps1.getProperties());
+        assertEquals(1, ps1.getProperties().size());
+        assertEquals("b", ps1.getProperties().get("a"));
+    }
+
+    @Test
+    public void equals() throws Exception {
+        BuildableConfigSource ps1 = BuildableConfigSource.builder()
+                .withName("test1").build();
+        BuildableConfigSource ps2 = BuildableConfigSource.builder()
+                .withName("test1").build();
+        assertEquals(ps1, ps2);
+        ps2 = BuildableConfigSource.builder()
+                .withName("test2").build();
+        assertNotEquals(ps1, ps2);
+    }
+
+    @Test
+    public void testHashCode() throws Exception {
+        BuildableConfigSource ps1 = BuildableConfigSource.builder()
+                .withName("test1").build();
+        BuildableConfigSource ps2 = BuildableConfigSource.builder()
+                .withName("test1").build();
+        assertEquals(ps1.hashCode(), ps2.hashCode());
+        ps2 = BuildableConfigSource.builder()
+                .withName("test2").build();
+        assertNotEquals(ps1.hashCode(), ps2.hashCode());
+    }
+
+    @Test
+    public void builder() throws Exception {
+        assertNotNull(BuildableConfigSource.builder());
+        assertNotEquals(BuildableConfigSource.builder(), 
BuildableConfigSource.builder());
+    }
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/063f8ada/code/base/src/test/java/org/apache/tamaya/base/configsource/CLIPropertySourceTest.java
----------------------------------------------------------------------
diff --git 
a/code/base/src/test/java/org/apache/tamaya/base/configsource/CLIPropertySourceTest.java
 
b/code/base/src/test/java/org/apache/tamaya/base/configsource/CLIPropertySourceTest.java
new file mode 100644
index 0000000..726b3b3
--- /dev/null
+++ 
b/code/base/src/test/java/org/apache/tamaya/base/configsource/CLIPropertySourceTest.java
@@ -0,0 +1,59 @@
+/*
+ * 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.base.configsource;
+
+import org.apache.tamaya.base.configsource.CLIConfigSource;
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+/**
+ * Tests for PropertySource for reading main arguments as configuration.
+ */
+public class CLIPropertySourceTest {
+
+    @Test
+    public void setCLIProps() throws Exception {
+        System.clearProperty("main.args");
+        CLIConfigSource ps = new CLIConfigSource();
+        assertTrue(ps.getProperties().isEmpty());
+        CLIConfigSource.initMainArgs("-a", "b");
+        assertFalse(ps.getProperties().isEmpty());
+        assertEquals(ps.getValue("a"), "b");
+        CLIConfigSource.initMainArgs("--c");
+        assertFalse(ps.getProperties().isEmpty());
+        assertEquals(ps.getValue("c"), "c");
+        CLIConfigSource.initMainArgs("sss");
+        assertFalse(ps.getProperties().isEmpty());
+        assertEquals(ps.getValue("sss"), "sss");
+        CLIConfigSource.initMainArgs("-a", "b", "--c", "sss", "--val=vvv");
+        assertFalse(ps.getProperties().isEmpty());
+        assertEquals(ps.getValue("a"), "b");
+        assertEquals(ps.getValue("c"), "c");
+        assertEquals(ps.getValue("sss"), "sss");
+    // getProperties() throws Exception {
+        System.setProperty("main.args", "-a b\t--c sss  ");
+        ps = new CLIConfigSource();
+        assertFalse(ps.getProperties().isEmpty());
+        System.clearProperty("main.args");
+        assertEquals(ps.getValue("a"), "b");
+        assertEquals(ps.getValue("c"), "c");
+        assertEquals(ps.getValue("sss"), "sss");
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/063f8ada/code/base/src/test/java/org/apache/tamaya/base/configsource/EnumConverterTest.java
----------------------------------------------------------------------
diff --git 
a/code/base/src/test/java/org/apache/tamaya/base/configsource/EnumConverterTest.java
 
b/code/base/src/test/java/org/apache/tamaya/base/configsource/EnumConverterTest.java
new file mode 100644
index 0000000..5aefbd0
--- /dev/null
+++ 
b/code/base/src/test/java/org/apache/tamaya/base/configsource/EnumConverterTest.java
@@ -0,0 +1,63 @@
+/*
+ * 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.base.configsource;
+
+import org.apache.tamaya.base.convert.ConversionContext;
+import org.apache.tamaya.spi.TypeLiteral;
+import org.apache.tamaya.base.convert.EnumConverter;
+import org.junit.Test;
+
+import java.math.RoundingMode;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+
+/**
+ * Test class testing the {@link EnumConverter} class.
+ */
+public class EnumConverterTest {
+
+    private final EnumConverter testConverter = new 
EnumConverter(RoundingMode.class);
+
+    private final ConversionContext DUMMY_CONTEXT = new 
ConversionContext.Builder("someKey", Enum.class).build();
+
+    @Test
+    public void testConvert() {
+        ConversionContext.setContext(DUMMY_CONTEXT);
+        assertEquals(testConverter.convert(RoundingMode.CEILING.toString()), 
RoundingMode.CEILING);
+    }
+
+    @Test
+    public void testConvert_LowerCase() {
+        ConversionContext.setContext(DUMMY_CONTEXT);
+        assertEquals(testConverter.convert("ceiling"), RoundingMode.CEILING);
+    }
+
+    @Test
+    public void testConvert_MixedCase()  {
+        ConversionContext.setContext(DUMMY_CONTEXT);
+        assertEquals(testConverter.convert("CeiLinG"), RoundingMode.CEILING);
+    }
+
+    @Test
+    public void testConvert_OtherValue() {
+        ConversionContext.setContext(DUMMY_CONTEXT);
+        assertNull(testConverter.convert("fooBars"));
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/063f8ada/code/base/src/test/java/org/apache/tamaya/base/configsource/EnvironmentPropertySourceTest.java
----------------------------------------------------------------------
diff --git 
a/code/base/src/test/java/org/apache/tamaya/base/configsource/EnvironmentPropertySourceTest.java
 
b/code/base/src/test/java/org/apache/tamaya/base/configsource/EnvironmentPropertySourceTest.java
new file mode 100644
index 0000000..424f773
--- /dev/null
+++ 
b/code/base/src/test/java/org/apache/tamaya/base/configsource/EnvironmentPropertySourceTest.java
@@ -0,0 +1,62 @@
+/*
+ * 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.base.configsource;
+
+import org.apache.tamaya.base.configsource.EnvironmentConfigSource;
+import org.junit.Test;
+
+import java.util.Map;
+
+import static org.junit.Assert.assertEquals;
+
+/**
+ * Tests for {@link EnvironmentConfigSource}.
+ */
+public class EnvironmentPropertySourceTest {
+
+    private final EnvironmentConfigSource envPropertySource = new 
EnvironmentConfigSource();
+
+    @Test
+    public void testGetOrdinal() throws Exception {
+        assertEquals(EnvironmentConfigSource.DEFAULT_ORDINAL, 
envPropertySource.getOrdinal());
+    }
+
+    @Test
+    public void testGetName() throws Exception {
+        assertEquals("environment-properties", envPropertySource.getName());
+    }
+
+    @Test
+    public void testGet() throws Exception {
+        for (Map.Entry<String, String> envEntry : System.getenv().entrySet()) {
+            assertEquals(envPropertySource.getValue(envEntry.getKey()), 
envEntry.getValue());
+        }
+    }
+
+    @Test
+    public void testGetProperties() throws Exception {
+        Map<String, String> props = envPropertySource.getProperties();
+        for(Map.Entry<String,String> en: props.entrySet()){
+            if(!en.getKey().endsWith("[meta]")){
+                assertEquals(System.getenv(en.getKey()), en.getValue());
+            }
+        }
+    }
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/063f8ada/code/base/src/test/java/org/apache/tamaya/base/configsource/JavaConfigurationProviderTest.java
----------------------------------------------------------------------
diff --git 
a/code/base/src/test/java/org/apache/tamaya/base/configsource/JavaConfigurationProviderTest.java
 
b/code/base/src/test/java/org/apache/tamaya/base/configsource/JavaConfigurationProviderTest.java
new file mode 100644
index 0000000..e5f1136
--- /dev/null
+++ 
b/code/base/src/test/java/org/apache/tamaya/base/configsource/JavaConfigurationProviderTest.java
@@ -0,0 +1,46 @@
+/*
+ * 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.base.configsource;
+
+import org.apache.tamaya.base.configsource.JavaConfigurationConfigSource;
+import org.hamcrest.MatcherAssert;
+import org.hamcrest.Matchers;
+import org.junit.Test;
+
+import javax.config.spi.ConfigSource;
+
+public class JavaConfigurationProviderTest {
+
+    private static final String A_UMLAUT = "\u00E4";
+    private static final String O_UMLAUT = "\u00F6";
+
+    @Test
+    public void loadsSimpleAndXMLPropertyFilesProper() {
+        ConfigSource propertySource = new JavaConfigurationConfigSource();
+        MatcherAssert.assertThat(propertySource.getProperties().keySet(), 
Matchers.hasSize(7));  // double the size for .source values.
+
+        for (int i = 1; i < 6; i++) {
+            String key = "confkey" + i;
+            String value = "javaconf-value" + i;
+
+            MatcherAssert.assertThat(value, 
Matchers.equalTo(propertySource.getValue(key)));
+        }
+
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/063f8ada/code/base/src/test/java/org/apache/tamaya/base/configsource/MapPropertySourceTest.java
----------------------------------------------------------------------
diff --git 
a/code/base/src/test/java/org/apache/tamaya/base/configsource/MapPropertySourceTest.java
 
b/code/base/src/test/java/org/apache/tamaya/base/configsource/MapPropertySourceTest.java
new file mode 100644
index 0000000..433b12b
--- /dev/null
+++ 
b/code/base/src/test/java/org/apache/tamaya/base/configsource/MapPropertySourceTest.java
@@ -0,0 +1,76 @@
+/*
+ * 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.base.configsource;
+
+import org.apache.tamaya.base.configsource.MapConfigSource;
+import org.junit.Before;
+import org.junit.Test;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Properties;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+public class MapPropertySourceTest {
+
+    private Map<String,String> sourceMap;
+    private Properties sourceProperties;
+
+    @Before
+    public void createMapAndProperties() throws Exception {
+        sourceMap = new HashMap<>();
+        sourceMap.put("a", "AAA");
+        sourceMap.put("b", "BBB");
+
+        sourceProperties = new Properties();
+        sourceProperties.setProperty("a", "AAA");
+        sourceProperties.setProperty("b", "BBB");
+    }
+
+    @Test
+    public void sourceWillProperlyInitializedWithMapWithoutPrefix() throws 
Exception {
+        MapConfigSource propertySource = new MapConfigSource("UT", sourceMap);
+
+        assertThat(propertySource.getProperties()).describedAs("Should contain 
exactly 2 properties.")
+                                                  .hasSize(2);
+        assertThat(propertySource.getValue("a")).isNotNull();
+        assertThat(propertySource.getValue("b")).isNotNull();
+    }
+
+    @Test
+    public void sourceWillProperlyInitializedWithMapWithPrefix() throws 
Exception {
+        MapConfigSource propertySource = new MapConfigSource("UT", sourceMap, 
"pre-");
+
+        assertThat(propertySource.getProperties()).describedAs("Should contain 
exactly 2 properties.")
+                                                  .hasSize(2);
+        assertThat(propertySource.getValue("pre-a")).isNotNull();
+        assertThat(propertySource.getValue("pre-b")).isNotNull();
+    }
+
+    @Test
+    public void sourceWillProperlyInitializedWithPropertiesWithPrefix() throws 
Exception {
+        MapConfigSource propertySource = new MapConfigSource("UT", 
sourceProperties, "pre-");
+
+        assertThat(propertySource.getProperties()).describedAs("Should contain 
exactly 2 properties.")
+                                                  .hasSize(2);
+        assertThat(propertySource.getValue("pre-a")).isNotNull();
+        assertThat(propertySource.getValue("pre-b")).isNotNull();
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/063f8ada/code/base/src/test/java/org/apache/tamaya/base/configsource/PropertiesFilePropertySourceTest.java
----------------------------------------------------------------------
diff --git 
a/code/base/src/test/java/org/apache/tamaya/base/configsource/PropertiesFilePropertySourceTest.java
 
b/code/base/src/test/java/org/apache/tamaya/base/configsource/PropertiesFilePropertySourceTest.java
new file mode 100644
index 0000000..2b6ba65
--- /dev/null
+++ 
b/code/base/src/test/java/org/apache/tamaya/base/configsource/PropertiesFilePropertySourceTest.java
@@ -0,0 +1,60 @@
+/*
+ * 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.base.configsource;
+
+import org.apache.tamaya.base.configsource.SimpleConfigSource;
+import org.junit.Assert;
+import org.junit.Test;
+
+import javax.config.spi.ConfigSource;
+
+public class PropertiesFilePropertySourceTest {
+
+    private final SimpleConfigSource testfilePropertySource = new 
SimpleConfigSource(Thread.currentThread()
+            .getContextClassLoader().getResource("testfile.properties"));
+    private final SimpleConfigSource overrideOrdinalPropertySource = new 
SimpleConfigSource(
+            
Thread.currentThread().getContextClassLoader().getResource("overrideOrdinal.properties"));
+
+
+    @Test
+    public void testGetOrdinal() {
+        Assert.assertEquals(0, testfilePropertySource.getOrdinal());
+        
Assert.assertEquals(Integer.parseInt(overrideOrdinalPropertySource.getValue(ConfigSource.CONFIG_ORDINAL)),
+                overrideOrdinalPropertySource.getOrdinal());
+    }
+
+
+    @Test
+    public void testGet() {
+        Assert.assertEquals("val3", testfilePropertySource.getValue("key3"));
+        Assert.assertEquals("myval5", 
overrideOrdinalPropertySource.getValue("mykey5"));
+        Assert.assertNull(testfilePropertySource.getValue("nonpresentkey"));
+    }
+
+
+    @Test
+    public void testGetProperties() throws Exception {
+        Assert.assertEquals(5, testfilePropertySource.getProperties().size());
+        
Assert.assertTrue(testfilePropertySource.getProperties().containsKey("key1"));
+        
Assert.assertTrue(testfilePropertySource.getProperties().containsKey("key2"));
+        
Assert.assertTrue(testfilePropertySource.getProperties().containsKey("key3"));
+        
Assert.assertTrue(testfilePropertySource.getProperties().containsKey("key4"));
+        
Assert.assertTrue(testfilePropertySource.getProperties().containsKey("key5"));
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/063f8ada/code/base/src/test/java/org/apache/tamaya/base/configsource/SimplePropertySourceTest.java
----------------------------------------------------------------------
diff --git 
a/code/base/src/test/java/org/apache/tamaya/base/configsource/SimplePropertySourceTest.java
 
b/code/base/src/test/java/org/apache/tamaya/base/configsource/SimplePropertySourceTest.java
new file mode 100644
index 0000000..581f42b
--- /dev/null
+++ 
b/code/base/src/test/java/org/apache/tamaya/base/configsource/SimplePropertySourceTest.java
@@ -0,0 +1,88 @@
+/*
+ * 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.base.configsource;
+
+import org.apache.tamaya.base.configsource.SimpleConfigSource;
+import org.junit.Test;
+
+import java.net.URL;
+
+import static org.hamcrest.CoreMatchers.allOf;
+import static org.hamcrest.CoreMatchers.endsWith;
+import static org.hamcrest.CoreMatchers.notNullValue;
+import static org.hamcrest.CoreMatchers.startsWith;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.aMapWithSize;
+import static org.hamcrest.Matchers.hasEntry;
+
+public class SimplePropertySourceTest {
+    @Test
+    public void successfulCreationWithPropertiesFromXMLPropertiesFile() {
+        URL resource = getClass().getResource("/valid-properties.xml");
+
+        SimpleConfigSource source = new SimpleConfigSource(resource);
+
+        assertThat(source, notNullValue());
+        assertThat(source.getProperties(), aMapWithSize(2)); // double the 
size for .source values.
+        assertThat(source.getProperties(), hasEntry("a", "b"));
+        assertThat(source.getProperties(), hasEntry("b", "1"));
+
+    }
+
+    @Test
+    public void failsToCreateFromNonXMLPropertiesXMLFile() {
+        URL resource = getClass().getResource("/non-xml-properties.xml");
+        Exception catchedException = null;
+
+        try {
+            new SimpleConfigSource(resource);
+        } catch (Exception ce) {
+            catchedException = ce;
+        }
+
+        assertThat(catchedException.getMessage(), allOf(startsWith("Error 
loading properties from"),
+                                                        
endsWith("non-xml-properties.xml")));
+    }
+
+    @Test
+    public void failsToCreateFromInvalidPropertiesXMLFile() {
+        URL resource = getClass().getResource("/invalid-properties.xml");
+        Exception catchedException = null;
+
+        try {
+            new SimpleConfigSource(resource);
+        } catch (Exception ce) {
+            catchedException = ce;
+        }
+
+        assertThat(catchedException.getMessage(), allOf(startsWith("Error 
loading properties from"),
+                                                        
endsWith("invalid-properties.xml")));
+    }
+
+
+    @Test
+    public void successfulCreationWithPropertiesFromSimplePropertiesFile() {
+        URL resource = getClass().getResource("/testfile.properties");
+
+        SimpleConfigSource source = new SimpleConfigSource(resource);
+
+        assertThat(source, notNullValue());
+        assertThat(source.getProperties(), aMapWithSize(5)); // double the 
size for .source values.
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/063f8ada/code/base/src/test/java/org/apache/tamaya/base/configsource/SystemPropertySourceTest.java
----------------------------------------------------------------------
diff --git 
a/code/base/src/test/java/org/apache/tamaya/base/configsource/SystemPropertySourceTest.java
 
b/code/base/src/test/java/org/apache/tamaya/base/configsource/SystemPropertySourceTest.java
new file mode 100644
index 0000000..54aead3
--- /dev/null
+++ 
b/code/base/src/test/java/org/apache/tamaya/base/configsource/SystemPropertySourceTest.java
@@ -0,0 +1,92 @@
+/*
+ * 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.base.configsource;
+
+import org.apache.tamaya.base.configsource.SystemConfigSource;
+import org.junit.Assert;
+import org.junit.Test;
+
+import java.util.Map;
+import java.util.Properties;
+
+import static javax.config.spi.ConfigSource.CONFIG_ORDINAL;
+
+public class SystemPropertySourceTest {
+
+    private final SystemConfigSource testPropertySource = new 
SystemConfigSource();
+
+
+    @Test
+    public void testGetOrdinal() throws Exception {
+
+        // test the default ordinal
+        Assert.assertEquals(SystemConfigSource.DEFAULT_ORDINAL, 
testPropertySource.getOrdinal());
+
+        // set the ordinal to 1001
+        System.setProperty(CONFIG_ORDINAL, "1001");
+        Assert.assertEquals(1001, new SystemConfigSource().getOrdinal());
+        // currently its not possible to change ordinal at runtime
+
+        // reset it to not destroy other tests!!
+        System.clearProperty(CONFIG_ORDINAL);
+    }
+
+    @Test
+    public void testGetName() throws Exception {
+        Assert.assertEquals("system-properties", testPropertySource.getName());
+    }
+
+    @Test
+    public void testGet() throws Exception {
+        String propertyKeyToCheck = 
System.getProperties().stringPropertyNames().iterator().next();
+
+        String property = testPropertySource.getValue(propertyKeyToCheck);
+        Assert.assertNotNull("Property '" + propertyKeyToCheck + "' is not 
present in " +
+                SystemConfigSource.class.getSimpleName(), property);
+        Assert.assertEquals(System.getProperty(propertyKeyToCheck), property);
+    }
+
+    @Test
+    public void testGetProperties() throws Exception {
+        checkWithSystemProperties(testPropertySource.getProperties());
+
+        // modify system properties
+        System.setProperty("test", "myTestVal");
+
+        checkWithSystemProperties(testPropertySource.getProperties());
+
+        // cleanup
+        System.clearProperty("test");
+    }
+
+    private void checkWithSystemProperties(Map<String,String> toCheck) {
+        Properties systemEntries = System.getProperties();
+        int num = 0;
+        for (Map.Entry<String,String> propertySourceEntry : 
toCheck.entrySet()) {
+            if(propertySourceEntry.getKey().endsWith("[meta]")){
+                continue; // meta entry
+            }
+            num ++;
+            Assert.assertEquals("Entry values for key '" + 
propertySourceEntry.getKey() + "' do not match",
+                                
systemEntries.getProperty(propertySourceEntry.getKey()), 
propertySourceEntry.getValue());
+        }
+        Assert.assertEquals("size of System.getProperties().entrySet() must be 
the same as SystemPropertySrouce.getProperties().entrySet()",
+                systemEntries.size(), num);
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/063f8ada/code/base/src/test/java/org/apache/tamaya/base/configsource/TestConfigDefaultSource.java
----------------------------------------------------------------------
diff --git 
a/code/base/src/test/java/org/apache/tamaya/base/configsource/TestConfigDefaultSource.java
 
b/code/base/src/test/java/org/apache/tamaya/base/configsource/TestConfigDefaultSource.java
new file mode 100644
index 0000000..5011572
--- /dev/null
+++ 
b/code/base/src/test/java/org/apache/tamaya/base/configsource/TestConfigDefaultSource.java
@@ -0,0 +1,52 @@
+/*
+ * 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.base.configsource;
+
+
+import org.apache.tamaya.base.configsource.BaseConfigSource;
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * Test provider reading properties from classpath:cfg/defaults/**.properties.
+ */
+public class TestConfigDefaultSource extends BaseConfigSource {
+
+    private Map<String,String> properties = new HashMap<>();
+
+    public TestConfigDefaultSource() {
+        super(100);
+        properties.put("name","Anatole");
+        properties.put("name2","Sabine");
+        properties = Collections.unmodifiableMap(properties);
+    }
+
+    @Override
+    public String getName() {
+        return "default-testdata-properties";
+    }
+
+    @Override
+    public Map<String, String> getProperties() {
+        return properties;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/063f8ada/code/base/src/test/java/org/apache/tamaya/base/convert/A.java
----------------------------------------------------------------------
diff --git a/code/base/src/test/java/org/apache/tamaya/base/convert/A.java 
b/code/base/src/test/java/org/apache/tamaya/base/convert/A.java
new file mode 100644
index 0000000..ca801f1
--- /dev/null
+++ b/code/base/src/test/java/org/apache/tamaya/base/convert/A.java
@@ -0,0 +1,29 @@
+/*
+ * 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.base.convert;
+
+/**
+ * Test class for testing transitively evaluated property converters.
+ */
+class A implements AutoCloseable{
+    @Override
+    public void close() throws Exception {
+
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/063f8ada/code/base/src/test/java/org/apache/tamaya/base/convert/B.java
----------------------------------------------------------------------
diff --git a/code/base/src/test/java/org/apache/tamaya/base/convert/B.java 
b/code/base/src/test/java/org/apache/tamaya/base/convert/B.java
new file mode 100644
index 0000000..505a613
--- /dev/null
+++ b/code/base/src/test/java/org/apache/tamaya/base/convert/B.java
@@ -0,0 +1,29 @@
+/*
+ * 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.base.convert;
+
+/**
+ * Test class for testing transitively evaluated property converters.
+ */
+public class B extends A implements Runnable{
+    @Override
+    public void run() {
+
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/063f8ada/code/base/src/test/java/org/apache/tamaya/base/convert/C.java
----------------------------------------------------------------------
diff --git a/code/base/src/test/java/org/apache/tamaya/base/convert/C.java 
b/code/base/src/test/java/org/apache/tamaya/base/convert/C.java
new file mode 100644
index 0000000..3a00bea
--- /dev/null
+++ b/code/base/src/test/java/org/apache/tamaya/base/convert/C.java
@@ -0,0 +1,56 @@
+/*
+ * 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.base.convert;
+
+import java.io.IOException;
+import java.nio.CharBuffer;
+
+/**
+ * Test class for testing transitively evaluated property converters.
+ */
+public class C extends B implements Readable{
+
+    private final String inValue;
+
+    public C(String inValue){
+        this.inValue = inValue;
+    }
+
+    @Override
+    public int read(CharBuffer cb) throws IOException {
+        return 0;
+    }
+
+    /**
+     * Returns the input value, set on creation. Used for test assertion.
+     * @return the in value.
+     */
+    public String getInValue() {
+        return inValue;
+    }
+
+    @Override
+    public String toString() {
+        return "C{" +
+                "inValue='" + inValue + '\'' +
+                '}';
+    }
+
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/063f8ada/code/base/src/test/java/org/apache/tamaya/base/convert/CTestConverter.java
----------------------------------------------------------------------
diff --git 
a/code/base/src/test/java/org/apache/tamaya/base/convert/CTestConverter.java 
b/code/base/src/test/java/org/apache/tamaya/base/convert/CTestConverter.java
new file mode 100644
index 0000000..494c571
--- /dev/null
+++ b/code/base/src/test/java/org/apache/tamaya/base/convert/CTestConverter.java
@@ -0,0 +1,31 @@
+/*
+ * 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.base.convert;
+
+import javax.config.spi.Converter;
+
+/**
+ * Created by Anatole on 13.06.2015.
+ */
+public class CTestConverter implements Converter<C> {
+    @Override
+    public C convert(String value) {
+        return new C(value);
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/063f8ada/code/base/src/test/java/org/apache/tamaya/base/convert/ConverterManagerTest.java
----------------------------------------------------------------------
diff --git 
a/code/base/src/test/java/org/apache/tamaya/base/convert/ConverterManagerTest.java
 
b/code/base/src/test/java/org/apache/tamaya/base/convert/ConverterManagerTest.java
new file mode 100644
index 0000000..43bd244
--- /dev/null
+++ 
b/code/base/src/test/java/org/apache/tamaya/base/convert/ConverterManagerTest.java
@@ -0,0 +1,184 @@
+/*
+ * 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.base.convert;
+
+import org.junit.Test;
+
+import javax.config.spi.Converter;
+import java.util.List;
+
+import static org.hamcrest.CoreMatchers.*;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.equalTo;
+import static org.hamcrest.collection.IsCollectionWithSize.hasSize;
+
+public class ConverterManagerTest {
+
+    private final ConversionContext DUMMY_CONTEXT = new 
ConversionContext.Builder(
+            "someKey", Object.class).build();
+
+    @Test
+    public void customTypeWithFactoryMethodOfIsRecognizedAsSupported() {
+        ConverterManager manager = new ConverterManager();
+
+        assertThat(manager.isTargetTypeSupported(MyType.class),
+                   is(true));
+    }
+
+    @Test
+    public void factoryMethodOfIsUsedAsConverter() {
+        ConverterManager manager = new ConverterManager();
+
+        List<Converter> converters = manager.getConverters(
+                MyType.class);
+
+        assertThat(converters, hasSize(1));
+
+        Converter<MyType> converter = converters.get(0);
+
+        Object result = converter.convert("IN");
+
+        assertThat(result, notNullValue());
+        assertThat(result, instanceOf(MyType.class));
+        assertThat(((MyType)result).getValue(), equalTo("IN"));
+    }
+
+    @Test
+    public void testDirectConverterMapping(){
+        ConverterManager manager = new ConverterManager();
+        List<Converter<C>> converters = 
List.class.cast(manager.getConverters(C.class));
+        assertThat(converters, hasSize(1));
+
+        Converter<C> converter = converters.get(0);
+        C result = converter.convert("testDirectConverterMapping");
+
+        assertThat(result, notNullValue());
+        assertThat(result, instanceOf(C.class));
+        assertThat((result).getInValue(), 
equalTo("testDirectConverterMapping"));
+    }
+
+    @Test
+    public void testDirectSuperclassConverterMapping(){
+        ConverterManager manager = new ConverterManager();
+        manager.addDiscoveredConverters();
+        List<Converter<B>> converters = 
List.class.cast(manager.getConverters(B.class));
+        assertThat(converters, hasSize(1));
+        converters = List.class.cast(manager.getConverters(B.class));
+        assertThat(converters, hasSize(1));
+
+        Converter<B> converter = converters.get(0);
+        B result = converter.convert("testDirectSuperclassConverterMapping");
+
+        assertThat(result, notNullValue());
+        assertThat(result, instanceOf(C.class));
+        assertThat(((C)result).getInValue(), 
equalTo("testDirectSuperclassConverterMapping"));
+    }
+
+    @Test
+    public void testMultipleConverterLoad(){
+        ConverterManager manager = new ConverterManager();
+        manager.addDiscoveredConverters();
+        List<Converter<B>> converters = 
List.class.cast(manager.getConverters(B.class));
+        assertThat(converters, hasSize(1));
+        manager = new ConverterManager();
+        converters = List.class.cast(manager.getConverters(B.class));
+        assertThat(converters, hasSize(0));
+        manager.addDiscoveredConverters();
+        converters = List.class.cast(manager.getConverters(B.class));
+        assertThat(converters, hasSize(1));
+    }
+
+    @Test
+    public void testTransitiveSuperclassConverterMapping(){
+        ConverterManager manager = new ConverterManager();
+        manager.addDiscoveredConverters();
+        List<Converter<A>> converters = 
List.class.cast(manager.getConverters(A.class));
+        assertThat(converters, hasSize(1));
+
+        Converter<A> converter = converters.get(0);
+        A result = 
converter.convert("testTransitiveSuperclassConverterMapping");
+
+        assertThat(result, notNullValue());
+        assertThat(result, instanceOf(C.class));
+        assertThat(((C)result).getInValue(), 
equalTo("testTransitiveSuperclassConverterMapping"));
+    }
+
+    @Test
+    public void testDirectInterfaceMapping(){
+        ConverterManager manager = new ConverterManager();
+        manager.addDiscoveredConverters();
+        List<Converter<Readable>> converters = 
List.class.cast(manager.getConverters(Readable.class));
+        assertThat(converters, hasSize(1));
+
+        Converter<Readable> converter = converters.get(0);
+        Readable result = converter.convert("testDirectInterfaceMapping");
+
+        assertThat(result, notNullValue());
+        assertThat(result, instanceOf(C.class));
+        assertThat(((C)result).getInValue(), 
equalTo("testDirectInterfaceMapping"));
+    }
+
+    @Test
+    public void testTransitiveInterfaceMapping1(){
+        ConverterManager manager = new ConverterManager();
+        manager.addDiscoveredConverters();
+        List<Converter<Runnable>> converters = 
List.class.cast(manager.getConverters(Runnable.class));
+        assertThat(converters, hasSize(1));
+
+        Converter<Runnable> converter = converters.get(0);
+        Runnable result = converter.convert("testTransitiveInterfaceMapping1");
+
+        assertThat(result, notNullValue());
+        assertThat(result, instanceOf(C.class));
+        assertThat(((C)result).getInValue(), 
equalTo("testTransitiveInterfaceMapping1"));
+    }
+
+    @Test
+    public void testTransitiveInterfaceMapping2(){
+        ConverterManager manager = new ConverterManager();
+        manager.addDiscoveredConverters();
+        List<Converter<AutoCloseable>> converters = 
List.class.cast(manager.getConverters(AutoCloseable.class));
+        assertThat(converters, hasSize(1));
+
+        Converter<AutoCloseable> converter = converters.get(0);
+        AutoCloseable result = 
converter.convert("testTransitiveInterfaceMapping2");
+
+        assertThat(result, notNullValue());
+        assertThat(result, instanceOf(C.class));
+        assertThat(((C)result).getInValue(), 
equalTo("testTransitiveInterfaceMapping2"));
+    }
+
+    public static class MyType {
+        private final String typeValue;
+
+        private MyType(String value) {
+            typeValue = value;
+        }
+
+        public static MyType of(String source) {
+            return new MyType(source);
+        }
+
+        public String getValue() {
+            return typeValue;
+        }
+
+    }
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/063f8ada/code/base/src/test/java/org/apache/tamaya/base/convert/EnumConverterTest.java
----------------------------------------------------------------------
diff --git 
a/code/base/src/test/java/org/apache/tamaya/base/convert/EnumConverterTest.java 
b/code/base/src/test/java/org/apache/tamaya/base/convert/EnumConverterTest.java
new file mode 100644
index 0000000..e8c40f6
--- /dev/null
+++ 
b/code/base/src/test/java/org/apache/tamaya/base/convert/EnumConverterTest.java
@@ -0,0 +1,53 @@
+/*
+ * 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.base.convert;
+
+import org.apache.tamaya.base.convert.EnumConverter;
+import org.apache.tamaya.base.convert.ConversionContext;
+import org.apache.tamaya.spi.TypeLiteral;
+import org.junit.Test;
+
+import java.math.RoundingMode;
+import java.util.Arrays;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+
+/**
+ * Test class testing the {@link EnumConverter} class.
+ */
+public class EnumConverterTest {
+
+       private final EnumConverter<RoundingMode> testConverter = new 
EnumConverter<>(RoundingMode.class);
+
+       private final ConversionContext DUMMY_CONTEXT = new 
ConversionContext.Builder("someKey", Enum.class)
+                       .build();
+
+       @Test
+       public void testConversionWithMixedCasing() {
+               for (String input : 
Arrays.asList(RoundingMode.CEILING.toString(), "ceiling", "CeiLinG")) {
+                       assertEquals(RoundingMode.CEILING, 
testConverter.convert(input));
+               }
+       }
+
+       @Test
+       public void testConvert_OtherValue() {
+               assertNull(testConverter.convert("fooBars"));
+       }
+}
\ No newline at end of file

Reply via email to