use of java.text.ParsePosition in project jdk8u_jdk by JetBrains.
the class TestZoneOffsetParser method test_parse_exactMatch_UTC_EmptyUTC.
//-----------------------------------------------------------------------
public void test_parse_exactMatch_UTC_EmptyUTC() throws Exception {
ParsePosition pos = new ParsePosition(0);
TemporalAccessor parsed = getFormatter("+HH:MM:ss", "").parseUnresolved("", pos);
assertEquals(pos.getIndex(), 0);
assertParsed(parsed, ZoneOffset.UTC);
}
use of java.text.ParsePosition in project jdk8u_jdk by JetBrains.
the class TestZoneOffsetParser method test_parse_startStringMatch.
@Test(dataProvider = "offsets")
public void test_parse_startStringMatch(String pattern, String parse, ZoneOffset expected) throws Exception {
ParsePosition pos = new ParsePosition(0);
TemporalAccessor parsed = getFormatter(pattern, "Z").parseUnresolved(parse + ":OTHER", 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.
@Test(dataProvider = "offsets")
public void test_parse_exactMatch(String pattern, String parse, ZoneOffset expected) throws Exception {
ParsePosition pos = new ParsePosition(0);
TemporalAccessor parsed = getFormatter(pattern, "Z").parseUnresolved(parse, pos);
assertEquals(pos.getIndex(), parse.length());
assertParsed(parsed, expected);
}
use of java.text.ParsePosition in project jdk8u_jdk by JetBrains.
the class TestTextParser method test_parse_full_lenient_number_match.
public void test_parse_full_lenient_number_match() throws Exception {
setStrict(false);
ParsePosition pos = new ParsePosition(0);
assertEquals(getFormatter(MONTH_OF_YEAR, TextStyle.FULL).parseUnresolved("1", pos).getLong(MONTH_OF_YEAR), 1L);
assertEquals(pos.getIndex(), 1);
}
use of java.text.ParsePosition in project jdk8u_jdk by JetBrains.
the class TestTextParser method test_parse_short_lenient_number_match.
public void test_parse_short_lenient_number_match() throws Exception {
setStrict(false);
ParsePosition pos = new ParsePosition(0);
assertEquals(getFormatter(MONTH_OF_YEAR, TextStyle.SHORT).parseUnresolved("1", pos).getLong(MONTH_OF_YEAR), 1L);
assertEquals(pos.getIndex(), 1);
}
Aggregations