Created
September 1, 2016 15:36
-
-
Save noctarius/c010214c0852358de54950eda1682ada to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Test | |
public void test_exception_flow_control() { | |
Calendar calendar = Calendar.getInstance(); | |
calendar.set(2003, 11, 13, 18, 30, 02); | |
calendar.setTimeZone(TimeZone.getTimeZone("UTC")); | |
calendar.set(Calendar.MILLISECOND, 250); | |
Instant expected = calendar.toInstant(); | |
ZoneId UTC = ZoneId.of("UTC"); | |
DateTimeFormatter fractionFormat = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss.SSSXXX", Locale.US); | |
String date = "2003-12-13T18:30:02.25+01:00"; | |
Instant actual = LocalDateTime.parse(date, fractionFormat).atZone(UTC).toInstant(); | |
assertEquals(expected, actual); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment