use of java.time.temporal.TemporalAccessor in project jdk8u_jdk by JetBrains.
the class TestDateTimeParsing method test_parse_instantZones_ZDT.
@Test(dataProvider = "instantZones")
public void test_parse_instantZones_ZDT(DateTimeFormatter formatter, String text, ZonedDateTime expected) {
TemporalAccessor actual = formatter.parse(text);
assertEquals(ZonedDateTime.from(actual), expected);
}
use of java.time.temporal.TemporalAccessor in project jdk8u_jdk by JetBrains.
the class TestDateTimeParsing method test_parse_instantZones_supported.
@Test(dataProvider = "instantZones")
public void test_parse_instantZones_supported(DateTimeFormatter formatter, String text, ZonedDateTime expected) {
TemporalAccessor actual = formatter.parse(text);
assertEquals(actual.isSupported(INSTANT_SECONDS), true);
assertEquals(actual.isSupported(EPOCH_DAY), true);
assertEquals(actual.isSupported(SECOND_OF_DAY), true);
assertEquals(actual.isSupported(NANO_OF_SECOND), true);
assertEquals(actual.isSupported(MICRO_OF_SECOND), true);
assertEquals(actual.isSupported(MILLI_OF_SECOND), true);
}
use of java.time.temporal.TemporalAccessor in project jdk8u_jdk by JetBrains.
the class TestDateTimeFormatter method test_parsed_toString_resolvedDateTime.
@Test
public void test_parsed_toString_resolvedDateTime() {
DateTimeFormatter f = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
TemporalAccessor temporal = f.parse("2010-06-30 11:30:56");
String msg = temporal.toString();
assertTrue(msg.contains("2010-06-30"), msg);
assertTrue(msg.contains("11:30:56"), msg);
}
use of java.time.temporal.TemporalAccessor in project jdk8u_jdk by JetBrains.
the class TestDateTimeParsing method test_parse_instantNoZone_supported.
@Test(dataProvider = "instantNoZone")
public void test_parse_instantNoZone_supported(DateTimeFormatter formatter, String text, Instant expected) {
TemporalAccessor actual = formatter.parse(text);
assertEquals(actual.isSupported(INSTANT_SECONDS), true);
assertEquals(actual.isSupported(EPOCH_DAY), false);
assertEquals(actual.isSupported(SECOND_OF_DAY), false);
assertEquals(actual.isSupported(NANO_OF_SECOND), true);
assertEquals(actual.isSupported(MICRO_OF_SECOND), true);
assertEquals(actual.isSupported(MILLI_OF_SECOND), true);
}
use of java.time.temporal.TemporalAccessor in project jdk8u_jdk by JetBrains.
the class TestDateTimeParsing method test_parse_instantZones_Instant.
@Test(dataProvider = "instantZones")
public void test_parse_instantZones_Instant(DateTimeFormatter formatter, String text, ZonedDateTime expected) {
TemporalAccessor actual = formatter.parse(text);
assertEquals(Instant.from(actual), expected.toInstant());
}
Aggregations