use of java.text.ParsePosition in project jdk8u_jdk by JetBrains.
the class TestZoneOffsetParser method test_parse_invalid.
@Test(dataProvider = "badOffsets")
public void test_parse_invalid(String pattern, String parse, int expectedPosition) throws Exception {
ParsePosition pos = new ParsePosition(0);
TemporalAccessor parsed = getFormatter(pattern, "Z").parseUnresolved(parse, pos);
assertEquals(pos.getErrorIndex(), expectedPosition);
assertEquals(parsed, null);
}
use of java.text.ParsePosition in project jdk8u_jdk by JetBrains.
the class TestZoneOffsetParser method test_parse_exactMatch_EmptyUTC.
@Test(dataProvider = "offsets")
public void test_parse_exactMatch_EmptyUTC(String pattern, String parse, ZoneOffset expected) throws Exception {
ParsePosition pos = new ParsePosition(0);
TemporalAccessor parsed = getFormatter(pattern, "").parseUnresolved(parse, pos);
assertEquals(pos.getIndex(), parse.length());
assertParsed(parsed, expected);
}
use of java.text.ParsePosition in project jdk8u_jdk by JetBrains.
the class TestZoneOffsetParser method test_parse_exactMatch_UTC.
//-----------------------------------------------------------------------
public void test_parse_exactMatch_UTC() throws Exception {
ParsePosition pos = new ParsePosition(0);
TemporalAccessor parsed = getFormatter("+HH:MM:ss", "Z").parseUnresolved("Z", 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_caseInsensitiveUTC_unmatchedCase.
public void test_parse_caseInsensitiveUTC_unmatchedCase() throws Exception {
setCaseSensitive(false);
ParsePosition pos = new ParsePosition(0);
TemporalAccessor parsed = getFormatter("+HH:MM:ss", "Z").parseUnresolved("z", pos);
assertEquals(pos.getIndex(), 1);
assertParsed(parsed, ZoneOffset.UTC);
}
use of java.text.ParsePosition in project jdk8u_jdk by JetBrains.
the class TestTextParser method test_parse_noMatch_atEnd.
public void test_parse_noMatch_atEnd() throws Exception {
ParsePosition pos = new ParsePosition(6);
TemporalAccessor parsed = getFormatter(DAY_OF_WEEK, TextStyle.FULL).parseUnresolved("Monday", pos);
assertEquals(pos.getErrorIndex(), 6);
assertEquals(parsed, null);
}
Aggregations