@Test public void shouldMatchInMillisecondPrecision() { matcher = new ZonedDateTimeEqualsInUtcMatcher(ZonedDateTime.parse("2020-04-17T06:18:28.956087Z")); assertThat(matcher.matches(ZonedDateTime.parse("2020-04-17T06:18:28.957087Z"))).isFalse(); assertThat(matcher.matches(ZonedDateTime.parse("2020-04-17T06:18:28.956999Z"))).isTrue(); }
@Override public boolean matches(Object item) { ZonedDateTime actualWithZone = item == null ? null : ZonedDateTime.parse(String.valueOf(item)); LocalDateTime actual = toUtcLocal(actualWithZone); return Objects.equals(actual, expected); }
ZonedDateTimeEqualsInUtcMatcher extends BaseMatcher<ZonedDateTime> { @Override public boolean matches(Object item) { ZonedDateTime actualWithZone = item == null ? null : ZonedDateTime.parse(String.valueOf(item)); LocalDateTime actual = toUtcLocal(actualWithZone); return Objects.equals(actual, expected); } }
ZonedDateTimeEqualsInUtcMatcher extends BaseMatcher<ZonedDateTime> { @Override public boolean matches(Object item) { ZonedDateTime actualWithZone = item == null ? null : ZonedDateTime.parse(String.valueOf(item)); LocalDateTime actual = toUtcLocal(actualWithZone); return Objects.equals(actual, expected); } ZonedDateTimeEqualsInUtcMatcher(ZonedDateTime expected); }
ZonedDateTimeEqualsInUtcMatcher extends BaseMatcher<ZonedDateTime> { @Override public boolean matches(Object item) { ZonedDateTime actualWithZone = item == null ? null : ZonedDateTime.parse(String.valueOf(item)); LocalDateTime actual = toUtcLocal(actualWithZone); return Objects.equals(actual, expected); } ZonedDateTimeEqualsInUtcMatcher(ZonedDateTime expected); @Override boolean matches(Object item); @Override void describeTo(Description description); static Matcher<ZonedDateTime> zonedDateTimeEquals(ZonedDateTime expected); }
ZonedDateTimeEqualsInUtcMatcher extends BaseMatcher<ZonedDateTime> { @Override public boolean matches(Object item) { ZonedDateTime actualWithZone = item == null ? null : ZonedDateTime.parse(String.valueOf(item)); LocalDateTime actual = toUtcLocal(actualWithZone); return Objects.equals(actual, expected); } ZonedDateTimeEqualsInUtcMatcher(ZonedDateTime expected); @Override boolean matches(Object item); @Override void describeTo(Description description); static Matcher<ZonedDateTime> zonedDateTimeEquals(ZonedDateTime expected);  }