use of java.time.format.DateTimeFormatter in project jdk8u_jdk by JetBrains.
the class TCKOffsetTime method test_format_formatter.
//-----------------------------------------------------------------------
// format(DateTimeFormatter)
//-----------------------------------------------------------------------
@Test
public void test_format_formatter() {
DateTimeFormatter f = DateTimeFormatter.ofPattern("H m s");
String t = OffsetTime.of(11, 30, 0, 0, OFFSET_PONE).format(f);
assertEquals(t, "11 30 0");
}
use of java.time.format.DateTimeFormatter in project jdk8u_jdk by JetBrains.
the class TCKIsoFields method test_parse_weeks_STRICT.
//-----------------------------------------------------------------------
// parse weeks
//-----------------------------------------------------------------------
@Test(dataProvider = "week")
public void test_parse_weeks_STRICT(LocalDate date, DayOfWeek dow, int week, int wby) {
DateTimeFormatter f = new DateTimeFormatterBuilder().appendValue(IsoFields.WEEK_BASED_YEAR).appendLiteral('-').appendValue(IsoFields.WEEK_OF_WEEK_BASED_YEAR).appendLiteral('-').appendValue(DAY_OF_WEEK).toFormatter().withResolverStyle(ResolverStyle.STRICT);
LocalDate parsed = LocalDate.parse(wby + "-" + week + "-" + dow.getValue(), f);
assertEquals(parsed, date);
}
use of java.time.format.DateTimeFormatter in project jdk8u_jdk by JetBrains.
the class TCKJulianFields method test_samples_parse_STRICT.
//-----------------------------------------------------------------------
@Test(dataProvider = "samples")
public void test_samples_parse_STRICT(TemporalField field, LocalDate date, long value) {
DateTimeFormatter f = new DateTimeFormatterBuilder().appendValue(field).toFormatter().withResolverStyle(ResolverStyle.STRICT);
LocalDate parsed = LocalDate.parse(Long.toString(value), f);
assertEquals(parsed, date);
}
use of java.time.format.DateTimeFormatter in project jdk8u_jdk by JetBrains.
the class TCKJulianFields method test_samples_parse_SMART.
@Test(dataProvider = "samples")
public void test_samples_parse_SMART(TemporalField field, LocalDate date, long value) {
DateTimeFormatter f = new DateTimeFormatterBuilder().appendValue(field).toFormatter().withResolverStyle(ResolverStyle.SMART);
LocalDate parsed = LocalDate.parse(Long.toString(value), f);
assertEquals(parsed, date);
}
use of java.time.format.DateTimeFormatter in project jdk8u_jdk by JetBrains.
the class TCKJulianFields method test_samples_parse_LENIENT.
@Test(dataProvider = "samples")
public void test_samples_parse_LENIENT(TemporalField field, LocalDate date, long value) {
DateTimeFormatter f = new DateTimeFormatterBuilder().appendValue(field).toFormatter().withResolverStyle(ResolverStyle.LENIENT);
LocalDate parsed = LocalDate.parse(Long.toString(value), f);
assertEquals(parsed, date);
}
Aggregations