Skip to content

Commit

Permalink
Merge pull request #191 from eclipse/emily_may
Browse files Browse the repository at this point in the history
eclipse#55 add tck to cover other date format
  • Loading branch information
Emily-Jiang authored Jul 6, 2017
2 parents 1748c78 + fb52c79 commit ea41e56
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -47,6 +50,7 @@

/**
* @author <a href="mailto:[email protected]">Mark Struberg</a>
* @author <a href="mailto:[email protected]">Emily Jiang</a>
*/
public class ConverterTest extends Arquillian {

Expand Down Expand Up @@ -167,6 +171,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() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit ea41e56

Please sign in to comment.