use of java.time.format.DateTimeFormatterBuilder in project jdk8u_jdk by JetBrains.
the class TCKDateTimeParseResolver method test_fieldResolvesToChronoZonedDateTime_overrideChrono_wrongChrono.
@Test(expectedExceptions = DateTimeParseException.class)
public void test_fieldResolvesToChronoZonedDateTime_overrideChrono_wrongChrono() {
ChronoZonedDateTime<?> cldt = ThaiBuddhistChronology.INSTANCE.dateNow().atTime(LocalTime.NOON).atZone(EUROPE_PARIS);
DateTimeFormatter f = new DateTimeFormatterBuilder().appendValue(new ResolvingField(cldt)).toFormatter();
f = f.withChronology(MinguoChronology.INSTANCE);
f.parse("1234567890");
}
use of java.time.format.DateTimeFormatterBuilder in project jdk8u_jdk by JetBrains.
the class TCKDateTimeParseResolver method test_fieldResolvesToChronoLocalDate_overrideChrono_matches.
@Test
public void test_fieldResolvesToChronoLocalDate_overrideChrono_matches() {
MinguoDate mdt = MinguoDate.of(100, 6, 30);
DateTimeFormatter f = new DateTimeFormatterBuilder().appendValue(new ResolvingField(mdt)).toFormatter();
f = f.withChronology(MinguoChronology.INSTANCE);
TemporalAccessor accessor = f.parse("1234567890");
assertEquals(accessor.query(TemporalQueries.localDate()), LocalDate.from(mdt));
assertEquals(accessor.query(TemporalQueries.localTime()), null);
assertEquals(accessor.query(TemporalQueries.chronology()), MinguoChronology.INSTANCE);
}
use of java.time.format.DateTimeFormatterBuilder in project jdk8u_jdk by JetBrains.
the class TCKDateTimeParseResolver method test_fieldResolvesToChronoZonedDateTime_overrideZone_wrongZone.
@Test(expectedExceptions = DateTimeParseException.class)
public void test_fieldResolvesToChronoZonedDateTime_overrideZone_wrongZone() {
ZonedDateTime zdt = ZonedDateTime.of(2010, 6, 30, 12, 30, 0, 0, EUROPE_PARIS);
DateTimeFormatter f = new DateTimeFormatterBuilder().appendValue(new ResolvingField(zdt)).toFormatter();
f = f.withZone(ZoneId.of("Europe/London"));
f.parse("1234567890");
}
use of java.time.format.DateTimeFormatterBuilder in project jdk8u_jdk by JetBrains.
the class TCKDateTimeParseResolver method test_fieldResolvesToChronoLocalDate_overrideChrono_wrongChrono.
@Test(expectedExceptions = DateTimeParseException.class)
public void test_fieldResolvesToChronoLocalDate_overrideChrono_wrongChrono() {
ChronoLocalDate cld = ThaiBuddhistChronology.INSTANCE.dateNow();
DateTimeFormatter f = new DateTimeFormatterBuilder().appendValue(new ResolvingField(cld)).toFormatter();
f = f.withChronology(MinguoChronology.INSTANCE);
f.parse("1234567890");
}
use of java.time.format.DateTimeFormatterBuilder in project jdk8u_jdk by JetBrains.
the class TCKDateTimeParseResolver method test_fieldResolvesToChronoZonedDateTime_noOverrideChrono_wrongChrono.
@Test(expectedExceptions = DateTimeParseException.class)
public void test_fieldResolvesToChronoZonedDateTime_noOverrideChrono_wrongChrono() {
ChronoZonedDateTime<?> cldt = ThaiBuddhistChronology.INSTANCE.dateNow().atTime(LocalTime.NOON).atZone(EUROPE_PARIS);
DateTimeFormatter f = new DateTimeFormatterBuilder().appendValue(new ResolvingField(cldt)).toFormatter();
f.parse("1234567890");
}
Aggregations