Skip to content

Commit

Permalink
increase InstantParser test coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
vananiev committed Nov 20, 2022
1 parent 2b55764 commit bb60665
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.time.ZoneId;
import java.time.ZoneOffset;
import java.time.format.DateTimeFormatter;
import java.time.format.DateTimeParseException;
import java.time.temporal.Temporal;
Expand Down Expand Up @@ -140,16 +141,15 @@ void parseInstantWithSpecifiedDateTimePatternOnlyDate() {
}

@Test
void parseInstantWithSpecifiedDateTimePatternTime() {
DateTimeFormatter dtf = DateTimeFormatter.ofPattern("+HH-mm.ss");
void parseInstantWithSpecifiedDateTimePatternTimeAndZone() {
DateTimeFormatter dtf = DateTimeFormatter.ofPattern("+HH-mm.ssx");
InstantParser parser = InstantParser.builder()
.dateTimeFormatter(dtf)
.defaultZoneId(UTC)
.build();
String data = "+01-30.45";
String data = "+01-30.45+01";
Instant expected = LocalTime.of(1, 30, 45)
.atDate(LocalDate.now())
.atZone(UTC)
.atZone(ZoneOffset.ofHours(1))
.toInstant();

assertEquals(expected, parser.parseInstant(data));
Expand Down

0 comments on commit bb60665

Please sign in to comment.