Examples of PadPrinterParserDecorator


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

public class TestPadParserDecorator extends AbstractTestPrinterParser {

    //-----------------------------------------------------------------------
    @Test(expectedExceptions=IndexOutOfBoundsException.class)
    public void test_parse_negativePosition() throws Exception {
        PadPrinterParserDecorator pp = new PadPrinterParserDecorator(new CharLiteralPrinterParser('Z'), 3, '-');
        pp.parse(parseContext, "--Z", -1);
    }
View Full Code Here

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

        pp.parse(parseContext, "--Z", -1);
    }

    @Test(expectedExceptions=IndexOutOfBoundsException.class)
    public void test_parse_offEndPosition() throws Exception {
        PadPrinterParserDecorator pp = new PadPrinterParserDecorator(new CharLiteralPrinterParser('Z'), 3, '-');
        pp.parse(parseContext, "--Z", 4);
    }
View Full Code Here

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

        pp.parse(parseContext, "--Z", 4);
    }

    //-----------------------------------------------------------------------
    public void test_parse() throws Exception {
        PadPrinterParserDecorator pp = new PadPrinterParserDecorator(new NumberPrinterParser(MONTH_OF_YEAR, 1, 3, SignStyle.NEVER), 3, '-');
        int result = pp.parse(parseContext, "--2", 0);
        assertEquals(result, 3);
        assertParsed(MONTH_OF_YEAR, 2L);
    }
View Full Code Here

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

        assertEquals(result, 3);
        assertParsed(MONTH_OF_YEAR, 2L);
    }

    public void test_parse_noReadBeyond() throws Exception {
        PadPrinterParserDecorator pp = new PadPrinterParserDecorator(new NumberPrinterParser(MONTH_OF_YEAR, 1, 3, SignStyle.NEVER), 3, '-');
        int result = pp.parse(parseContext, "--22", 0);
        assertEquals(result, 3);
        assertParsed(MONTH_OF_YEAR, 2L);
    }
View Full Code Here

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

        assertEquals(result, 3);
        assertParsed(MONTH_OF_YEAR, 2L);
    }

    public void test_parse_textLessThanPadWidth() throws Exception {
        PadPrinterParserDecorator pp = new PadPrinterParserDecorator(new NumberPrinterParser(MONTH_OF_YEAR, 1, 3, SignStyle.NEVER), 3, '-');
        int result = pp.parse(parseContext, "-1", 0);
        assertEquals(result, ~0);
    }
View Full Code Here

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

        int result = pp.parse(parseContext, "-1", 0);
        assertEquals(result, ~0);
    }

    public void test_parse_decoratedErrorPassedBack() throws Exception {
        PadPrinterParserDecorator pp = new PadPrinterParserDecorator(new NumberPrinterParser(MONTH_OF_YEAR, 1, 3, SignStyle.NEVER), 3, '-');
        int result = pp.parse(parseContext, "--A", 0);
        assertEquals(result, ~2);
    }
View Full Code Here

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

        int result = pp.parse(parseContext, "--A", 0);
        assertEquals(result, ~2);
    }

    public void test_parse_decoratedDidNotParseToPadWidth() throws Exception {
        PadPrinterParserDecorator pp = new PadPrinterParserDecorator(new NumberPrinterParser(MONTH_OF_YEAR, 1, 3, SignStyle.NEVER), 3, '-');
        int result = pp.parse(parseContext, "-1X", 0);
        assertEquals(result, ~1);
    }
View Full Code Here

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

@Test
public class TestPadPrinterDecorator extends AbstractTestPrinterParser {

    //-----------------------------------------------------------------------
    public void test_print_emptyCalendrical() throws Exception {
        PadPrinterParserDecorator pp = new PadPrinterParserDecorator(new CharLiteralPrinterParser('Z'), 3, '-');
        pp.print(printEmptyContext, buf);
        assertEquals(buf.toString(), "--Z");
    }
View Full Code Here

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

        assertEquals(buf.toString(), "--Z");
    }

    public void test_print_fullDateTime() throws Exception {
        printContext.setDateTime(LocalDate.of(2008, 12, 3));
        PadPrinterParserDecorator pp = new PadPrinterParserDecorator(new CharLiteralPrinterParser('Z'), 3, '-');
        pp.print(printContext, buf);
        assertEquals(buf.toString(), "--Z");
    }
View Full Code Here

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

        assertEquals(buf.toString(), "--Z");
    }

    public void test_print_append() throws Exception {
        buf.append("EXISTING");
        PadPrinterParserDecorator pp = new PadPrinterParserDecorator(new CharLiteralPrinterParser('Z'), 3, '-');
        pp.print(printEmptyContext, buf);
        assertEquals(buf.toString(), "EXISTING--Z");
    }
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.