Examples of TextPrinterParser


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

    }

    //-----------------------------------------------------------------------
    public void test_parse_full_lenient_full_match() throws Exception {
        parseContext.setStrict(false);
        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_lenient_short_match() throws Exception {
        parseContext.setStrict(false);
        TextPrinterParser pp = new TextPrinterParser(MONTH_OF_YEAR, TextStyle.FULL, 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_full_lenient_number_match() throws Exception {
        parseContext.setStrict(false);
        TextPrinterParser pp = new TextPrinterParser(MONTH_OF_YEAR, TextStyle.FULL, PROVIDER);
        int newPos = pp.parse(parseContext, "1", 0);
        assertEquals(newPos, 1);
        assertParsed(parseContext, MONTH_OF_YEAR, 1L);
    }
View Full Code Here

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

    }

    //-----------------------------------------------------------------------
    public void test_parse_short_lenient_full_match() throws Exception {
        parseContext.setStrict(false);
        TextPrinterParser pp = new TextPrinterParser(MONTH_OF_YEAR, TextStyle.SHORT, 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_short_lenient_short_match() throws Exception {
        parseContext.setStrict(false);
        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_lenient_number_match() throws Exception {
        parseContext.setStrict(false);
        TextPrinterParser pp = new TextPrinterParser(MONTH_OF_YEAR, TextStyle.SHORT, PROVIDER);
        int newPos = pp.parse(parseContext, "1", 0);
        assertEquals(newPos, 1);
        assertParsed(parseContext, MONTH_OF_YEAR, 1L);
    }
View Full Code Here

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

    private static final DateTimeTextProvider PROVIDER = DateTimeTextProvider.getInstance();

    //-----------------------------------------------------------------------
    @Test(expectedExceptions=DateTimeException.class)
    public void test_print_emptyCalendrical() throws Exception {
        TextPrinterParser pp = new TextPrinterParser(DAY_OF_WEEK, TextStyle.FULL, PROVIDER);
        pp.print(printEmptyContext, buf);
    }
View Full Code Here

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

        pp.print(printEmptyContext, buf);
    }

    public void test_print_append() throws Exception {
        printContext.setDateTime(LocalDate.of(2012, 4, 18));
        TextPrinterParser pp = new TextPrinterParser(DAY_OF_WEEK, TextStyle.FULL, PROVIDER);
        buf.append("EXISTING");
        pp.print(printContext, buf);
        assertEquals(buf.toString(), "EXISTINGWednesday");
    }
View Full Code Here

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

    }

    @Test(dataProvider="print")
    public void test_print(TemporalField field, TextStyle style, int value, String expected) throws Exception {
        printContext.setDateTime(new MockFieldValue(field, value));
        TextPrinterParser pp = new TextPrinterParser(field, style, PROVIDER);
        pp.print(printContext, buf);
        assertEquals(buf.toString(), expected);
    }
View Full Code Here

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

    //-----------------------------------------------------------------------
    public void test_print_french_long() throws Exception {
        printContext.setLocale(Locale.FRENCH);
        printContext.setDateTime(LocalDate.of(2012, 1, 1));
        TextPrinterParser pp = new TextPrinterParser(MONTH_OF_YEAR, TextStyle.FULL, PROVIDER);
        pp.print(printContext, buf);
        assertEquals(buf.toString(), "janvier");
    }
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.