use of java.time.format.DateTimeFormatter in project jdk8u_jdk by JetBrains.
the class TCKDateTimeFormatter method test_format_TemporalAccessor_simple.
//-----------------------------------------------------------------------
@Test
public void test_format_TemporalAccessor_simple() {
DateTimeFormatter test = fmt.withLocale(Locale.ENGLISH).withDecimalStyle(DecimalStyle.STANDARD);
String result = test.format(LocalDate.of(2008, 6, 30));
assertEquals(result, "ONE30");
}
use of java.time.format.DateTimeFormatter in project jdk8u_jdk by JetBrains.
the class TCKDateTimeFormatter method test_toFormat_parseObject_StringParsePosition_invalidPosition_tooSmall.
@Test
public void test_toFormat_parseObject_StringParsePosition_invalidPosition_tooSmall() throws Exception {
// SimpleDateFormat throws StringIndexOutOfBoundException
DateTimeFormatter dtf = fmt.withLocale(Locale.ENGLISH).withDecimalStyle(DecimalStyle.STANDARD);
ParsePosition pos = new ParsePosition(-1);
Format test = dtf.toFormat();
assertNull(test.parseObject("ONE30", pos));
assertTrue(pos.getErrorIndex() >= 0);
}
use of java.time.format.DateTimeFormatter in project jdk8u_jdk by JetBrains.
the class TCKDateTimeFormatter method test_parse_Query_String_nullRule.
@Test(expectedExceptions = NullPointerException.class)
public void test_parse_Query_String_nullRule() throws Exception {
DateTimeFormatter test = fmt.withLocale(Locale.ENGLISH).withDecimalStyle(DecimalStyle.STANDARD);
test.parse("30", (TemporalQuery<?>) null);
}
use of java.time.format.DateTimeFormatter in project jdk8u_jdk by JetBrains.
the class TCKDateTimeFormatter method test_parse_CharSequence_ParsePosition_nullParsePosition.
@Test(expectedExceptions = NullPointerException.class)
public void test_parse_CharSequence_ParsePosition_nullParsePosition() {
DateTimeFormatter test = fmt.withLocale(Locale.ENGLISH).withDecimalStyle(DecimalStyle.STANDARD);
test.parse("Text", (ParsePosition) null);
}
use of java.time.format.DateTimeFormatter in project jdk8u_jdk by JetBrains.
the class TCKDateTimeFormatter method test_parseUnresolved_StringParsePosition_invalidPosition.
@Test(expectedExceptions = IndexOutOfBoundsException.class)
public void test_parseUnresolved_StringParsePosition_invalidPosition() {
DateTimeFormatter test = fmt.withLocale(Locale.ENGLISH).withDecimalStyle(DecimalStyle.STANDARD);
ParsePosition pos = new ParsePosition(6);
test.parseUnresolved("ONE30", pos);
}
Aggregations