use of java.time.temporal.TemporalAccessor in project jdk8u_jdk by JetBrains.
the class AbstractDateTimeTest method basicTest_get_TemporalField_null.
@Test()
public void basicTest_get_TemporalField_null() {
for (TemporalAccessor sample : samples()) {
try {
sample.get(null);
fail("Failed on " + sample);
} catch (NullPointerException ex) {
// expected
}
}
}
use of java.time.temporal.TemporalAccessor in project jdk8u_jdk by JetBrains.
the class AbstractDateTimeTest method basicTest_getLong_TemporalField_unsupported.
@Test()
public void basicTest_getLong_TemporalField_unsupported() {
for (TemporalAccessor sample : samples()) {
for (TemporalField field : invalidFields()) {
try {
sample.getLong(field);
fail("Failed on " + sample + " " + field);
} catch (DateTimeException ex) {
// expected
}
}
}
}
use of java.time.temporal.TemporalAccessor in project jdk8u_jdk by JetBrains.
the class AbstractDateTimeTest method basicTest_getLong_TemporalField_null.
@Test()
public void basicTest_getLong_TemporalField_null() {
for (TemporalAccessor sample : samples()) {
try {
sample.getLong(null);
fail("Failed on " + sample);
} catch (NullPointerException ex) {
// expected
}
}
}
use of java.time.temporal.TemporalAccessor in project jdk8u_jdk by JetBrains.
the class TestNumberParser method test_parseDigitsLenient.
@Test(dataProvider = "parseDigitsLenient")
public void test_parseDigitsLenient(String input, int min, int max, SignStyle style, int parseLen, Integer parseVal) throws Exception {
setStrict(false);
ParsePosition pos = new ParsePosition(0);
TemporalAccessor parsed = getFormatter(DAY_OF_MONTH, min, max, style).parseUnresolved(input, pos);
if (pos.getErrorIndex() != -1) {
assertEquals(pos.getErrorIndex(), parseLen);
} else {
assertEquals(pos.getIndex(), parseLen);
assertEquals(parsed.getLong(DAY_OF_MONTH), (long) parseVal);
assertEquals(parsed.query(TemporalQueries.chronology()), null);
assertEquals(parsed.query(TemporalQueries.zoneId()), null);
}
}
use of java.time.temporal.TemporalAccessor in project jdk8u_jdk by JetBrains.
the class TestNumberParser method test_parseSignsLenient.
@Test(dataProvider = "parseSignsLenient")
public void test_parseSignsLenient(String input, int min, int max, SignStyle style, int parseLen, Integer parseVal) throws Exception {
setStrict(false);
ParsePosition pos = new ParsePosition(0);
TemporalAccessor parsed = getFormatter(DAY_OF_MONTH, min, max, style).parseUnresolved(input, pos);
if (pos.getErrorIndex() != -1) {
assertEquals(pos.getErrorIndex(), parseLen);
} else {
assertEquals(pos.getIndex(), parseLen);
assertEquals(parsed.getLong(DAY_OF_MONTH), (long) parseVal);
assertEquals(parsed.query(TemporalQueries.chronology()), null);
assertEquals(parsed.query(TemporalQueries.zoneId()), null);
}
}
Aggregations