Repository: incubator-tamaya
Updated Branches:
refs/heads/master 7d2b5a873 -> 1b469982e
TAMAYA-274 Added tests and improvements for java.tim converters.
Project: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/commit/1b469982
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/tree/1b469982
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/diff/1b469982
Branch: refs/heads/master
Commit: 1b469982e745b8ab3bb510d13b6a3814ba9b0316
Parents: 7d2b5a8
Author: Anatole Tresch <[email protected]>
Authored: Tue Oct 3 00:43:46 2017 +0200
Committer: Anatole Tresch <[email protected]>
Committed: Tue Oct 3 00:43:46 2017 +0200
----------------------------------------------------------------------
.../internal/converters/DurationConverter.java | 8 +-
.../internal/converters/InstantConverter.java | 8 +-
.../internal/converters/LocalDateConverter.java | 8 +-
.../converters/LocalDateTimeConverter.java | 8 +-
.../internal/converters/LocalTimeConverter.java | 8 +-
.../converters/OffsetDateTimeConverter.java | 8 +-
.../converters/OffsetTimeConverter.java | 8 +-
.../converters/DurationConverterTest.java | 83 ++++++++++++++++++++
.../converters/InstantConverterTest.java | 58 ++++++++++++++
.../converters/LocalDateConverterTest.java | 57 ++++++++++++++
.../converters/LocalDateTimeConverterTest.java | 57 ++++++++++++++
.../converters/LocalTimeConverterTest.java | 57 ++++++++++++++
.../converters/OffsetDateTimeConverterTest.java | 57 ++++++++++++++
.../converters/OffsetTimeConverterTest.java | 56 +++++++++++++
.../internal/converters/PathConverterTest.java | 61 ++++++++++++++
15 files changed, 535 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/1b469982/code/core/src/main/java/org/apache/tamaya/core/internal/converters/DurationConverter.java
----------------------------------------------------------------------
diff --git
a/code/core/src/main/java/org/apache/tamaya/core/internal/converters/DurationConverter.java
b/code/core/src/main/java/org/apache/tamaya/core/internal/converters/DurationConverter.java
index 55b81ad..f258186 100644
---
a/code/core/src/main/java/org/apache/tamaya/core/internal/converters/DurationConverter.java
+++
b/code/core/src/main/java/org/apache/tamaya/core/internal/converters/DurationConverter.java
@@ -24,6 +24,7 @@ import org.osgi.service.component.annotations.Component;
import java.time.Duration;
import java.time.temporal.ChronoUnit;
+import java.util.logging.Level;
import java.util.logging.Logger;
/**
@@ -38,7 +39,12 @@ public class DurationConverter implements
PropertyConverter<Duration> {
public Duration convert(String value, ConversionContext context) {
context.addSupportedFormats(getClass(),
Duration.of(1234, ChronoUnit.SECONDS).toString());
- return Duration.parse(value);
+ try {
+ return Duration.parse(value);
+ }catch(Exception e){
+ LOG.log(Level.FINEST, e, () -> "Cannot parse Duration: " + value);
+ return null;
+ }
}
@Override
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/1b469982/code/core/src/main/java/org/apache/tamaya/core/internal/converters/InstantConverter.java
----------------------------------------------------------------------
diff --git
a/code/core/src/main/java/org/apache/tamaya/core/internal/converters/InstantConverter.java
b/code/core/src/main/java/org/apache/tamaya/core/internal/converters/InstantConverter.java
index 47489c5..4198b72 100644
---
a/code/core/src/main/java/org/apache/tamaya/core/internal/converters/InstantConverter.java
+++
b/code/core/src/main/java/org/apache/tamaya/core/internal/converters/InstantConverter.java
@@ -23,6 +23,7 @@ import org.apache.tamaya.spi.PropertyConverter;
import org.osgi.service.component.annotations.Component;
import java.time.Instant;
+import java.util.logging.Level;
import java.util.logging.Logger;
/**
@@ -36,7 +37,12 @@ public class InstantConverter implements
PropertyConverter<Instant> {
@Override
public Instant convert(String value, ConversionContext context) {
context.addSupportedFormats(getClass(), Instant.now().toString());
- return Instant.parse(value);
+ try{
+ return Instant.parse(value);
+ }catch(Exception e){
+ LOG.log(Level.FINEST, e, () -> "Cannot parse Instant: " + value);
+ return null;
+ }
}
@Override
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/1b469982/code/core/src/main/java/org/apache/tamaya/core/internal/converters/LocalDateConverter.java
----------------------------------------------------------------------
diff --git
a/code/core/src/main/java/org/apache/tamaya/core/internal/converters/LocalDateConverter.java
b/code/core/src/main/java/org/apache/tamaya/core/internal/converters/LocalDateConverter.java
index 06bd9b2..3bf9b67 100644
---
a/code/core/src/main/java/org/apache/tamaya/core/internal/converters/LocalDateConverter.java
+++
b/code/core/src/main/java/org/apache/tamaya/core/internal/converters/LocalDateConverter.java
@@ -23,6 +23,7 @@ import org.apache.tamaya.spi.PropertyConverter;
import org.osgi.service.component.annotations.Component;
import java.time.LocalDate;
+import java.util.logging.Level;
import java.util.logging.Logger;
/**
@@ -36,7 +37,12 @@ public class LocalDateConverter implements
PropertyConverter<LocalDate> {
@Override
public LocalDate convert(String value, ConversionContext context) {
context.addSupportedFormats(getClass(), LocalDate.now().toString());
- return LocalDate.parse(value);
+ try{
+ return LocalDate.parse(value);
+ }catch(Exception e){
+ LOG.log(Level.FINEST, e, () -> "Cannot parse LocalDate: " + value);
+ return null;
+ }
}
@Override
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/1b469982/code/core/src/main/java/org/apache/tamaya/core/internal/converters/LocalDateTimeConverter.java
----------------------------------------------------------------------
diff --git
a/code/core/src/main/java/org/apache/tamaya/core/internal/converters/LocalDateTimeConverter.java
b/code/core/src/main/java/org/apache/tamaya/core/internal/converters/LocalDateTimeConverter.java
index 589ee78..eb14000 100644
---
a/code/core/src/main/java/org/apache/tamaya/core/internal/converters/LocalDateTimeConverter.java
+++
b/code/core/src/main/java/org/apache/tamaya/core/internal/converters/LocalDateTimeConverter.java
@@ -23,6 +23,7 @@ import org.apache.tamaya.spi.PropertyConverter;
import org.osgi.service.component.annotations.Component;
import java.time.LocalDateTime;
+import java.util.logging.Level;
import java.util.logging.Logger;
/**
@@ -36,7 +37,12 @@ public class LocalDateTimeConverter implements
PropertyConverter<LocalDateTime>
@Override
public LocalDateTime convert(String value, ConversionContext context) {
context.addSupportedFormats(getClass(),
LocalDateTime.now().toString());
- return LocalDateTime.parse(value);
+ try{
+ return LocalDateTime.parse(value);
+ }catch(Exception e){
+ LOG.log(Level.FINEST, e, () -> "Cannot parse LocalDateTime: " +
value);
+ return null;
+ }
}
@Override
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/1b469982/code/core/src/main/java/org/apache/tamaya/core/internal/converters/LocalTimeConverter.java
----------------------------------------------------------------------
diff --git
a/code/core/src/main/java/org/apache/tamaya/core/internal/converters/LocalTimeConverter.java
b/code/core/src/main/java/org/apache/tamaya/core/internal/converters/LocalTimeConverter.java
index a8c7ac6..bf7d8ab 100644
---
a/code/core/src/main/java/org/apache/tamaya/core/internal/converters/LocalTimeConverter.java
+++
b/code/core/src/main/java/org/apache/tamaya/core/internal/converters/LocalTimeConverter.java
@@ -23,6 +23,7 @@ import org.apache.tamaya.spi.PropertyConverter;
import org.osgi.service.component.annotations.Component;
import java.time.LocalTime;
+import java.util.logging.Level;
import java.util.logging.Logger;
/**
@@ -36,7 +37,12 @@ public class LocalTimeConverter implements
PropertyConverter<LocalTime> {
@Override
public LocalTime convert(String value, ConversionContext context) {
context.addSupportedFormats(getClass(), LocalTime.now().toString());
- return LocalTime.parse(value);
+ try{
+ return LocalTime.parse(value);
+ }catch(Exception e){
+ LOG.log(Level.FINEST, e, () -> "Cannot parse LocalTime: " + value);
+ return null;
+ }
}
@Override
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/1b469982/code/core/src/main/java/org/apache/tamaya/core/internal/converters/OffsetDateTimeConverter.java
----------------------------------------------------------------------
diff --git
a/code/core/src/main/java/org/apache/tamaya/core/internal/converters/OffsetDateTimeConverter.java
b/code/core/src/main/java/org/apache/tamaya/core/internal/converters/OffsetDateTimeConverter.java
index 980113e..9486640 100644
---
a/code/core/src/main/java/org/apache/tamaya/core/internal/converters/OffsetDateTimeConverter.java
+++
b/code/core/src/main/java/org/apache/tamaya/core/internal/converters/OffsetDateTimeConverter.java
@@ -24,6 +24,7 @@ import org.osgi.service.component.annotations.Component;
import java.time.LocalDate;
import java.time.OffsetDateTime;
+import java.util.logging.Level;
import java.util.logging.Logger;
/**
@@ -37,7 +38,12 @@ public class OffsetDateTimeConverter implements
PropertyConverter<OffsetDateTime
@Override
public OffsetDateTime convert(String value, ConversionContext context) {
context.addSupportedFormats(getClass(),
OffsetDateTime.now().toString());
- return OffsetDateTime.parse(value);
+ try{
+ return OffsetDateTime.parse(value);
+ }catch(Exception e){
+ LOG.log(Level.FINEST, e, () -> "Cannot parse OffsetDateTime: " +
value);
+ return null;
+ }
}
@Override
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/1b469982/code/core/src/main/java/org/apache/tamaya/core/internal/converters/OffsetTimeConverter.java
----------------------------------------------------------------------
diff --git
a/code/core/src/main/java/org/apache/tamaya/core/internal/converters/OffsetTimeConverter.java
b/code/core/src/main/java/org/apache/tamaya/core/internal/converters/OffsetTimeConverter.java
index 583ffe0..ce8ebed 100644
---
a/code/core/src/main/java/org/apache/tamaya/core/internal/converters/OffsetTimeConverter.java
+++
b/code/core/src/main/java/org/apache/tamaya/core/internal/converters/OffsetTimeConverter.java
@@ -24,6 +24,7 @@ import org.osgi.service.component.annotations.Component;
import java.time.OffsetDateTime;
import java.time.OffsetTime;
+import java.util.logging.Level;
import java.util.logging.Logger;
/**
@@ -37,7 +38,12 @@ public class OffsetTimeConverter implements
PropertyConverter<OffsetTime> {
@Override
public OffsetTime convert(String value, ConversionContext context) {
context.addSupportedFormats(getClass(), OffsetTime.now().toString());
- return OffsetTime.parse(value);
+ try{
+ return OffsetTime.parse(value);
+ }catch(Exception e){
+ LOG.log(Level.FINEST, e, () -> "Cannot parse OffsetTime: " +
value);
+ return null;
+ }
}
@Override
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/1b469982/code/core/src/test/java/org/apache/tamaya/core/internal/converters/DurationConverterTest.java
----------------------------------------------------------------------
diff --git
a/code/core/src/test/java/org/apache/tamaya/core/internal/converters/DurationConverterTest.java
b/code/core/src/test/java/org/apache/tamaya/core/internal/converters/DurationConverterTest.java
new file mode 100644
index 0000000..33c1bba
--- /dev/null
+++
b/code/core/src/test/java/org/apache/tamaya/core/internal/converters/DurationConverterTest.java
@@ -0,0 +1,83 @@
+/*
+ * 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.ConversionContext;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.runners.MockitoJUnitRunner;
+
+import java.time.Duration;
+import java.time.format.DateTimeFormatterBuilder;
+import java.time.temporal.ChronoField;
+import java.time.temporal.Temporal;
+import java.time.temporal.TemporalUnit;
+
+import static org.junit.Assert.*;
+
+/**
+ * Created by atsti on 02.10.2017.
+ */
+@RunWith(MockitoJUnitRunner.class)
+public class DurationConverterTest {
+
+ @Mock
+ ConversionContext context;
+
+ /**
+ * Examples:
+ * <pre>
+ * "PT20.345S" -- parses as "20.345 seconds"
+ * "PT15M" -- parses as "15 minutes" (where a minute is 60 seconds)
+ * "PT10H" -- parses as "10 hours" (where an hour is 3600 seconds)
+ * "P2D" -- parses as "2 days" (where a day is 24 hours or 86400
seconds)
+ * "P2DT3H4M" -- parses as "2 days, 3 hours and 4 minutes"
+ * "P-6H3M" -- parses as "-6 hours and +3 minutes"
+ * "-P6H3M" -- parses as "-6 hours and -3 minutes"
+ * "-P-6H+3M" -- parses as "+6 hours and -3 minutes"
+ * </pre>
+ * @throws Exception
+ */
+ @Test
+ public void convert() throws Exception {
+ DurationConverter conv = new DurationConverter();
+ Duration duration = conv.convert("PT20.345S", context);
+ assertEquals(duration, Duration.parse("PT20.345S"));
+ duration = conv.convert("PT15M", context);
+ assertEquals(duration, Duration.parse("PT15M"));
+ duration = conv.convert("PT10H", context);
+ assertEquals(duration, Duration.parse("PT10H"));
+ duration = conv.convert("P2D", context);
+ assertEquals(duration, Duration.parse("P2D"));
+ duration = conv.convert("P2DT3H4M", context);
+ assertEquals(duration, Duration.parse("P2DT3H4M"));
+ duration = conv.convert("foo", context);
+ assertNull(duration);
+ }
+
+ @Test
+ public void equalsAndHashcode() throws Exception {
+ DurationConverter conv1 = new DurationConverter();
+ DurationConverter conv2 = new DurationConverter();
+ assertEquals(conv1, conv2);
+ assertEquals(conv1.hashCode(), conv2.hashCode());
+ }
+
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/1b469982/code/core/src/test/java/org/apache/tamaya/core/internal/converters/InstantConverterTest.java
----------------------------------------------------------------------
diff --git
a/code/core/src/test/java/org/apache/tamaya/core/internal/converters/InstantConverterTest.java
b/code/core/src/test/java/org/apache/tamaya/core/internal/converters/InstantConverterTest.java
new file mode 100644
index 0000000..1bf4080
--- /dev/null
+++
b/code/core/src/test/java/org/apache/tamaya/core/internal/converters/InstantConverterTest.java
@@ -0,0 +1,58 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tamaya.core.internal.converters;
+
+import org.apache.tamaya.spi.ConversionContext;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.runners.MockitoJUnitRunner;
+
+import java.time.Instant;
+import java.time.format.DateTimeFormatter;
+
+import static org.junit.Assert.*;
+
+/**
+ * Created by atsti on 02.10.2017.
+ */
+@RunWith(MockitoJUnitRunner.class)
+public class InstantConverterTest {
+
+ @Mock
+ ConversionContext context;
+
+ @Test
+ public void convert() throws Exception {
+ InstantConverter conv = new InstantConverter();
+ Instant value = conv.convert("2007-12-03T10:15:30.00Z", context);
+ assertEquals(value, Instant.parse("2007-12-03T10:15:30.00Z"));
+ value = conv.convert("foo", context);
+ assertNull(value);
+ }
+
+ @Test
+ public void equalsAndHashcode() throws Exception {
+ InstantConverter conv1 = new InstantConverter();
+ InstantConverter conv2 = new InstantConverter();
+ assertEquals(conv1, conv2);
+ assertEquals(conv1.hashCode(), conv2.hashCode());
+ }
+
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/1b469982/code/core/src/test/java/org/apache/tamaya/core/internal/converters/LocalDateConverterTest.java
----------------------------------------------------------------------
diff --git
a/code/core/src/test/java/org/apache/tamaya/core/internal/converters/LocalDateConverterTest.java
b/code/core/src/test/java/org/apache/tamaya/core/internal/converters/LocalDateConverterTest.java
new file mode 100644
index 0000000..752699d
--- /dev/null
+++
b/code/core/src/test/java/org/apache/tamaya/core/internal/converters/LocalDateConverterTest.java
@@ -0,0 +1,57 @@
+/*
+ * 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.ConversionContext;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.runners.MockitoJUnitRunner;
+
+import java.time.LocalDate;
+
+import static org.junit.Assert.*;
+
+/**
+ * Created by atsti on 02.10.2017.
+ */
+@RunWith(MockitoJUnitRunner.class)
+public class LocalDateConverterTest {
+
+ @Mock
+ ConversionContext context;
+
+ @Test
+ public void convert() throws Exception {
+ LocalDateConverter conv = new LocalDateConverter();
+ LocalDate value = conv.convert("2007-12-03", context);
+ assertEquals(value, LocalDate.parse("2007-12-03"));
+ value = conv.convert("foo", context);
+ assertNull(value);
+ }
+
+ @Test
+ public void equalsAndHashcode() throws Exception {
+ LocalDateConverter conv1 = new LocalDateConverter();
+ LocalDateConverter conv2 = new LocalDateConverter();
+ assertEquals(conv1, conv2);
+ assertEquals(conv1.hashCode(), conv2.hashCode());
+ }
+
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/1b469982/code/core/src/test/java/org/apache/tamaya/core/internal/converters/LocalDateTimeConverterTest.java
----------------------------------------------------------------------
diff --git
a/code/core/src/test/java/org/apache/tamaya/core/internal/converters/LocalDateTimeConverterTest.java
b/code/core/src/test/java/org/apache/tamaya/core/internal/converters/LocalDateTimeConverterTest.java
new file mode 100644
index 0000000..945682a
--- /dev/null
+++
b/code/core/src/test/java/org/apache/tamaya/core/internal/converters/LocalDateTimeConverterTest.java
@@ -0,0 +1,57 @@
+/*
+ * 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.ConversionContext;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.runners.MockitoJUnitRunner;
+
+import java.time.LocalDateTime;
+
+import static org.junit.Assert.*;
+
+/**
+ * Created by atsti on 02.10.2017.
+ */
+@RunWith(MockitoJUnitRunner.class)
+public class LocalDateTimeConverterTest {
+
+ @Mock
+ ConversionContext context;
+
+ @Test
+ public void convert() throws Exception {
+ LocalDateTimeConverter conv = new LocalDateTimeConverter();
+ LocalDateTime value = conv.convert("2007-12-03T10:15:30", context);
+ assertEquals(value, LocalDateTime.parse("2007-12-03T10:15:30"));
+ value = conv.convert("foo", context);
+ assertNull(value);
+ }
+
+ @Test
+ public void equalsAndHashcode() throws Exception {
+ LocalDateTimeConverter conv1 = new LocalDateTimeConverter();
+ LocalDateTimeConverter conv2 = new LocalDateTimeConverter();
+ assertEquals(conv1, conv2);
+ assertEquals(conv1.hashCode(), conv2.hashCode());
+ }
+
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/1b469982/code/core/src/test/java/org/apache/tamaya/core/internal/converters/LocalTimeConverterTest.java
----------------------------------------------------------------------
diff --git
a/code/core/src/test/java/org/apache/tamaya/core/internal/converters/LocalTimeConverterTest.java
b/code/core/src/test/java/org/apache/tamaya/core/internal/converters/LocalTimeConverterTest.java
new file mode 100644
index 0000000..b75ed7b
--- /dev/null
+++
b/code/core/src/test/java/org/apache/tamaya/core/internal/converters/LocalTimeConverterTest.java
@@ -0,0 +1,57 @@
+/*
+ * 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.ConversionContext;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.runners.MockitoJUnitRunner;
+
+import java.time.LocalTime;
+
+import static org.junit.Assert.*;
+
+/**
+ * Created by atsti on 02.10.2017.
+ */
+@RunWith(MockitoJUnitRunner.class)
+public class LocalTimeConverterTest {
+
+ @Mock
+ ConversionContext context;
+
+ @Test
+ public void convert() throws Exception {
+ LocalTimeConverter conv = new LocalTimeConverter();
+ LocalTime value = conv.convert("10:15:30", context);
+ assertEquals(value, LocalTime.parse("10:15:30"));
+ value = conv.convert("foo", context);
+ assertNull(value);
+ }
+
+ @Test
+ public void equalsAndHashcode() throws Exception {
+ LocalTimeConverter conv1 = new LocalTimeConverter();
+ LocalTimeConverter conv2 = new LocalTimeConverter();
+ assertEquals(conv1, conv2);
+ assertEquals(conv1.hashCode(), conv2.hashCode());
+ }
+
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/1b469982/code/core/src/test/java/org/apache/tamaya/core/internal/converters/OffsetDateTimeConverterTest.java
----------------------------------------------------------------------
diff --git
a/code/core/src/test/java/org/apache/tamaya/core/internal/converters/OffsetDateTimeConverterTest.java
b/code/core/src/test/java/org/apache/tamaya/core/internal/converters/OffsetDateTimeConverterTest.java
new file mode 100644
index 0000000..4ab65a2
--- /dev/null
+++
b/code/core/src/test/java/org/apache/tamaya/core/internal/converters/OffsetDateTimeConverterTest.java
@@ -0,0 +1,57 @@
+/*
+ * 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.ConversionContext;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.runners.MockitoJUnitRunner;
+
+import java.time.OffsetDateTime;
+
+import static org.junit.Assert.*;
+
+/**
+ * Created by atsti on 02.10.2017.
+ */
+@RunWith(MockitoJUnitRunner.class)
+public class OffsetDateTimeConverterTest {
+
+ @Mock
+ ConversionContext context;
+
+ @Test
+ public void convert() throws Exception {
+ OffsetDateTimeConverter conv = new OffsetDateTimeConverter();
+ OffsetDateTime value = conv.convert("2007-12-03T10:15:30+01:00",
context);
+ assertEquals(value, OffsetDateTime.parse("2007-12-03T10:15:30+01:00"));
+ value = conv.convert("foo", context);
+ assertNull(value);
+ }
+
+ @Test
+ public void equalsAndHashcode() throws Exception {
+ OffsetDateTimeConverter conv1 = new OffsetDateTimeConverter();
+ OffsetDateTimeConverter conv2 = new OffsetDateTimeConverter();
+ assertEquals(conv1, conv2);
+ assertEquals(conv1.hashCode(), conv2.hashCode());
+ }
+
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/1b469982/code/core/src/test/java/org/apache/tamaya/core/internal/converters/OffsetTimeConverterTest.java
----------------------------------------------------------------------
diff --git
a/code/core/src/test/java/org/apache/tamaya/core/internal/converters/OffsetTimeConverterTest.java
b/code/core/src/test/java/org/apache/tamaya/core/internal/converters/OffsetTimeConverterTest.java
new file mode 100644
index 0000000..3b28b2c
--- /dev/null
+++
b/code/core/src/test/java/org/apache/tamaya/core/internal/converters/OffsetTimeConverterTest.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.core.internal.converters;
+
+import org.apache.tamaya.spi.ConversionContext;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.runners.MockitoJUnitRunner;
+
+import java.time.OffsetTime;
+
+import static org.junit.Assert.*;
+
+/**
+ * Created by atsti on 02.10.2017.
+ */
+@RunWith(MockitoJUnitRunner.class)
+public class OffsetTimeConverterTest {
+ @Mock
+ ConversionContext context;
+
+ @Test
+ public void convert() throws Exception {
+ OffsetTimeConverter conv = new OffsetTimeConverter();
+ OffsetTime value = conv.convert("10:15:30+01:00", context);
+ assertEquals(value, OffsetTime.parse("10:15:30+01:00"));
+ value = conv.convert("foo", context);
+ assertNull(value);
+ }
+
+ @Test
+ public void equalsAndHashcode() throws Exception {
+ OffsetTimeConverter conv1 = new OffsetTimeConverter();
+ OffsetTimeConverter conv2 = new OffsetTimeConverter();
+ assertEquals(conv1, conv2);
+ assertEquals(conv1.hashCode(), conv2.hashCode());
+ }
+
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/1b469982/code/core/src/test/java/org/apache/tamaya/core/internal/converters/PathConverterTest.java
----------------------------------------------------------------------
diff --git
a/code/core/src/test/java/org/apache/tamaya/core/internal/converters/PathConverterTest.java
b/code/core/src/test/java/org/apache/tamaya/core/internal/converters/PathConverterTest.java
new file mode 100644
index 0000000..2906c06
--- /dev/null
+++
b/code/core/src/test/java/org/apache/tamaya/core/internal/converters/PathConverterTest.java
@@ -0,0 +1,61 @@
+/*
+ * 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.ConversionContext;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.runners.MockitoJUnitRunner;
+
+import java.nio.file.FileSystem;
+import java.nio.file.FileSystems;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+
+import static org.junit.Assert.*;
+
+/**
+ * Created by atsti on 02.10.2017.
+ */
+@RunWith(MockitoJUnitRunner.class)
+public class PathConverterTest {
+
+ @Mock
+ ConversionContext context;
+
+ @Test
+ public void convert() throws Exception {
+ PathConverter conv = new PathConverter();
+ String testRoot =
FileSystems.getDefault().getRootDirectories().iterator().next().toString();
+ Path value = conv.convert("testRoot", context);
+ assertEquals(value, Paths.get("testRoot"));
+ value = conv.convert("foo", context);
+ assertNotNull(value);
+ }
+
+ @Test
+ public void equalsAndHashcode() throws Exception {
+ PathConverter conv1 = new PathConverter();
+ PathConverter conv2 = new PathConverter();
+ assertEquals(conv1, conv2);
+ assertEquals(conv1.hashCode(), conv2.hashCode());
+ }
+
+}
\ No newline at end of file