Examples of TextPrinterParser


Examples of org.threeten.bp.format.DateTimeFormatterBuilder.TextPrinterParser

    //-----------------------------------------------------------------------
    @DataProvider(name="error")
    Object[][] data_error() {
        return new Object[][] {
            {new TextPrinterParser(DAY_OF_WEEK, TextStyle.FULL, PROVIDER), "Monday", -1, IndexOutOfBoundsException.class},
            {new TextPrinterParser(DAY_OF_WEEK, TextStyle.FULL, PROVIDER), "Monday", 7, IndexOutOfBoundsException.class},
        };
    }
View Full Code Here

Examples of org.threeten.bp.format.DateTimeFormatterBuilder.TextPrinterParser

        }
    }

    //-----------------------------------------------------------------------
    public void test_parse_midStr() throws Exception {
        TextPrinterParser pp = new TextPrinterParser(DAY_OF_WEEK, TextStyle.FULL, PROVIDER);
        int newPos = pp.parse(parseContext, "XxxMondayXxx", 3);
        assertEquals(newPos, 9);
        assertParsed(parseContext, DAY_OF_WEEK, 1L);
    }
View Full Code Here

Examples of org.threeten.bp.format.DateTimeFormatterBuilder.TextPrinterParser

        assertEquals(newPos, 9);
        assertParsed(parseContext, DAY_OF_WEEK, 1L);
    }

    public void test_parse_remainderIgnored() throws Exception {
        TextPrinterParser pp = new TextPrinterParser(DAY_OF_WEEK, TextStyle.SHORT, PROVIDER);
        int newPos = pp.parse(parseContext, "Wednesday", 0);
        assertEquals(newPos, 3);
        assertParsed(parseContext, DAY_OF_WEEK, 3L);
    }
View Full Code Here

Examples of org.threeten.bp.format.DateTimeFormatterBuilder.TextPrinterParser

        assertParsed(parseContext, DAY_OF_WEEK, 3L);
    }

    //-----------------------------------------------------------------------
    public void test_parse_noMatch1() throws Exception {
        TextPrinterParser pp = new TextPrinterParser(DAY_OF_WEEK, TextStyle.FULL, PROVIDER);
        int newPos = pp.parse(parseContext, "Munday", 0);
        assertEquals(newPos, ~0);
        assertEquals(parseContext.toParsed().query(TemporalQueries.chronology()), null);
        assertEquals(parseContext.toParsed().query(TemporalQueries.zoneId()), null);
    }
View Full Code Here

Examples of org.threeten.bp.format.DateTimeFormatterBuilder.TextPrinterParser

        assertEquals(parseContext.toParsed().query(TemporalQueries.chronology()), null);
        assertEquals(parseContext.toParsed().query(TemporalQueries.zoneId()), null);
    }

    public void test_parse_noMatch2() throws Exception {
        TextPrinterParser pp = new TextPrinterParser(DAY_OF_WEEK, TextStyle.FULL, PROVIDER);
        int newPos = pp.parse(parseContext, "Monday", 3);
        assertEquals(newPos, ~3);
        assertEquals(parseContext.toParsed().query(TemporalQueries.chronology()), null);
        assertEquals(parseContext.toParsed().query(TemporalQueries.zoneId()), null);
    }
View Full Code Here

Examples of org.threeten.bp.format.DateTimeFormatterBuilder.TextPrinterParser

        assertEquals(parseContext.toParsed().query(TemporalQueries.chronology()), null);
        assertEquals(parseContext.toParsed().query(TemporalQueries.zoneId()), null);
    }

    public void test_parse_noMatch_atEnd() throws Exception {
        TextPrinterParser pp = new TextPrinterParser(DAY_OF_WEEK, TextStyle.FULL, PROVIDER);
        int newPos = pp.parse(parseContext, "Monday", 6);
        assertEquals(newPos, ~6);
        assertEquals(parseContext.toParsed().query(TemporalQueries.chronology()), null);
        assertEquals(parseContext.toParsed().query(TemporalQueries.zoneId()), null);
    }
View Full Code Here

Examples of org.threeten.bp.format.DateTimeFormatterBuilder.TextPrinterParser

       };
    }

    @Test(dataProvider="parseText")
    public void test_parseText(TemporalField field, TextStyle style, int value, String input) throws Exception {
        TextPrinterParser pp = new TextPrinterParser(field, style, PROVIDER);
        int newPos = pp.parse(parseContext, input, 0);
        assertEquals(newPos, input.length());
        assertParsed(parseContext, field, (long) value);
    }
View Full Code Here

Examples of org.threeten.bp.format.DateTimeFormatterBuilder.TextPrinterParser

        assertParsed(parseContext, field, (long) value);
    }

    @Test(dataProvider="parseNumber")
    public void test_parseNumber(TemporalField field, TextStyle style, int value, String input) throws Exception {
        TextPrinterParser pp = new TextPrinterParser(field, style, PROVIDER);
        int newPos = pp.parse(parseContext, input, 0);
        assertEquals(newPos, input.length());
        assertParsed(parseContext, field, (long) value);
    }
View Full Code Here

Examples of org.threeten.bp.format.DateTimeFormatterBuilder.TextPrinterParser

    //-----------------------------------------------------------------------
    @Test(dataProvider="parseText")
    public void test_parse_strict_caseSensitive_parseUpper(TemporalField field, TextStyle style, int value, String input) throws Exception {
        parseContext.setCaseSensitive(true);
        TextPrinterParser pp = new TextPrinterParser(field, style, PROVIDER);
        int newPos = pp.parse(parseContext, input.toUpperCase(), 0);
        assertEquals(newPos, ~0);
        assertEquals(parseContext.toParsed().query(TemporalQueries.chronology()), null);
        assertEquals(parseContext.toParsed().query(TemporalQueries.zoneId()), null);
    }
View Full Code Here

Examples of org.threeten.bp.format.DateTimeFormatterBuilder.TextPrinterParser

    }

    @Test(dataProvider="parseText")
    public void test_parse_strict_caseInsensitive_parseUpper(TemporalField field, TextStyle style, int value, String input) throws Exception {
        parseContext.setCaseSensitive(false);
        TextPrinterParser pp = new TextPrinterParser(field, style, PROVIDER);
        int newPos = pp.parse(parseContext, input.toUpperCase(), 0);
        assertEquals(newPos, input.length());
        assertParsed(parseContext, field, (long) value);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.