You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tamaya.apache.org by pl...@apache.org on 2015/12/20 14:05:49 UTC
[2/8] incubator-tamaya git commit: Moved module core to ./code/
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/eadbfe97/core/src/test/java/org/apache/tamaya/core/internal/CTestConverter.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/tamaya/core/internal/CTestConverter.java b/core/src/test/java/org/apache/tamaya/core/internal/CTestConverter.java
deleted file mode 100644
index 7ee2a35..0000000
--- a/core/src/test/java/org/apache/tamaya/core/internal/CTestConverter.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tamaya.core.internal;
-
-import org.apache.tamaya.spi.ConversionContext;
-import org.apache.tamaya.spi.PropertyConverter;
-
-/**
- * Created by Anatole on 13.06.2015.
- */
-public class CTestConverter implements PropertyConverter<C>{
- @Override
- public C convert(String value, ConversionContext context) {
- return new C(value);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/eadbfe97/core/src/test/java/org/apache/tamaya/core/internal/DefaultServiceContextTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/tamaya/core/internal/DefaultServiceContextTest.java b/core/src/test/java/org/apache/tamaya/core/internal/DefaultServiceContextTest.java
deleted file mode 100644
index 1d24884..0000000
--- a/core/src/test/java/org/apache/tamaya/core/internal/DefaultServiceContextTest.java
+++ /dev/null
@@ -1,140 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tamaya.core.internal;
-
-import org.apache.tamaya.ConfigException;
-import org.apache.tamaya.spi.ConfigurationProviderSpi;
-import org.junit.Assert;
-import org.junit.Test;
-
-import javax.annotation.Priority;
-import java.util.Collection;
-import java.util.List;
-
-public class DefaultServiceContextTest {
-
- /**
- * context to test
- */
- private DefaultServiceContext context = new DefaultServiceContext();
-
-
- @Test
- public void testGetService() {
- ConfigurationProviderSpi providerSpi = context.getService(ConfigurationProviderSpi.class);
- Assert.assertNotNull(providerSpi);
- Assert.assertTrue(providerSpi instanceof DefaultConfigurationProvider);
- }
-
- @Test(expected = ConfigException.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);
- }
- }
-
- {
- Collection<MultiImplsInterface> services = context.getServices(MultiImplsInterface.class);
- Assert.assertNotNull(services);
- Assert.assertEquals(3, services.size());
-
- for (MultiImplsInterface service : services) {
- Assert.assertTrue(service instanceof MultiImpl1 ||
- service instanceof MultiImpl2 ||
- service 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 static interface InvalidPriorityInterface {
- }
-
- @Priority(value = 50)
- public static class InvalidPriorityImpl1 implements InvalidPriorityInterface {
- }
-
- @Priority(value = 50)
- public static class InvalidPriorityImpl2 implements InvalidPriorityInterface {
- }
-
-
- public static 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 static interface NoImplInterface {
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/eadbfe97/core/src/test/java/org/apache/tamaya/core/internal/PropertyConverterManagerTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/tamaya/core/internal/PropertyConverterManagerTest.java b/core/src/test/java/org/apache/tamaya/core/internal/PropertyConverterManagerTest.java
deleted file mode 100644
index 82d834a..0000000
--- a/core/src/test/java/org/apache/tamaya/core/internal/PropertyConverterManagerTest.java
+++ /dev/null
@@ -1,179 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tamaya.core.internal;
-
-
-import org.apache.tamaya.ConfigurationProvider;
-import org.apache.tamaya.spi.ConversionContext;
-import org.apache.tamaya.spi.PropertyConverter;
-import org.apache.tamaya.TypeLiteral;
-import org.junit.Test;
-
-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 PropertyConverterManagerTest {
-
- private ConversionContext DUMMY_CONTEXT = new ConversionContext.Builder(
- "someKey", TypeLiteral.of(Object.class)).build();
-
- @Test
- public void customTypeWithFactoryMethodOfIsRecognizedAsSupported() {
- PropertyConverterManager manager = new PropertyConverterManager();
-
- assertThat(manager.isTargetTypeSupported(TypeLiteral.of(MyType.class)),
- is(true));
- }
-
- @Test
- public void factoryMethodOfIsUsedAsConverter() {
- PropertyConverterManager manager = new PropertyConverterManager();
-
- List<PropertyConverter<MyType>> converters = manager.getPropertyConverters(
- (TypeLiteral)TypeLiteral.of(MyType.class));
-
- assertThat(converters, hasSize(1));
-
- PropertyConverter<MyType> converter = converters.get(0);
-
- Object result = converter.convert("IN", DUMMY_CONTEXT);
-
- assertThat(result, notNullValue());
- assertThat(result, instanceOf(MyType.class));
- assertThat(((MyType)result).getValue(), equalTo("IN"));
- }
-
- @Test
- public void testDirectConverterMapping(){
- PropertyConverterManager manager = new PropertyConverterManager();
- List<PropertyConverter<C>> converters = List.class.cast(manager.getPropertyConverters(TypeLiteral.of(C.class)));
- assertThat(converters, hasSize(1));
-
- PropertyConverter<C> converter = converters.get(0);
- C result = converter.convert("testDirectConverterMapping", DUMMY_CONTEXT);
-
- assertThat(result, notNullValue());
- assertThat(result, instanceOf(C.class));
- assertThat(((C)result).getInValue(), equalTo("testDirectConverterMapping"));
- }
-
- @Test
- public void testDirectSuperclassConverterMapping(){
- PropertyConverterManager manager = new PropertyConverterManager();
- List<PropertyConverter<B>> converters = List.class.cast(manager.getPropertyConverters(TypeLiteral.of(B.class)));
- assertThat(converters, hasSize(1));
- converters = List.class.cast(manager.getPropertyConverters(TypeLiteral.of(B.class)));
- assertThat(converters, hasSize(1));
-
- PropertyConverter<B> converter = converters.get(0);
- B result = converter.convert("testDirectSuperclassConverterMapping", DUMMY_CONTEXT);
-
- assertThat(result, notNullValue());
- assertThat(result, instanceOf(C.class));
- assertThat(((C)result).getInValue(), equalTo("testDirectSuperclassConverterMapping"));
- }
-
- @Test
- public void testMultipleConverterLoad(){
- PropertyConverterManager manager = new PropertyConverterManager();
- List<PropertyConverter<B>> converters = List.class.cast(manager.getPropertyConverters(TypeLiteral.of(B.class)));
- assertThat(converters, hasSize(1));
- manager = new PropertyConverterManager();
- converters = List.class.cast(manager.getPropertyConverters(TypeLiteral.of(B.class)));
- assertThat(converters, hasSize(1));
- }
-
- @Test
- public void testTransitiveSuperclassConverterMapping(){
- PropertyConverterManager manager = new PropertyConverterManager();
- List<PropertyConverter<A>> converters = List.class.cast(manager.getPropertyConverters(TypeLiteral.of(A.class)));
- assertThat(converters, hasSize(1));
-
- PropertyConverter<A> converter = converters.get(0);
- A result = converter.convert("testTransitiveSuperclassConverterMapping", DUMMY_CONTEXT);
-
- assertThat(result, notNullValue());
- assertThat(result, instanceOf(C.class));
- assertThat(((C)result).getInValue(), equalTo("testTransitiveSuperclassConverterMapping"));
- }
-
- @Test
- public void testDirectInterfaceMapping(){
- PropertyConverterManager manager = new PropertyConverterManager();
- List<PropertyConverter<Readable>> converters = List.class.cast(manager.getPropertyConverters(TypeLiteral.of(Readable.class)));
- assertThat(converters, hasSize(1));
-
- PropertyConverter<Readable> converter = converters.get(0);
- Readable result = converter.convert("testDirectInterfaceMapping", DUMMY_CONTEXT);
-
- assertThat(result, notNullValue());
- assertThat(result, instanceOf(C.class));
- assertThat(((C)result).getInValue(), equalTo("testDirectInterfaceMapping"));
- }
-
- @Test
- public void testTransitiveInterfaceMapping1(){
- PropertyConverterManager manager = new PropertyConverterManager();
- List<PropertyConverter<Runnable>> converters = List.class.cast(manager.getPropertyConverters(TypeLiteral.of(Runnable.class)));
- assertThat(converters, hasSize(1));
-
- PropertyConverter<Runnable> converter = converters.get(0);
- Runnable result = converter.convert("testTransitiveInterfaceMapping1", DUMMY_CONTEXT);
-
- assertThat(result, notNullValue());
- assertThat(result, instanceOf(C.class));
- assertThat(((C)result).getInValue(), equalTo("testTransitiveInterfaceMapping1"));
- }
-
- @Test
- public void testTransitiveInterfaceMapping2(){
- PropertyConverterManager manager = new PropertyConverterManager();
- List<PropertyConverter<AutoCloseable>> converters = List.class.cast(manager.getPropertyConverters(TypeLiteral.of(AutoCloseable.class)));
- assertThat(converters, hasSize(1));
-
- PropertyConverter<AutoCloseable> converter = converters.get(0);
- AutoCloseable result = converter.convert("testTransitiveInterfaceMapping2", DUMMY_CONTEXT);
-
- assertThat(result, notNullValue());
- assertThat(result, instanceOf(C.class));
- assertThat(((C)result).getInValue(), equalTo("testTransitiveInterfaceMapping2"));
- }
-
- public static class MyType {
- private 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/eadbfe97/core/src/test/java/org/apache/tamaya/core/internal/converters/BigDecimalConverterTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/tamaya/core/internal/converters/BigDecimalConverterTest.java b/core/src/test/java/org/apache/tamaya/core/internal/converters/BigDecimalConverterTest.java
deleted file mode 100644
index 9c71688..0000000
--- a/core/src/test/java/org/apache/tamaya/core/internal/converters/BigDecimalConverterTest.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tamaya.core.internal.converters;
-
-import org.apache.tamaya.Configuration;
-import org.apache.tamaya.ConfigurationProvider;
-import org.junit.Test;
-
-import java.math.BigDecimal;
-
-import static org.junit.Assert.*;
-
-/**
- * Tests the default converter for bytes.
- */
-public class BigDecimalConverterTest {
-
- /**
- * Test conversion. The value are provided by
- * {@link org.apache.tamaya.core.internal.converters.ConverterTestsPropertySource}.
- * @throws Exception
- */
- @Test
- public void testConvert_BigDecimal_Decimal() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- BigDecimal valueRead = config.get("tests.converter.bd.decimal", BigDecimal.class);
- assertTrue(valueRead != null);
- assertEquals(valueRead, new BigDecimal(101));
- }
-
-
- /**
- * Test conversion. The value are provided by
- * {@link org.apache.tamaya.core.internal.converters.ConverterTestsPropertySource}.
- * @throws Exception
- */
- @Test
- public void testConvert_BigDecimal_Hex() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- BigDecimal valueRead = config.get("tests.converter.bd.hex.lowerX", BigDecimal.class);
- assertTrue(valueRead != null);
- assertEquals(valueRead, new BigDecimal("47"));
- valueRead = config.get("tests.converter.bd.hex.upperX", BigDecimal.class);
- assertTrue(valueRead != null);
- assertEquals(valueRead, new BigDecimal("63"));
- }
-
- /**
- * 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();
- BigDecimal valueRead = config.get("tests.converter.bd.foo", BigDecimal.class);
- assertFalse(valueRead != null);
- }
-
- /**
- * Test conversion. The value are provided by
- * {@link ConverterTestsPropertySource}.
- * @throws Exception
- */
- @Test
- public void testConvert_BigDecimal_BigValue() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- BigDecimal valueRead = config.get("tests.converter.bd.big", BigDecimal.class);
- assertTrue(valueRead != null);
- assertEquals(new BigDecimal("101666666666666662333337263723628763821638923628193612983618293628763"),
- valueRead);
- }
-
- /**
- * Test conversion. The value are provided by
- * {@link ConverterTestsPropertySource}.
- * @throws Exception
- */
- @Test
- public void testConvert_BigDecimal_BigFloatValue() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- BigDecimal valueRead = config.get("tests.converter.bd.bigFloat", BigDecimal.class);
- assertTrue(valueRead != null);
- assertEquals(new BigDecimal("1016666666666666623333372637236287638216389293628763.1016666666666666623333372" +
- "63723628763821638923628193612983618293628763"), valueRead);
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/eadbfe97/core/src/test/java/org/apache/tamaya/core/internal/converters/BooleanConverterTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/tamaya/core/internal/converters/BooleanConverterTest.java b/core/src/test/java/org/apache/tamaya/core/internal/converters/BooleanConverterTest.java
deleted file mode 100644
index c3b3f96..0000000
--- a/core/src/test/java/org/apache/tamaya/core/internal/converters/BooleanConverterTest.java
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tamaya.core.internal.converters;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-
-import org.apache.tamaya.Configuration;
-import org.apache.tamaya.ConfigurationProvider;
-import org.junit.Test;
-
-/**
- * Tests the default converter for bytes.
- */
-public class BooleanConverterTest {
-
- /**
- * Test conversion. The value are provided by
- * {@link ConverterTestsPropertySource}.
- * @throws Exception
- */
- @Test
- public void testConvert_Byte() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- // trues
- Boolean valueRead = config.get("tests.converter.boolean.y1", Boolean.class);
- assertNotNull(valueRead);
- assertEquals(valueRead, Boolean.TRUE);
- valueRead = config.get("tests.converter.boolean.y2", Boolean.class);
- assertNotNull(valueRead);
- assertEquals(valueRead, Boolean.TRUE);
- valueRead = config.get("tests.converter.boolean.yes1", Boolean.class);
- assertNotNull(valueRead);
- assertEquals(valueRead, Boolean.TRUE);
- valueRead = config.get("tests.converter.boolean.yes2", Boolean.class);
- assertNotNull(valueRead);
- assertEquals(valueRead, Boolean.TRUE);
- valueRead = config.get("tests.converter.boolean.yes3", Boolean.class);
- assertNotNull(valueRead);
- assertEquals(valueRead, Boolean.TRUE);
- valueRead = config.get("tests.converter.boolean.true1", Boolean.class);
- assertNotNull(valueRead);
- assertEquals(valueRead, Boolean.TRUE);
- valueRead = config.get("tests.converter.boolean.true2", Boolean.class);
- assertNotNull(valueRead);
- assertEquals(valueRead, Boolean.TRUE);
- valueRead = config.get("tests.converter.boolean.true3", Boolean.class);
- assertNotNull(valueRead);
- assertEquals(valueRead, Boolean.TRUE);
- valueRead = config.get("tests.converter.boolean.t1", Boolean.class);
- assertNotNull(valueRead);
- assertEquals(valueRead, Boolean.TRUE);
- valueRead = config.get("tests.converter.boolean.t2", Boolean.class);
- assertNotNull(valueRead);
- assertEquals(valueRead, Boolean.TRUE);
- // falses
- valueRead = config.get("tests.converter.boolean.n1", Boolean.class);
- assertNotNull(valueRead);
- assertFalse(valueRead.booleanValue());
- valueRead = config.get("tests.converter.boolean.n2", Boolean.class);
- assertNotNull(valueRead);
- assertFalse(valueRead.booleanValue());
- valueRead = config.get("tests.converter.boolean.no1", Boolean.class);
- assertFalse(valueRead);
- assertFalse(valueRead.booleanValue());
- valueRead = config.get("tests.converter.boolean.no2", Boolean.class);
- assertNotNull(valueRead);
- assertFalse(valueRead.booleanValue());
- valueRead = config.get("tests.converter.boolean.no3", Boolean.class);
- assertNotNull(valueRead);
- assertFalse(valueRead.booleanValue());
- valueRead = config.get("tests.converter.boolean.false1", Boolean.class);
- assertNotNull(valueRead);
- assertFalse(valueRead.booleanValue());
- valueRead = config.get("tests.converter.boolean.false2", Boolean.class);
- assertNotNull(valueRead);
- assertFalse(valueRead.booleanValue());
- valueRead = config.get("tests.converter.boolean.false3", Boolean.class);
- assertNotNull(valueRead);
- assertFalse(valueRead.booleanValue());
- valueRead = config.get("tests.converter.boolean.f1", Boolean.class);
- assertNotNull(valueRead);
- assertFalse(valueRead.booleanValue());
- valueRead = config.get("tests.converter.boolean.f2", Boolean.class);
- assertNotNull(valueRead);
- assertFalse(valueRead.booleanValue());
- valueRead = config.get("tests.converter.boolean.foo", Boolean.class);
- assertNull(valueRead);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/eadbfe97/core/src/test/java/org/apache/tamaya/core/internal/converters/ByteConverterTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/tamaya/core/internal/converters/ByteConverterTest.java b/core/src/test/java/org/apache/tamaya/core/internal/converters/ByteConverterTest.java
deleted file mode 100644
index 132674d..0000000
--- a/core/src/test/java/org/apache/tamaya/core/internal/converters/ByteConverterTest.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tamaya.core.internal.converters;
-
-import org.apache.tamaya.Configuration;
-import org.apache.tamaya.ConfigurationProvider;
-import org.junit.Test;
-
-import static org.junit.Assert.*;
-
-/**
- * Tests the default converter for bytes.
- */
-public class ByteConverterTest {
-
- /**
- * Test conversion. The value are provided by
- * {@link org.apache.tamaya.core.internal.converters.ConverterTestsPropertySource}.
- * @throws Exception
- */
- @Test
- public void testConvert_Byte() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- Byte valueRead = config.get("tests.converter.byte.decimal", Byte.class);
- assertNotNull(valueRead);
- assertEquals(valueRead.byteValue(), 101);
- valueRead = config.get("tests.converter.byte.octal", Byte.class);
- assertNotNull(valueRead);
- assertEquals(valueRead.byteValue(), Byte.decode("02").byteValue());
- valueRead = config.get("tests.converter.byte.hex.lowerX", Byte.class);
- assertNotNull(valueRead);
- assertEquals(valueRead.byteValue(), Byte.decode("0x2F").byteValue());
- valueRead = config.get("tests.converter.byte.hex.upperX", Byte.class);
- assertNotNull(valueRead);
- assertEquals(valueRead.byteValue(), Byte.decode("0X3F").byteValue());
- valueRead = config.get("tests.converter.byte.foo", Byte.class);
- assertNull(valueRead);
- }
-
- /**
- * Test conversion. The value are provided by
- * {@link ConverterTestsPropertySource}.
- * @throws Exception
- */
- @Test
- public void testConvert_Byte_MinValue() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- Byte valueRead = config.get("tests.converter.byte.min", Byte.class);
- assertTrue(valueRead!=null);
- assertEquals(Byte.MIN_VALUE, valueRead.byteValue());
- }
-
- /**
- * Test conversion. The value are provided by
- * {@link ConverterTestsPropertySource}.
- * @throws Exception
- */
- @Test
- public void testConvert_Byte_MaxValue() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- Byte valueRead = config.get("tests.converter.byte.max", Byte.class);
- assertTrue(valueRead!=null);
- assertEquals(Byte.MAX_VALUE, valueRead.byteValue());
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/eadbfe97/core/src/test/java/org/apache/tamaya/core/internal/converters/CharConverterTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/tamaya/core/internal/converters/CharConverterTest.java b/core/src/test/java/org/apache/tamaya/core/internal/converters/CharConverterTest.java
deleted file mode 100644
index f27a465..0000000
--- a/core/src/test/java/org/apache/tamaya/core/internal/converters/CharConverterTest.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tamaya.core.internal.converters;
-
-import org.apache.tamaya.Configuration;
-import org.apache.tamaya.ConfigurationProvider;
-import org.junit.Test;
-
-import static org.junit.Assert.*;
-
-/**
- * Tests conversion of the {@link CharConverter}.
- */
-public class CharConverterTest {
-
- @Test
- public void testConvert_Character() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- Character valueRead = config.get("tests.converter.char.f", Character.class);
- assertTrue(valueRead!=null);
- assertEquals(valueRead.charValue(), 'f');
- }
-
- @Test
- public void testConvert_Character_Numeric() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- Character valueRead = config.get("tests.converter.char.f-numeric", Character.class);
- assertTrue(valueRead!=null);
- assertEquals(valueRead.charValue(), (char)101);
- }
-
- @Test
- public void testConvert_Character_Quoted() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- Character valueRead = config.get("tests.converter.char.d", Character.class);
- assertTrue(valueRead!=null);
- assertEquals(valueRead.charValue(), 'd');
- }
-
- @Test
- public void testConvert_Character_WithWhitspace_Before() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- Character valueRead = config.get("tests.converter.char.f-before", Character.class);
- assertTrue(valueRead!=null);
- assertEquals(valueRead.charValue(), 'f');
- }
-
- @Test
- public void testConvert_Character_WithWhitspace_After() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- Character valueRead = config.get("tests.converter.char.f-after", Character.class);
- assertTrue(valueRead!=null);
- assertEquals(valueRead.charValue(), 'f');
- }
-
- @Test
- public void testConvert_Character_WithWhitspace_Around() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- Character valueRead = config.get("tests.converter.char.f-around", Character.class);
- assertTrue(valueRead!=null);
- assertEquals(valueRead.charValue(), 'f');
- }
-
- @Test
- public void testConvert_NotPresent() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- Character valueRead = config.get("tests.converter.char.foo", Character.class);
- assertNull(valueRead);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/eadbfe97/core/src/test/java/org/apache/tamaya/core/internal/converters/ConverterTestsPropertySource.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/tamaya/core/internal/converters/ConverterTestsPropertySource.java b/core/src/test/java/org/apache/tamaya/core/internal/converters/ConverterTestsPropertySource.java
deleted file mode 100644
index 26ad140..0000000
--- a/core/src/test/java/org/apache/tamaya/core/internal/converters/ConverterTestsPropertySource.java
+++ /dev/null
@@ -1,252 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tamaya.core.internal.converters;
-
-import org.apache.tamaya.spi.PropertySource;
-
-import java.util.Collections;
-import java.util.Map;
-
-/**
- * Test Property Source used by converter tests.
- */
-public class ConverterTestsPropertySource implements PropertySource{
- @Override
- public int getOrdinal() {
- return 0;
- }
-
- @Override
- public String getName(){
- return "ConverterTestsPropertySource";
- }
-
- @Override
- public String get(String key) {
- switch(key){
- // Bytes
- case "tests.converter.byte.decimal":
- return "101";
- case "tests.converter.byte.octal":
- return "02";
- case "tests.converter.byte.hex.lowerX":
- return "0x2F";
- case "tests.converter.byte.hex.upperX":
- return "0X3F";
- case "tests.converter.byte.min":
- return "min";
- case "tests.converter.byte.max":
- return "MAX_Value";
- // Boolean
- case "tests.converter.boolean.y1":
- return "y";
- case "tests.converter.boolean.y2":
- return "Y";
- case "tests.converter.boolean.yes1":
- return "yes";
- case "tests.converter.boolean.yes2":
- return "Yes";
- case "tests.converter.boolean.yes3":
- return "yeS";
- case "tests.converter.boolean.true1":
- return "true";
- case "tests.converter.boolean.true2":
- return "True";
- case "tests.converter.boolean.true3":
- return "trUe";
- case "tests.converter.boolean.t1":
- return "t";
- case "tests.converter.boolean.t2":
- return "T";
- case "tests.converter.boolean.n1":
- return "n";
- case "tests.converter.boolean.n2":
- return "N";
- case "tests.converter.boolean.no1":
- return "no";
- case "tests.converter.boolean.no2":
- return "No";
- case "tests.converter.boolean.no3":
- return "nO";
- case "tests.converter.boolean.false1":
- return "false";
- case "tests.converter.boolean.false2":
- return "False";
- case "tests.converter.boolean.false3":
- return "falSe";
- case "tests.converter.boolean.f1":
- return "f";
- case "tests.converter.boolean.f2":
- return "F";
- // Character
- case "tests.converter.char.f":
- return "f";
- case "tests.converter.char.d":
- return "'d'";
- case "tests.converter.char.f-before":
- return " f";
- case "tests.converter.char.f-after":
- return "f ";
- case "tests.converter.char.f-around":
- return " f ";
- case "tests.converter.char.f-numeric":
- return "101";
- // currency
- case "tests.converter.currency.code1":
- return "CHF";
- case "tests.converter.currency.code2":
- return "cHf";
- case "tests.converter.currency.code3":
- return " CHF";
- case "tests.converter.currency.code4":
- return "CHF ";
- case "tests.converter.currency.code5":
- return " CHF ";
- case "tests.converter.currency.code-numeric1":
- return "100";
- case "tests.converter.currency.code-numeric2":
- return " 100";
- case "tests.converter.currency.code-numeric3":
- return "100 ";
- case "tests.converter.currency.code-numeric4":
- return " 100 ";
- case "tests.converter.currency.code-locale1":
- return "DE";
- case "tests.converter.currency.code-locale2":
- return " DE";
- case "tests.converter.currency.code-locale3":
- return "DE ";
- case "tests.converter.currency.code-locale4":
- return " DE ";
- //double
- case "tests.converter.double.decimal":
- return "1.23456789";
- case "tests.converter.double.decimalNegative":
- return "-1.23456789";
- case "tests.converter.double.integer":
- return " 100";
- case "tests.converter.double.hex1":
- return " 0XFF";
- case "tests.converter.double.hex2":
- return "-0xFF ";
- case "tests.converter.double.hex3":
- return "#FF";
- case "tests.converter.double.octal":
- return "0013";
- case "tests.converter.double.min":
- return "MIN_Value";
- case "tests.converter.double.max":
- return "max";
- case "tests.converter.double.nan":
- return "NAN";
- case "tests.converter.double.pi":
- return "positive_infinity";
- case "tests.converter.double.ni":
- return "Negative_Infinity";
- //float
- case "tests.converter.float.decimal":
- return "1.23456789";
- case "tests.converter.float.decimalNegative":
- return "-1.23456789";
- case "tests.converter.float.integer":
- return " 100";
- case "tests.converter.float.hex1":
- return " 0XFF";
- case "tests.converter.float.hex2":
- return "-0xFF ";
- case "tests.converter.float.hex3":
- return "#FF";
- case "tests.converter.float.octal":
- return "0013";
- case "tests.converter.float.min":
- return "MIN_Value";
- case "tests.converter.float.max":
- return "max";
- case "tests.converter.float.nan":
- return "NAN";
- case "tests.converter.float.pi":
- return "positive_infinity";
- case "tests.converter.float.ni":
- return "Negative_Infinity";
- // Integer
- case "tests.converter.integer.decimal":
- return "101";
- case "tests.converter.integer.octal":
- return "02";
- case "tests.converter.integer.hex.lowerX":
- return "0x2F";
- case "tests.converter.integer.hex.upperX":
- return "0X3F";
- case "tests.converter.integer.min":
- return "min";
- case "tests.converter.integer.max":
- return "MAX_Value";
- // Long
- case "tests.converter.long.decimal":
- return "101";
- case "tests.converter.long.octal":
- return "02";
- case "tests.converter.long.hex.lowerX":
- return "0x2F";
- case "tests.converter.long.hex.upperX":
- return "0X3F";
- case "tests.converter.long.min":
- return "min";
- case "tests.converter.long.max":
- return "MAX_Value";
- // Short
- case "tests.converter.short.decimal":
- return "101";
- case "tests.converter.short.octal":
- return "02";
- case "tests.converter.short.hex.lowerX":
- return "0x2F";
- case "tests.converter.short.hex.upperX":
- return "0X3F";
- case "tests.converter.short.min":
- return "min";
- case "tests.converter.short.max":
- return "MAX_Value";
- // BigDecimal
- case "tests.converter.bd.decimal":
- return "101";
- case "tests.converter.bd.float":
- return "101.36438746";
- case "tests.converter.bd.big":
- return "101666666666666662333337263723628763821638923628193612983618293628763";
- case "tests.converter.bd.bigFloat":
- return "1016666666666666623333372637236287638216389293628763.101666666666666662333337263723628763821638923628193612983618293628763";
- case "tests.converter.bd.hex.lowerX":
- return "0x2F";
- case "tests.converter.bd.hex.upperX":
- return "0X3F";
- }
- return null;
- }
-
- @Override
- public Map<String, String> getProperties() {
- return Collections.emptyMap();
- }
-
- @Override
- public boolean isScannable() {
- return false;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/eadbfe97/core/src/test/java/org/apache/tamaya/core/internal/converters/CurrencyConverterTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/tamaya/core/internal/converters/CurrencyConverterTest.java b/core/src/test/java/org/apache/tamaya/core/internal/converters/CurrencyConverterTest.java
deleted file mode 100644
index 9113ca2..0000000
--- a/core/src/test/java/org/apache/tamaya/core/internal/converters/CurrencyConverterTest.java
+++ /dev/null
@@ -1,154 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tamaya.core.internal.converters;
-
-import org.apache.tamaya.Configuration;
-import org.apache.tamaya.ConfigurationProvider;
-import org.junit.Test;
-
-import java.util.Currency;
-
-import static org.junit.Assert.*;
-
-/**
- * Tests the default converter for bytes.
- */
-public class CurrencyConverterTest {
-
- /**
- * Test conversion. The value are provided by
- * {@link org.apache.tamaya.core.internal.converters.ConverterTestsPropertySource}.
- * @throws Exception
- */
- @Test
- public void testConvert_Currency_Code_CHF() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- Currency valueRead = config.get("tests.converter.currency.code1", Currency.class);
- assertTrue(valueRead != null);
- assertEquals(valueRead, Currency.getInstance("CHF"));
- }
-
- /**
- * Test conversion. The value are provided by
- * {@link org.apache.tamaya.core.internal.converters.ConverterTestsPropertySource}.
- * @throws Exception
- */
- @Test
- public void testConvert_Currency_Code_cHf() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- Currency valueRead = config.get("tests.converter.currency.code2", Currency.class);
- assertTrue(valueRead != null);
- assertEquals(valueRead, Currency.getInstance("CHF"));
- }
-
- /**
- * Test conversion. The value are provided by
- * {@link org.apache.tamaya.core.internal.converters.ConverterTestsPropertySource}.
- * @throws Exception
- */
- @Test
- public void testConvert_Currency_Code_CHF_Whitespace_Before() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- Currency valueRead = config.get("tests.converter.currency.code3", Currency.class);
- assertTrue(valueRead != null);
- assertEquals(valueRead, Currency.getInstance("CHF"));
- }
-
- /**
- * Test conversion. The value are provided by
- * {@link org.apache.tamaya.core.internal.converters.ConverterTestsPropertySource}.
- * @throws Exception
- */
- @Test
- public void testConvert_Currency_Code_CHF_Whitespace_After() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- Currency valueRead = config.get("tests.converter.currency.code4", Currency.class);
- assertTrue(valueRead != null);
- assertEquals(valueRead, Currency.getInstance("CHF"));
- }
-
- /**
- * Test conversion. The value are provided by
- * {@link org.apache.tamaya.core.internal.converters.ConverterTestsPropertySource}.
- * @throws Exception
- */
- @Test
- public void testConvert_Currency_Code_CHF_Whitespace_Around() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- Currency valueRead = config.get("tests.converter.currency.code5", Currency.class);
- assertTrue(valueRead != null);
- assertEquals(valueRead, Currency.getInstance("CHF"));
- }
-
- /**
- * Test conversion. The value are provided by
- * {@link org.apache.tamaya.core.internal.converters.ConverterTestsPropertySource}.
- * @throws Exception
- */
- @Test
- public void testConvert_Currency_Code_Numeric() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- Currency valueRead = config.get("tests.converter.currency.code-numeric1", Currency.class);
- assertTrue(valueRead != null);
- assertEquals(valueRead.getNumericCode(), Currency.getInstance("BGL").getNumericCode());
- valueRead = config.get("tests.converter.currency.code-numeric2", Currency.class);
- assertTrue(valueRead != null);
- assertEquals(valueRead.getNumericCode(), Currency.getInstance("BGL").getNumericCode());
- valueRead = config.get("tests.converter.currency.code-numeric3", Currency.class);
- assertTrue(valueRead != null);
- assertEquals(valueRead.getNumericCode(), Currency.getInstance("BGL").getNumericCode());
- valueRead = config.get("tests.converter.currency.code-numeric4", Currency.class);
- assertTrue(valueRead != null);
- assertEquals(valueRead.getNumericCode(), Currency.getInstance("BGL").getNumericCode());
- }
-
- /**
- * Test conversion. The value are provided by
- * {@link org.apache.tamaya.core.internal.converters.ConverterTestsPropertySource}.
- * @throws Exception
- */
- @Test
- public void testConvert_Currency_Code_Locale() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- Currency valueRead = config.get("tests.converter.currency.code-locale1", Currency.class);
- assertTrue(valueRead != null);
- assertEquals(valueRead.getCurrencyCode(), "EUR");
- valueRead = config.get("tests.converter.currency.code-locale2", Currency.class);
- assertTrue(valueRead != null);
- assertEquals(valueRead.getCurrencyCode(), "EUR");
- valueRead = config.get("tests.converter.currency.code-locale3", Currency.class);
- assertTrue(valueRead != null);
- assertEquals(valueRead.getCurrencyCode(), "EUR");
- valueRead = config.get("tests.converter.currency.code-locale4", Currency.class);
- assertTrue(valueRead != null);
- assertEquals(valueRead.getCurrencyCode(), "EUR");
- }
-
- /**
- * 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();
- Byte valueRead = config.get("tests.converter.byte.foo", Byte.class);
- assertFalse(valueRead!=null);
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/eadbfe97/core/src/test/java/org/apache/tamaya/core/internal/converters/DoubleConverterTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/tamaya/core/internal/converters/DoubleConverterTest.java b/core/src/test/java/org/apache/tamaya/core/internal/converters/DoubleConverterTest.java
deleted file mode 100644
index ee2f33a..0000000
--- a/core/src/test/java/org/apache/tamaya/core/internal/converters/DoubleConverterTest.java
+++ /dev/null
@@ -1,175 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tamaya.core.internal.converters;
-
-import org.apache.tamaya.Configuration;
-import org.apache.tamaya.ConfigurationProvider;
-import org.junit.Test;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-/**
- * Tests the default converter for bytes.
- */
-public class DoubleConverterTest {
-
- /**
- * Test conversion. The value are provided by
- * {@link org.apache.tamaya.core.internal.converters.ConverterTestsPropertySource}.
- * @throws Exception
- */
- @Test
- public void testConvert_Double_Decimal() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- Double valueRead = config.get("tests.converter.double.decimal", Double.class);
- assertTrue(valueRead!=null);
- assertEquals(valueRead.doubleValue(), 1.23456789, 0.0d);
- }
-
- /**
- * Test conversion. The value are provided by
- * {@link org.apache.tamaya.core.internal.converters.ConverterTestsPropertySource}.
- * @throws Exception
- */
- @Test
- public void testConvert_Double_DecimalNegative() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- Double valueRead = config.get("tests.converter.double.decimalNegative", Double.class);
- assertTrue(valueRead!=null);
- assertEquals(valueRead.doubleValue(), -1.23456789, 0.0d);
- }
-
- /**
- * Test conversion. The value are provided by
- * {@link org.apache.tamaya.core.internal.converters.ConverterTestsPropertySource}.
- * @throws Exception
- */
- @Test
- public void testConvert_Double_Integer() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- Double valueRead = config.get("tests.converter.double.integer", Double.class);
- assertTrue(valueRead!=null);
- assertEquals(valueRead.doubleValue(),100d, 0.0d);
- }
-
- /**
- * Test conversion. The value are provided by
- * {@link org.apache.tamaya.core.internal.converters.ConverterTestsPropertySource}.
- * @throws Exception
- */
- @Test
- public void testConvert_Double_Hex1() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- Double valueRead = config.get("tests.converter.double.hex1", Double.class);
- assertTrue(valueRead!=null);
- assertEquals(valueRead.doubleValue(),255d, 0.0d);
- }
-
- /**
- * Test conversion. The value are provided by
- * {@link org.apache.tamaya.core.internal.converters.ConverterTestsPropertySource}.
- * @throws Exception
- */
- @Test
- public void testConvert_Double_Hex2() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- Double valueRead = config.get("tests.converter.double.hex2", Double.class);
- assertTrue(valueRead!=null);
- assertEquals(valueRead.doubleValue(),-255d, 0.0d);
- }
-
- /**
- * Test conversion. The value are provided by
- * {@link org.apache.tamaya.core.internal.converters.ConverterTestsPropertySource}.
- * @throws Exception
- */
- @Test
- public void testConvert_Double_Hex3() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- Double valueRead = config.get("tests.converter.double.hex3", Double.class);
- assertTrue(valueRead!=null);
- }
-
- /**
- * Test conversion. The value are provided by
- * {@link org.apache.tamaya.core.internal.converters.ConverterTestsPropertySource}.
- * @throws Exception
- */
- @Test
- public void testConvert_Double_MinValue() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- Double valueRead = config.get("tests.converter.double.min", Double.class);
- assertTrue(valueRead!=null);
- assertEquals(Double.MIN_VALUE, valueRead.doubleValue(),0.0d);
- }
-
- /**
- * Test conversion. The value are provided by
- * {@link org.apache.tamaya.core.internal.converters.ConverterTestsPropertySource}.
- * @throws Exception
- */
- @Test
- public void testConvert_Double_MaxValue() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- Double valueRead = config.get("tests.converter.double.max", Double.class);
- assertTrue(valueRead!=null);
- assertEquals(Double.MAX_VALUE, valueRead.doubleValue(),0.0d);
- }
-
- /**
- * Test conversion. The value are provided by
- * {@link org.apache.tamaya.core.internal.converters.ConverterTestsPropertySource}.
- * @throws Exception
- */
- @Test
- public void testConvert_Double_NaNValue() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- Double valueRead = config.get("tests.converter.double.nan", Double.class);
- assertTrue(valueRead!=null);
- assertEquals(Double.NaN, valueRead.doubleValue(),0.0d);
- }
-
- /**
- * Test conversion. The value are provided by
- * {@link org.apache.tamaya.core.internal.converters.ConverterTestsPropertySource}.
- * @throws Exception
- */
- @Test
- public void testConvert_Double_PositiveInfinityValue() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- Double valueRead = config.get("tests.converter.double.pi", Double.class);
- assertTrue(valueRead!=null);
- assertEquals(Double.POSITIVE_INFINITY, valueRead.doubleValue(),0.0d);
- }
-
- /**
- * Test conversion. The value are provided by
- * {@link org.apache.tamaya.core.internal.converters.ConverterTestsPropertySource}.
- * @throws Exception
- */
- @Test
- public void testConvert_Double_NegativeInfinityValue() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- Double valueRead = config.get("tests.converter.double.ni", Double.class);
- assertTrue(valueRead!=null);
- assertEquals(Double.NEGATIVE_INFINITY, valueRead.doubleValue(),0.0d);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/eadbfe97/core/src/test/java/org/apache/tamaya/core/internal/converters/EnumConverterTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/tamaya/core/internal/converters/EnumConverterTest.java b/core/src/test/java/org/apache/tamaya/core/internal/converters/EnumConverterTest.java
deleted file mode 100644
index 208baa0..0000000
--- a/core/src/test/java/org/apache/tamaya/core/internal/converters/EnumConverterTest.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tamaya.core.internal.converters;
-
-import org.apache.tamaya.ConfigurationProvider;
-import org.apache.tamaya.TypeLiteral;
-import org.apache.tamaya.spi.ConversionContext;
-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 EnumConverter testConverter = new EnumConverter(RoundingMode.class);
-
- private ConversionContext DUMMY_CONTEXT = new ConversionContext.Builder("someKey", TypeLiteral.of(Enum.class)).build();
-
- @Test
- public void testConvert() {
- assertEquals(testConverter.convert(RoundingMode.CEILING.toString(),
- DUMMY_CONTEXT), RoundingMode.CEILING);
- }
-
- @Test
- public void testConvert_LowerCase() {
- assertEquals(testConverter.convert("ceiling", DUMMY_CONTEXT), RoundingMode.CEILING);
- }
-
- @Test
- public void testConvert_MixedCase() {
- assertEquals(testConverter.convert("CeiLinG", DUMMY_CONTEXT), RoundingMode.CEILING);
- }
-
- @Test
- public void testConvert_OtherValue() {
- assertNull(testConverter.convert("fooBars", DUMMY_CONTEXT));
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/eadbfe97/core/src/test/java/org/apache/tamaya/core/internal/converters/FloatConverterTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/tamaya/core/internal/converters/FloatConverterTest.java b/core/src/test/java/org/apache/tamaya/core/internal/converters/FloatConverterTest.java
deleted file mode 100644
index 98ea720..0000000
--- a/core/src/test/java/org/apache/tamaya/core/internal/converters/FloatConverterTest.java
+++ /dev/null
@@ -1,176 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tamaya.core.internal.converters;
-
-import org.apache.tamaya.Configuration;
-import org.apache.tamaya.ConfigurationProvider;
-import org.junit.Test;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-/**
- * Tests the default converter for bytes.
- */
-public class FloatConverterTest {
-
- /**
- * Test conversion. The value are provided by
- * {@link ConverterTestsPropertySource}.
- * @throws Exception
- */
- @Test
- public void testConvert_Float_Decimal() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- Float valueRead = config.get("tests.converter.float.decimal", Float.class);
- assertTrue(valueRead!=null);
- assertEquals(valueRead.floatValue(), 1.23456789f, 0.0f);
- }
-
- /**
- * Test conversion. The value are provided by
- * {@link ConverterTestsPropertySource}.
- * @throws Exception
- */
- @Test
- public void testConvert_Float_DecimalNegative() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- Float valueRead = config.get("tests.converter.float.decimalNegative", Float.class);
- assertTrue(valueRead!=null);
- assertEquals(valueRead.floatValue(), -1.23456789f, 0.0f);
- }
-
- /**
- * Test conversion. The value are provided by
- * {@link ConverterTestsPropertySource}.
- * @throws Exception
- */
- @Test
- public void testConvert_Float_Integer() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- Float valueRead = config.get("tests.converter.float.integer", Float.class);
- assertTrue(valueRead!=null);
- assertEquals(valueRead.floatValue(),100f, 0.0f);
- }
-
- /**
- * Test conversion. The value are provided by
- * {@link ConverterTestsPropertySource}.
- * @throws Exception
- */
- @Test
- public void testConvert_Float_Hex1() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- Float valueRead = config.get("tests.converter.float.hex1", Float.class);
- assertTrue(valueRead!=null);
- assertEquals(valueRead.floatValue(),255f, 0.0f);
- }
-
- /**
- * Test conversion. The value are provided by
- * {@link ConverterTestsPropertySource}.
- * @throws Exception
- */
- @Test
- public void testConvert_Float_Hex2() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- Float valueRead = config.get("tests.converter.float.hex2", Float.class);
- assertTrue(valueRead!=null);
- assertEquals(valueRead.floatValue(),-255f, 0.0f);
- }
-
- /**
- * Test conversion. The value are provided by
- * {@link ConverterTestsPropertySource}.
- * @throws Exception
- */
- @Test
- public void testConvert_Float_Hex3() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- Float valueRead = config.get("tests.converter.float.hex3", Float.class);
- assertTrue(valueRead!=null);
- assertEquals(valueRead.floatValue(),255f, 0.0f);
- }
-
- /**
- * Test conversion. The value are provided by
- * {@link ConverterTestsPropertySource}.
- * @throws Exception
- */
- @Test
- public void testConvert_Float_MinValue() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- Float valueRead = config.get("tests.converter.float.min", Float.class);
- assertTrue(valueRead!=null);
- assertEquals(Float.MIN_VALUE, valueRead.floatValue(),0.0f);
- }
-
- /**
- * Test conversion. The value are provided by
- * {@link ConverterTestsPropertySource}.
- * @throws Exception
- */
- @Test
- public void testConvert_Float_MaxValue() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- Float valueRead = config.get("tests.converter.float.max", Float.class);
- assertTrue(valueRead!=null);
- assertEquals(Float.MAX_VALUE, valueRead.floatValue(),0.0f);
- }
-
- /**
- * Test conversion. The value are provided by
- * {@link ConverterTestsPropertySource}.
- * @throws Exception
- */
- @Test
- public void testConvert_Float_NaNValue() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- Float valueRead = config.get("tests.converter.float.nan", Float.class);
- assertTrue(valueRead!=null);
- assertEquals(Float.NaN, valueRead.floatValue(),0.0f);
- }
-
- /**
- * Test conversion. The value are provided by
- * {@link ConverterTestsPropertySource}.
- * @throws Exception
- */
- @Test
- public void testConvert_Float_PositiveInfinityValue() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- Float valueRead = config.get("tests.converter.float.pi", Float.class);
- assertTrue(valueRead!=null);
- assertEquals(Float.POSITIVE_INFINITY, valueRead.floatValue(),0.0f);
- }
-
- /**
- * Test conversion. The value are provided by
- * {@link ConverterTestsPropertySource}.
- * @throws Exception
- */
- @Test
- public void testConvert_Float_NegativeInfinityValue() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- Float valueRead = config.get("tests.converter.float.ni", Float.class);
- assertTrue(valueRead!=null);
- assertEquals(Float.NEGATIVE_INFINITY, valueRead.floatValue(),0.0f);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/eadbfe97/core/src/test/java/org/apache/tamaya/core/internal/converters/IntegerConverterTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/tamaya/core/internal/converters/IntegerConverterTest.java b/core/src/test/java/org/apache/tamaya/core/internal/converters/IntegerConverterTest.java
deleted file mode 100644
index 03b0f12..0000000
--- a/core/src/test/java/org/apache/tamaya/core/internal/converters/IntegerConverterTest.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tamaya.core.internal.converters;
-
-import org.apache.tamaya.Configuration;
-import org.apache.tamaya.ConfigurationProvider;
-import org.junit.Test;
-
-import static org.junit.Assert.*;
-
-/**
- * Tests the default converter for Integers.
- */
-public class IntegerConverterTest {
-
- /**
- * Test conversion. The value are provided by
- * {@link org.apache.tamaya.core.internal.converters.ConverterTestsPropertySource}.
- * @throws Exception
- */
- @Test
- public void testConvert_Integer_Decimal() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- Integer valueRead = config.get("tests.converter.integer.decimal", Integer.class);
- assertTrue(valueRead != null);
- assertEquals(valueRead.intValue(), 101);
- }
-
- /**
- * Test conversion. The value are provided by
- * {@link org.apache.tamaya.core.internal.converters.ConverterTestsPropertySource}.
- * @throws Exception
- */
- @Test
- public void testConvert_Integer_Octal() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- Integer valueRead = config.get("tests.converter.integer.octal", Integer.class);
- assertTrue(valueRead != null);
- assertEquals(valueRead.intValue(), Integer.decode("02").intValue());
- }
-
- /**
- * Test conversion. The value are provided by
- * {@link org.apache.tamaya.core.internal.converters.ConverterTestsPropertySource}.
- * @throws Exception
- */
- @Test
- public void testConvert_Integer_Hex() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- Integer valueRead = config.get("tests.converter.integer.hex.lowerX", Integer.class);
- assertTrue(valueRead != null);
- assertEquals(valueRead.intValue(), Integer.decode("0x2F").intValue());
- valueRead = config.get("tests.converter.integer.hex.upperX", Integer.class);
- assertTrue(valueRead != null);
- assertEquals(valueRead.intValue(), Integer.decode("0X3F").intValue());
- }
-
- /**
- * 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();
- Integer valueRead = config.get("tests.converter.integer.foo", Integer.class);
- assertFalse(valueRead != null);
- }
-
- /**
- * Test conversion. The value are provided by
- * {@link ConverterTestsPropertySource}.
- * @throws Exception
- */
- @Test
- public void testConvert_Integer_MinValue() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- Integer valueRead = config.get("tests.converter.integer.min", Integer.class);
- assertTrue(valueRead != null);
- assertEquals(Integer.MIN_VALUE, valueRead.intValue());
- }
-
- /**
- * Test conversion. The value are provided by
- * {@link ConverterTestsPropertySource}.
- * @throws Exception
- */
- @Test
- public void testConvert_Integer_MaxValue() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- Integer valueRead = config.get("tests.converter.integer.max", Integer.class);
- assertTrue(valueRead != null);
- assertEquals(Integer.MAX_VALUE, valueRead.intValue());
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/eadbfe97/core/src/test/java/org/apache/tamaya/core/internal/converters/LongConverterTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/tamaya/core/internal/converters/LongConverterTest.java b/core/src/test/java/org/apache/tamaya/core/internal/converters/LongConverterTest.java
deleted file mode 100644
index 0df6b09..0000000
--- a/core/src/test/java/org/apache/tamaya/core/internal/converters/LongConverterTest.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tamaya.core.internal.converters;
-
-import org.apache.tamaya.Configuration;
-import org.apache.tamaya.ConfigurationProvider;
-import org.junit.Test;
-
-import static org.junit.Assert.*;
-
-/**
- * Tests the default converter for Longs.
- */
-public class LongConverterTest {
-
- /**
- * Test conversion. The value are provided by
- * {@link ConverterTestsPropertySource}.
- * @throws Exception
- */
- @Test
- public void testConvert_Long_Decimal() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- Long valueRead = config.get("tests.converter.long.decimal", Long.class);
- assertTrue(valueRead != null);
- assertEquals(valueRead.intValue(), 101);
- }
-
- /**
- * Test conversion. The value are provided by
- * {@link ConverterTestsPropertySource}.
- * @throws Exception
- */
- @Test
- public void testConvert_Long_Octal() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- Long valueRead = config.get("tests.converter.long.octal", Long.class);
- assertTrue(valueRead != null);
- assertEquals(valueRead.intValue(), Long.decode("02").intValue());
- }
-
- /**
- * Test conversion. The value are provided by
- * {@link ConverterTestsPropertySource}.
- * @throws Exception
- */
- @Test
- public void testConvert_Long_Hex() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- Long valueRead = config.get("tests.converter.long.hex.lowerX", Long.class);
- assertTrue(valueRead != null);
- assertEquals(valueRead.intValue(), Long.decode("0x2F").intValue());
- valueRead = config.get("tests.converter.long.hex.upperX", Long.class);
- assertTrue(valueRead != null);
- assertEquals(valueRead.intValue(), Long.decode("0X3F").intValue());
- }
-
- /**
- * Test conversion. The value are provided by
- * {@link ConverterTestsPropertySource}.
- * @throws Exception
- */
- @Test
- public void testConvert_NotPresent() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- Long valueRead = config.get("tests.converter.long.foo", Long.class);
- assertFalse(valueRead != null);
- }
-
- /**
- * Test conversion. The value are provided by
- * {@link org.apache.tamaya.core.internal.converters.ConverterTestsPropertySource}.
- * @throws Exception
- */
- @Test
- public void testConvert_Long_MinValue() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- Long valueRead = config.get("tests.converter.long.min", Long.class);
- assertTrue(valueRead != null);
- assertEquals(Long.MIN_VALUE, valueRead.longValue());
- }
-
- /**
- * Test conversion. The value are provided by
- * {@link org.apache.tamaya.core.internal.converters.ConverterTestsPropertySource}.
- * @throws Exception
- */
- @Test
- public void testConvert_Long_MaxValue() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- Long valueRead = config.get("tests.converter.long.max", Long.class);
- assertTrue(valueRead != null);
- assertEquals(Long.MAX_VALUE, valueRead.longValue());
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/eadbfe97/core/src/test/java/org/apache/tamaya/core/internal/converters/NumberConverterTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/tamaya/core/internal/converters/NumberConverterTest.java b/core/src/test/java/org/apache/tamaya/core/internal/converters/NumberConverterTest.java
deleted file mode 100644
index 25e6fd9..0000000
--- a/core/src/test/java/org/apache/tamaya/core/internal/converters/NumberConverterTest.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tamaya.core.internal.converters;
-
-import org.apache.tamaya.Configuration;
-import org.apache.tamaya.ConfigurationProvider;
-import org.junit.Test;
-
-import java.math.BigDecimal;
-
-import static org.junit.Assert.*;
-
-/**
- * Tests the default converter for Number.
- */
-public class NumberConverterTest {
-
- /**
- * Test conversion. The value are provided by
- * {@link ConverterTestsPropertySource}.
- * @throws Exception
- */
- @Test
- public void testConvert_Decimal() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- Number valueRead = config.get("tests.converter.bd.decimal", Number.class);
- assertTrue(valueRead!=null);
- assertEquals(valueRead, Long.valueOf(101));
- }
-
-
- /**
- * Test conversion. The value are provided by
- * {@link ConverterTestsPropertySource}.
- * @throws Exception
- */
- @Test
- public void testConvert_Hex() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- Number valueRead = config.get("tests.converter.bd.hex.lowerX", Number.class);
- assertTrue(valueRead!=null);
- assertEquals(valueRead, Long.valueOf("47"));
- valueRead = config.get("tests.converter.bd.hex.upperX", Number.class);
- assertTrue(valueRead!=null);
- assertEquals(valueRead, Long.valueOf("63"));
- }
-
- /**
- * Test conversion. The value are provided by
- * {@link ConverterTestsPropertySource}.
- * @throws Exception
- */
- @Test
- public void testConvert_NotPresent() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- Number valueRead = config.get("tests.converter.bd.foo", Number.class);
- assertFalse(valueRead!=null);
- }
-
- /**
- * Test conversion. The value are provided by
- * {@link org.apache.tamaya.core.internal.converters.ConverterTestsPropertySource}.
- * @throws Exception
- */
- @Test
- public void testConvert_BigValue() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- Number valueRead = config.get("tests.converter.bd.big", Number.class);
- assertTrue(valueRead!=null);
- assertEquals(new BigDecimal("101666666666666662333337263723628763821638923628193612983618293628763"),
- valueRead);
- }
-
- /**
- * Test conversion. The value are provided by
- * {@link org.apache.tamaya.core.internal.converters.ConverterTestsPropertySource}.
- * @throws Exception
- */
- @Test
- public void testConvert_BigFloatValue() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- Number valueRead = config.get("tests.converter.bd.bigFloat", Number.class);
- assertTrue(valueRead!=null);
- assertEquals(new BigDecimal("1016666666666666623333372637236287638216389293628763.1016666666666666623333372" +
- "63723628763821638923628193612983618293628763"), valueRead);
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/eadbfe97/core/src/test/java/org/apache/tamaya/core/internal/converters/ShortConverterTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/tamaya/core/internal/converters/ShortConverterTest.java b/core/src/test/java/org/apache/tamaya/core/internal/converters/ShortConverterTest.java
deleted file mode 100644
index 193a92e..0000000
--- a/core/src/test/java/org/apache/tamaya/core/internal/converters/ShortConverterTest.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tamaya.core.internal.converters;
-
-import org.apache.tamaya.Configuration;
-import org.apache.tamaya.ConfigurationProvider;
-import org.junit.Test;
-
-import static org.junit.Assert.*;
-
-/**
- * Tests the default converter for Shorts.
- */
-public class ShortConverterTest {
-
- /**
- * Test conversion. The value are provided by
- * {@link ConverterTestsPropertySource}.
- * @throws Exception
- */
- @Test
- public void testConvert_Short_Decimal() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- Short valueRead = config.get("tests.converter.short.decimal", Short.class);
- assertTrue(valueRead != null);
- assertEquals(valueRead.intValue(), 101);
- }
-
- /**
- * Test conversion. The value are provided by
- * {@link ConverterTestsPropertySource}.
- * @throws Exception
- */
- @Test
- public void testConvert_Short_Octal() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- Short valueRead = config.get("tests.converter.short.octal", Short.class);
- assertTrue(valueRead != null);
- assertEquals(valueRead.intValue(), Short.decode("02").intValue());
- }
-
- /**
- * Test conversion. The value are provided by
- * {@link ConverterTestsPropertySource}.
- * @throws Exception
- */
- @Test
- public void testConvert_Short_Hex() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- Short valueRead = config.get("tests.converter.short.hex.lowerX", Short.class);
- assertTrue(valueRead != null);
- assertEquals(valueRead.intValue(), Short.decode("0x2F").intValue());
- valueRead = config.get("tests.converter.short.hex.upperX", Short.class);
- assertTrue(valueRead != null);
- assertEquals(valueRead.intValue(), Short.decode("0X3F").intValue());
- }
-
- /**
- * Test conversion. The value are provided by
- * {@link ConverterTestsPropertySource}.
- * @throws Exception
- */
- @Test
- public void testConvert_NotPresent() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- Short valueRead = config.get("tests.converter.short.foo", Short.class);
- assertFalse(valueRead != null);
- }
-
- /**
- * Test conversion. The value are provided by
- * {@link org.apache.tamaya.core.internal.converters.ConverterTestsPropertySource}.
- * @throws Exception
- */
- @Test
- public void testConvert_Short_MinValue() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- Short valueRead = config.get("tests.converter.short.min", Short.class);
- assertTrue(valueRead != null);
- assertEquals(Short.MIN_VALUE, valueRead.intValue());
- }
-
- /**
- * Test conversion. The value are provided by
- * {@link org.apache.tamaya.core.internal.converters.ConverterTestsPropertySource}.
- * @throws Exception
- */
- @Test
- public void testConvert_Short_MaxValue() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- Short valueRead = config.get("tests.converter.short.max", Short.class);
- assertTrue(valueRead != null);
- assertEquals(Short.MAX_VALUE, valueRead.intValue());
- }
-}
\ No newline at end of file