@Test
public void test_calendar() throws DatatypeConfigurationException {
ZonedDateTime zdt = ZonedDateTime.now();
GregorianCalendar gc = GregorianCalendar.from(zdt);
XMLGregorianCalendar xgc = DatatypeFactory.newInstance().newXMLGregorianCalendar(gc);
assertThat(gc.toZonedDateTime(), comparesEqualTo(zdt));
assertThat(xgc.toGregorianCalendar(), comparesEqualTo(gc));
assertThat(xgc.toGregorianCalendar().toZonedDateTime(), comparesEqualTo(zdt)); //
Приведенный выше код не удается с: < /p>
Expected: a value equal to
but: was greater than
Я вижу, что часовые пояса не совпадают, но почему не снятся с GC до ZDT и XGC до GC?>
Почему это не работает?[code] @Test public void test_calendar() throws DatatypeConfigurationException { ZonedDateTime zdt = ZonedDateTime.now(); GregorianCalendar gc = GregorianCalendar.from(zdt); XMLGregorianCalendar xgc = DatatypeFactory.newInstance().newXMLGregorianCalendar(gc); assertThat(gc.toZonedDateTime(), comparesEqualTo(zdt)); assertThat(xgc.toGregorianCalendar(), comparesEqualTo(gc)); assertThat(xgc.toGregorianCalendar().toZonedDateTime(), comparesEqualTo(zdt)); // Приведенный выше код не удается с: < /p> Expected: a value equal to but: was greater than [/code] Я вижу, что часовые пояса не совпадают, но почему не снятся с GC до ZDT и XGC до GC?>