So I have a LocalDateTime parser which accepts a date as a String. I have wrote several tests for it e.g. checking for leap year and some more.
Now I want a JUnit test to check for a leap second. I did some research and found that probably it is not possible with java.time(?). So far I found a suitable date on which a leap second occured.
Here is what I've tried so far:
@Test
@DisplayName("Check for leap second")
void shouldLeapSecondOccurReturnExactlyTwoMinuteSpan() {
String leapSecond = "2015-06-30T23:59:00+0000";
String leapSecond2 = "2015-07-01T00:01:00";
Assertions.assertTrue(DateConvertUtils.parseIso8601ToUTC(leapSecond)
.isEqual(LocalDateTime.parse(leapSecond2).minusSeconds(120)));
}
While DateConvertUtils
contains my above mentioned parser and a custom DateTimeFormatter
.
I appreciate any help to the right direction.