use of java.text.ParsePosition 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);
}
use of java.text.ParsePosition in project jdk8u_jdk by JetBrains.
the class TestZoneOffsetParser method test_parse_endStringMatch_EmptyUTC.
@Test(dataProvider = "offsets")
public void test_parse_endStringMatch_EmptyUTC(String pattern, String parse, ZoneOffset expected) throws Exception {
ParsePosition pos = new ParsePosition(5);
TemporalAccessor parsed = getFormatter(pattern, "").parseUnresolved("OTHER" + parse, pos);
assertEquals(pos.getIndex(), parse.length() + 5);
assertParsed(parsed, expected);
}
use of java.text.ParsePosition in project jdk8u_jdk by JetBrains.
the class TestZoneOffsetParser method test_parse_midStringMatch.
@Test(dataProvider = "offsets")
public void test_parse_midStringMatch(String pattern, String parse, ZoneOffset expected) throws Exception {
ParsePosition pos = new ParsePosition(5);
TemporalAccessor parsed = getFormatter(pattern, "Z").parseUnresolved("OTHER" + parse + ":OTHER", pos);
assertEquals(pos.getIndex(), parse.length() + 5);
assertParsed(parsed, expected);
}
use of java.text.ParsePosition in project jdk8u_jdk by JetBrains.
the class TestZoneOffsetParser method test_parse_startStringMatch_UTC.
public void test_parse_startStringMatch_UTC() throws Exception {
ParsePosition pos = new ParsePosition(0);
TemporalAccessor parsed = getFormatter("+HH:MM:ss", "Z").parseUnresolved("ZOTHER", pos);
assertEquals(pos.getIndex(), 1);
assertParsed(parsed, ZoneOffset.UTC);
}
use of java.text.ParsePosition in project jdk8u_jdk by JetBrains.
the class TestZoneOffsetParser method test_parse_midStringMatch_EmptyUTC.
@Test(dataProvider = "offsets")
public void test_parse_midStringMatch_EmptyUTC(String pattern, String parse, ZoneOffset expected) throws Exception {
ParsePosition pos = new ParsePosition(5);
TemporalAccessor parsed = getFormatter(pattern, "").parseUnresolved("OTHER" + parse + ":OTHER", pos);
assertEquals(pos.getIndex(), parse.length() + 5);
assertParsed(parsed, expected);
}
Aggregations