Package org.threeten.bp

Examples of org.threeten.bp.LocalDateTime


    }

    @Test(dataProvider="printText")
    public void test_appendText2arg_print(TemporalField field, TextStyle style, int value, String expected) throws Exception {
        DateTimeFormatter f = builder.appendText(field, style).toFormatter(Locale.ENGLISH);
        LocalDateTime dt = LocalDateTime.of(2010, 1, 1, 0, 0);
        dt = dt.with(field, value);
        String text = f.format(dt);
        assertEquals(text, expected);
    }
View Full Code Here


    @Test(dataProvider="printText")
    public void test_appendText1arg_print(TemporalField field, TextStyle style, int value, String expected) throws Exception {
        if (style == TextStyle.FULL) {
            DateTimeFormatter f = builder.appendText(field).toFormatter(Locale.ENGLISH);
            LocalDateTime dt = LocalDateTime.of(2010, 1, 1, 0, 0);
            dt = dt.with(field, value);
            String text = f.format(dt);
            assertEquals(text, expected);
        }
    }
View Full Code Here

    //-----------------------------------------------------------------------
    @Test
    public void test_print_appendText2arg_french_long() throws Exception {
        DateTimeFormatter f = builder.appendText(MONTH_OF_YEAR, TextStyle.FULL).toFormatter(Locale.FRENCH);
        LocalDateTime dt = LocalDateTime.of(2010, 1, 1, 0, 0);
        String text = f.format(dt);
        assertEquals(text, "janvier");
    }
View Full Code Here

    }

    @Test
    public void test_print_appendText2arg_french_short() throws Exception {
        DateTimeFormatter f = builder.appendText(MONTH_OF_YEAR, TextStyle.SHORT).toFormatter(Locale.FRENCH);
        LocalDateTime dt = LocalDateTime.of(2010, 1, 1, 0, 0);
        String text = f.format(dt);
        assertEquals(text, "janv.");
    }
View Full Code Here

        map.put(10L, "OBR");
        map.put(11L, "NVR");
        map.put(12L, "DBR");
        builder.appendText(MONTH_OF_YEAR, map);
        DateTimeFormatter f = builder.toFormatter();
        LocalDateTime dt = LocalDateTime.of(2010, 1, 1, 0, 0);
        for (Month month : Month.values()) {
            assertEquals(f.format(dt.with(month)), map.get((long) month.getValue()));
        }
    }
View Full Code Here

        map.put(1L, "1st");
        map.put(2L, "2nd");
        map.put(3L, "3rd");
        builder.appendText(DAY_OF_MONTH, map);
        DateTimeFormatter f = builder.toFormatter();
        LocalDateTime dt = LocalDateTime.of(2010, 1, 1, 0, 0);
        assertEquals(f.format(dt.withDayOfMonth(1)), "1st");
        assertEquals(f.format(dt.withDayOfMonth(2)), "2nd");
        assertEquals(f.format(dt.withDayOfMonth(3)), "3rd");
    }
View Full Code Here

    public void test_appendTextMapIncomplete() throws Exception {
        Map<Long, String> map = new HashMap<Long, String>();
        map.put(1L, "JNY");
        builder.appendText(MONTH_OF_YEAR, map);
        DateTimeFormatter f = builder.toFormatter();
        LocalDateTime dt = LocalDateTime.of(2010, 2, 1, 0, 0);
        assertEquals(f.format(dt), "2");
    }
View Full Code Here

        checkOffset(test, LocalDateTime.of(2008, 10, 26, 2, 0, 0, 0), OFFSET_ZERO, 1);
    }

    public void test_London_getOffsetInfo_gap() {
        ZoneRules test = europeLondon();
        final LocalDateTime dateTime = LocalDateTime.of(2008, 3, 30, 1, 0, 0, 0);
        ZoneOffsetTransition trans = checkOffset(test, dateTime, OFFSET_ZERO, GAP);
        assertEquals(trans.isGap(), true);
        assertEquals(trans.isOverlap(), false);
        assertEquals(trans.getOffsetBefore(), OFFSET_ZERO);
        assertEquals(trans.getOffsetAfter(), OFFSET_PONE);
View Full Code Here

        assertEquals(trans.hashCode(), otherTrans.hashCode());
    }

    public void test_London_getOffsetInfo_overlap() {
        ZoneRules test = europeLondon();
        final LocalDateTime dateTime = LocalDateTime.of(2008, 10, 26, 1, 0, 0, 0);
        ZoneOffsetTransition trans = checkOffset(test, dateTime, OFFSET_PONE, OVERLAP);
        assertEquals(trans.isGap(), false);
        assertEquals(trans.isOverlap(), true);
        assertEquals(trans.getOffsetBefore(), OFFSET_PONE);
        assertEquals(trans.getOffsetAfter(), OFFSET_ZERO);
View Full Code Here

        checkOffset(test, LocalDateTime.of(2008, 10, 26, 3, 0, 0, 0), OFFSET_PONE, 1);
    }

    public void test_Paris_getOffsetInfo_gap() {
        ZoneRules test = europeParis();
        final LocalDateTime dateTime = LocalDateTime.of(2008, 3, 30, 2, 0, 0, 0);
        ZoneOffsetTransition trans = checkOffset(test, dateTime, OFFSET_PONE, GAP);
        assertEquals(trans.isGap(), true);
        assertEquals(trans.isOverlap(), false);
        assertEquals(trans.getOffsetBefore(), OFFSET_PONE);
        assertEquals(trans.getOffsetAfter(), OFFSET_PTWO);
View Full Code Here

TOP

Related Classes of org.threeten.bp.LocalDateTime

Copyright © 2018 www.massapicom. 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.