Examples of TemporalAccessor


Examples of org.threeten.bp.temporal.TemporalAccessor

    @Test
    public void test_appendValue_subsequent2_parse5() throws Exception {
        builder.appendValue(MONTH_OF_YEAR, 1, 2, SignStyle.NORMAL).appendValue(DAY_OF_MONTH, 2).appendLiteral('4');
        DateTimeFormatter f = builder.toFormatter();
        assertEquals(f.toString(), "Value(MonthOfYear,1,2,NORMAL)Value(DayOfMonth,2)'4'");
        TemporalAccessor cal = f.parseUnresolved("01234", new ParsePosition(0));
        assertEquals(cal.get(MONTH_OF_YEAR), 1);
        assertEquals(cal.get(DAY_OF_MONTH), 23);
    }
View Full Code Here

Examples of org.threeten.bp.temporal.TemporalAccessor

            .appendValue(YEAR, 4, 10, SignStyle.EXCEEDS_PAD)
            .appendValue(MONTH_OF_YEAR, 2)
            .appendValue(DAY_OF_MONTH, 2);
        DateTimeFormatter f = builder.toFormatter();
        assertEquals(f.toString(), "Value(Year,4,10,EXCEEDS_PAD)Value(MonthOfYear,2)Value(DayOfMonth,2)");
        TemporalAccessor cal = f.parseUnresolved("20090630", new ParsePosition(0));
        assertEquals(cal.get(YEAR), 2009);
        assertEquals(cal.get(MONTH_OF_YEAR), 6);
        assertEquals(cal.get(DAY_OF_MONTH), 30);
    }
View Full Code Here

Examples of org.threeten.bp.temporal.TemporalAccessor

    @Test
    public void test_appendValueReduced() throws Exception {
        builder.appendValueReduced(YEAR, 2, 2, 2000);
        DateTimeFormatter f = builder.toFormatter();
        assertEquals(f.toString(), "ReducedValue(Year,2,2,2000)");
        TemporalAccessor cal = f.parseUnresolved("12", new ParsePosition(0));
        assertEquals(cal.get(YEAR), 2012);
    }
View Full Code Here

Examples of org.threeten.bp.temporal.TemporalAccessor

    @Test
    public void test_appendValueReduced_subsequent_parse() throws Exception {
        builder.appendValue(MONTH_OF_YEAR, 1, 2, SignStyle.NORMAL).appendValueReduced(YEAR, 2, 2, 2000);
        DateTimeFormatter f = builder.toFormatter();
        assertEquals(f.toString(), "Value(MonthOfYear,1,2,NORMAL)ReducedValue(Year,2,2,2000)");
        TemporalAccessor cal = f.parseUnresolved("123", new ParsePosition(0));
        assertEquals(cal.get(MONTH_OF_YEAR), 1);
        assertEquals(cal.get(YEAR), 2023);
    }
View Full Code Here

Examples of org.threeten.bp.temporal.TemporalAccessor

        };
    }

    @Test(dataProvider = "instantZones")
    public void test_parse_instantZones_ZDT(DateTimeFormatter formatter, String text, ZonedDateTime expected) {
        TemporalAccessor actual = formatter.parse(text);
        assertEquals(ZonedDateTime.from(actual), expected);
    }
View Full Code Here

Examples of org.threeten.bp.temporal.TemporalAccessor

        assertEquals(ZonedDateTime.from(actual), expected);
    }

    @Test(dataProvider = "instantZones")
    public void test_parse_instantZones_LDT(DateTimeFormatter formatter, String text, ZonedDateTime expected) {
        TemporalAccessor actual = formatter.parse(text);
        assertEquals(LocalDateTime.from(actual), expected.toLocalDateTime());
    }
View Full Code Here

Examples of org.threeten.bp.temporal.TemporalAccessor

        assertEquals(LocalDateTime.from(actual), expected.toLocalDateTime());
    }

    @Test(dataProvider = "instantZones")
    public void test_parse_instantZones_Instant(DateTimeFormatter formatter, String text, ZonedDateTime expected) {
        TemporalAccessor actual = formatter.parse(text);
        assertEquals(Instant.from(actual), expected.toInstant());
    }
View Full Code Here

Examples of org.threeten.bp.temporal.TemporalAccessor

        assertEquals(Instant.from(actual), expected.toInstant());
    }

    @Test(dataProvider = "instantZones")
    public void test_parse_instantZones_supported(DateTimeFormatter formatter, String text, ZonedDateTime expected) {
        TemporalAccessor actual = formatter.parse(text);
        assertEquals(actual.isSupported(INSTANT_SECONDS), true);
        assertEquals(actual.isSupported(EPOCH_DAY), true);
        assertEquals(actual.isSupported(SECOND_OF_DAY), true);
        assertEquals(actual.isSupported(NANO_OF_SECOND), true);
        assertEquals(actual.isSupported(MICRO_OF_SECOND), true);
        assertEquals(actual.isSupported(MILLI_OF_SECOND), true);
    }
View Full Code Here

Examples of org.threeten.bp.temporal.TemporalAccessor

        };
    }

    @Test(dataProvider = "instantNoZone", expectedExceptions = DateTimeException.class)
    public void test_parse_instantNoZone_ZDT(DateTimeFormatter formatter, String text, Instant expected) {
        TemporalAccessor actual = formatter.parse(text);
        ZonedDateTime.from(actual);
    }
View Full Code Here

Examples of org.threeten.bp.temporal.TemporalAccessor

        ZonedDateTime.from(actual);
    }

    @Test(dataProvider = "instantNoZone", expectedExceptions = DateTimeException.class)
    public void test_parse_instantNoZone_LDT(DateTimeFormatter formatter, String text, Instant expected) {
        TemporalAccessor actual = formatter.parse(text);
        LocalDateTime.from(actual);
    }
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.