Examples of TextPrinterParser


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

    //-----------------------------------------------------------------------
    @Test(dataProvider="parseText")
    public void test_parse_strict_caseSensitive_parseLower(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.toLowerCase(), 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_parseLower(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.toLowerCase(), 0);
        assertEquals(newPos, input.length());
        assertParsed(parseContext, field, (long) value);
    }
View Full Code Here

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

    //-----------------------------------------------------------------------
    //-----------------------------------------------------------------------
    //-----------------------------------------------------------------------
    public void test_parse_full_strict_full_match() throws Exception {
        parseContext.setStrict(true);
        TextPrinterParser pp = new TextPrinterParser(MONTH_OF_YEAR, TextStyle.FULL, PROVIDER);
        int newPos = pp.parse(parseContext, "January", 0);
        assertEquals(newPos, 7);
        assertParsed(parseContext, MONTH_OF_YEAR, 1L);
    }
View Full Code Here

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

        assertParsed(parseContext, MONTH_OF_YEAR, 1L);
    }

    public void test_parse_full_strict_short_noMatch() throws Exception {
        parseContext.setStrict(true);
        TextPrinterParser pp = new TextPrinterParser(MONTH_OF_YEAR, TextStyle.FULL, PROVIDER);
        int newPos = pp.parse(parseContext, "Janua", 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.zoneId()), null);
    }

    public void test_parse_full_strict_number_noMatch() throws Exception {
        parseContext.setStrict(true);
        TextPrinterParser pp = new TextPrinterParser(MONTH_OF_YEAR, TextStyle.FULL, PROVIDER);
        int newPos = pp.parse(parseContext, "1", 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

    }

    //-----------------------------------------------------------------------
    public void test_parse_short_strict_full_match() throws Exception {
        parseContext.setStrict(true);
        TextPrinterParser pp = new TextPrinterParser(MONTH_OF_YEAR, TextStyle.SHORT, PROVIDER);
        int newPos = pp.parse(parseContext, "January", 0);
        assertEquals(newPos, 3);
        assertParsed(parseContext, MONTH_OF_YEAR, 1L);
    }
View Full Code Here

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

        assertParsed(parseContext, MONTH_OF_YEAR, 1L);
    }

    public void test_parse_short_strict_short_match() throws Exception {
        parseContext.setStrict(true);
        TextPrinterParser pp = new TextPrinterParser(MONTH_OF_YEAR, TextStyle.SHORT, PROVIDER);
        int newPos = pp.parse(parseContext, "Janua", 0);
        assertEquals(newPos, 3);
        assertParsed(parseContext, MONTH_OF_YEAR, 1L);
    }
View Full Code Here

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

        assertParsed(parseContext, MONTH_OF_YEAR, 1L);
    }

    public void test_parse_short_strict_number_noMatch() throws Exception {
        parseContext.setStrict(true);
        TextPrinterParser pp = new TextPrinterParser(MONTH_OF_YEAR, TextStyle.SHORT, PROVIDER);
        int newPos = pp.parse(parseContext, "1", 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

    //-----------------------------------------------------------------------
    public void test_parse_french_short_strict_full_noMatch() throws Exception {
        parseContext.setLocale(Locale.FRENCH);
        parseContext.setStrict(true);
        TextPrinterParser pp = new TextPrinterParser(MONTH_OF_YEAR, TextStyle.SHORT, PROVIDER);
        int newPos = pp.parse(parseContext, "janvier", 0)// correct short form is 'janv.'
        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

    }

    public void test_parse_french_short_strict_short_match() throws Exception {
        parseContext.setLocale(Locale.FRENCH);
        parseContext.setStrict(true);
        TextPrinterParser pp = new TextPrinterParser(MONTH_OF_YEAR, TextStyle.SHORT, PROVIDER);
        int newPos = pp.parse(parseContext, "janv.", 0);
        assertEquals(newPos, 5);
        assertParsed(parseContext, MONTH_OF_YEAR, 1L);
    }
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.