From a7d9ca00a05f75395ca4c550afdb195155c1b84c Mon Sep 17 00:00:00 2001 From: Emily Jiang Date: Thu, 6 Jul 2017 09:54:16 +0100 Subject: [PATCH 1/2] #55 add tck to cover other date format Signed-off-by: Emily Jiang --- .../config/tck/ConverterTest.java | 35 +++++++++++++++++++ .../META-INF/microprofile-config.properties | 8 +++++ 2 files changed, 43 insertions(+) diff --git a/tck/src/main/java/org/eclipse/microprofile/config/tck/ConverterTest.java b/tck/src/main/java/org/eclipse/microprofile/config/tck/ConverterTest.java index 61012e3..1cec71a 100644 --- a/tck/src/main/java/org/eclipse/microprofile/config/tck/ConverterTest.java +++ b/tck/src/main/java/org/eclipse/microprofile/config/tck/ConverterTest.java @@ -20,9 +20,12 @@ package org.eclipse.microprofile.config.tck; import java.time.Duration; +import java.time.Instant; import java.time.LocalDate; import java.time.LocalDateTime; import java.time.LocalTime; +import java.time.OffsetDateTime; +import java.time.OffsetTime; import javax.inject.Inject; @@ -167,6 +170,38 @@ public void testLocalDateTime_Broken() { LocalDateTime value = config.getValue("tck.config.test.javaconfig.converter.localdatetimevalue.broken", LocalDateTime.class); } + @Test + public void testOffsetDateTime() { + OffsetDateTime value = config.getValue("tck.config.test.javaconfig.converter.offsetdatetimevalue", OffsetDateTime.class); + Assert.assertEquals(value, OffsetDateTime.parse("2007-12-03T10:15:30+01:00")); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testOffsetDateTime_Broken() { + OffsetDateTime value = config.getValue("tck.config.test.javaconfig.converter.offsetdatetimevalue.broken", OffsetDateTime.class); + } + + @Test + public void testOffsetTime() { + OffsetTime value = config.getValue("tck.config.test.javaconfig.converter.offsettimevalue", OffsetTime.class); + Assert.assertEquals(value, OffsetTime.parse("13:45.30.123456789+02:00")); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testOffsetTime_Broken() { + OffsetTime value = config.getValue("tck.config.test.javaconfig.converter.offsettimevalue.broken", OffsetTime.class); + } + + @Test + public void testInstant() { + Instant value = config.getValue("tck.config.test.javaconfig.converter.instantvalue", Instant.class); + Assert.assertEquals(value, Instant.parse("2015-06-02T21:34:33.616Z")); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testInstant_Broken() { + Instant value = config.getValue("tck.config.test.javaconfig.converter.instantvalue.broken", Instant.class); + } @Test public void testBoolean() { diff --git a/tck/src/main/resources/internal/META-INF/microprofile-config.properties b/tck/src/main/resources/internal/META-INF/microprofile-config.properties index a30f2c3..287074f 100644 --- a/tck/src/main/resources/internal/META-INF/microprofile-config.properties +++ b/tck/src/main/resources/internal/META-INF/microprofile-config.properties @@ -49,6 +49,14 @@ tck.config.test.javaconfig.converter.localdatevalue.broken = alfasdf tck.config.test.javaconfig.converter.localdatetimevalue = 2017-12-24T10:25:30 tck.config.test.javaconfig.converter.localdatetimevalue.broken = alfasdf +tck.config.test.javaconfig.converter.offsetdatetimevalue = 2007-12-03T10:15:30+01:00 +tck.config.test.javaconfig.converter.offsetdatetimevalue.broken = alfasdf + +tck.config.test.javaconfig.converter.offsettimevalue = 13:45.30.123456789+02:00 +tck.config.test.javaconfig.converter.offsettimevalue.broken = alfasdf + +tck.config.test.javaconfig.converter.instantvalue = 2015-06-02T21:34:33.616Z +tck.config.test.javaconfig.converter.instantvalue.broken = alfasdf tck.config.test.javaconfig.configvalue.key1=value1 From fb52c7956b6a5232426bc7562e43b836d9647f42 Mon Sep 17 00:00:00 2001 From: Emily Jiang Date: Thu, 6 Jul 2017 10:07:20 +0100 Subject: [PATCH 2/2] #55 update author Signed-off-by: Emily Jiang --- .../java/org/eclipse/microprofile/config/tck/ConverterTest.java | 1 + 1 file changed, 1 insertion(+) diff --git a/tck/src/main/java/org/eclipse/microprofile/config/tck/ConverterTest.java b/tck/src/main/java/org/eclipse/microprofile/config/tck/ConverterTest.java index 1cec71a..04ad918 100644 --- a/tck/src/main/java/org/eclipse/microprofile/config/tck/ConverterTest.java +++ b/tck/src/main/java/org/eclipse/microprofile/config/tck/ConverterTest.java @@ -50,6 +50,7 @@ /** * @author Mark Struberg + * @author Emily Jiang */ public class ConverterTest extends Arquillian {