Package in.partake.base

Examples of in.partake.base.DateTime


            byte[] data = new byte[N];
            for (int i = 0; i < N; ++i) {
                data[i] = (byte)(i % N);
            }

            return new UserImage(uuid.toString(), DEFAULT_USER_ID, "data/octet-stream", data, new DateTime(objNumber));
        } else {
            return new UserImage(uuid.toString(), DEFAULT_USER_ID, "data/octet-stream", new byte[] { 1, 2, (byte) objNumber }, new DateTime(objNumber));
        }
    }
View Full Code Here


    }

    @Override
    public List<UserImage> createSamples() {
        List<UserImage> array = new ArrayList<UserImage>();
        array.add(new UserImage("id", "userId", "type", new byte[] { 0, 1, 2 } , new DateTime(0)));
        array.add(new UserImage("id1", "userId", "type", new byte[] { 0, 1, 2 } , new DateTime(0)));
        array.add(new UserImage("id", "userId1", "type", new byte[] { 0, 1, 2 } , new DateTime(0)));
        array.add(new UserImage("id", "userId", "type1", new byte[] { 0, 1, 2 } , new DateTime(0)));
        array.add(new UserImage("id", "userId", "type", new byte[] { 0, 1, 3 } , new DateTime(0)));
        array.add(new UserImage("id", "userId", "type", new byte[] { 0, 1, 2 } , new DateTime(1)));
        return array;
    }
View Full Code Here

        // IMAGE_OWNED_BY_DEFAULT_USER_ID contains DEFAULT_IMAGE_ID.
        dao.put(con, new UserImage(EVENT_FOREIMAGE_ID, EVENT_OWNER_ID, "byte/octet-stream", defaultImageContent, TimeUtil.getCurrentDateTime()));
        dao.put(con, new UserImage(EVENT_BACKIMAGE_ID, EVENT_OWNER_ID, "byte/octet-stream", defaultImageContent, TimeUtil.getCurrentDateTime()));
        dao.put(con, new UserImage(IMAGE_OWNER_IMAGE_ID, IMAGE_OWNER_ID, "byte/octet-stream", defaultImageContent, TimeUtil.getCurrentDateTime()));
        for (int i = 0; i < IMAGE_OWNED_BY_DEFAULT_USER_ID.length; ++i)
            dao.put(con, new UserImage(IMAGE_OWNED_BY_DEFAULT_USER_ID[i], DEFAULT_USER_ID, "byte/octet-stream", defaultImageContent, new DateTime(IMAGE_OWNED_BY_DEFAULT_USER_ID.length - i)));
    }
View Full Code Here

    // -----------------------------------------
    // readableDate
    @Test
    public void testReadableDateAtMorning() {
        DateTime date = createDate(2010, 1, 1, 9, 0);
        Assert.assertEquals("2010年1月1日(金) 09:00", Helper.readableDate(date));
    }
View Full Code Here

        Assert.assertEquals("2010年1月1日(金) 09:00", Helper.readableDate(date));
    }

    @Test
    public void testReadableDateAtAfternoon() {
        DateTime date = createDate(2010, 1, 1, 15, 0);
        Assert.assertEquals("2010年1月1日(金) 15:00", Helper.readableDate(date));
    }
View Full Code Here

        Assert.assertEquals("2010年1月1日(金) 15:00", Helper.readableDate(date));
    }

    @Test
    public void testReadableDateAtMidnight() {
        DateTime lastMin  = createDate(2010, 1, 1, 23, 59);
        Assert.assertEquals("2010年1月1日(金) 23:59", Helper.readableDate(lastMin));

        DateTime midnight = createDate(2010, 1, 1, 24, 0);
        Assert.assertEquals("2010年1月2日(土) 00:00", Helper.readableDate(midnight));
    }
View Full Code Here

        Assert.assertEquals("2010年1月2日(土) 00:00", Helper.readableDate(midnight));
    }

    @Test
    public void testZeroSuppressed() {
        DateTime saturday  = createDate(2010, 01, 01, 11, 22);
        Assert.assertEquals("2010年1月1日(金) 11:22", Helper.readableDate(saturday));
    }
View Full Code Here

        Assert.assertEquals("2010年1月1日(金) 11:22", Helper.readableDate(saturday));
    }

    @Test
    public void testZeropaddinged() {
        DateTime saturday  = createDate(0001, 12, 23, 00, 00);
        Assert.assertEquals("0001年12月23日(金) 00:00", Helper.readableDate(saturday));
    }
View Full Code Here

        Assert.assertEquals("0001年12月23日(金) 00:00", Helper.readableDate(saturday));
    }

    @Test
    public void testReadableDateAllDaysOfWeek() {
        DateTime sunday    = createDate(2010, 12, 26, 00, 00);
        Assert.assertEquals("2010年12月26日(日) 00:00", Helper.readableDate(sunday));

        DateTime monday    = createDate(2010, 12, 27, 00, 00);
        Assert.assertEquals("2010年12月27日(月) 00:00", Helper.readableDate(monday));

        DateTime tuesday   = createDate(2010, 12, 28, 00, 00);
        Assert.assertEquals("2010年12月28日(火) 00:00", Helper.readableDate(tuesday));

        DateTime wednesday = createDate(2010, 12, 29, 00, 00);
        Assert.assertEquals("2010年12月29日(水) 00:00", Helper.readableDate(wednesday));

        DateTime thursday  = createDate(2010, 12, 30, 00, 00);
        Assert.assertEquals("2010年12月30日(木) 00:00", Helper.readableDate(thursday));

        DateTime friday    = createDate(2010, 12, 31, 00, 00);
        Assert.assertEquals("2010年12月31日(金) 00:00", Helper.readableDate(friday));

        DateTime saturday  = createDate(2011, 01, 01, 00, 00);
        Assert.assertEquals("2011年1月1日(土) 00:00", Helper.readableDate(saturday));
    }
View Full Code Here

    // -----------------------------------------
    // readableDuration
    @Test
    public void testReadableDuration1Day() {
        DateTime beginDate = createDate(2010, 1, 19, 0);
        DateTime endDate   = createDate(2010, 1, 1, 14, 0);
        Assert.assertEquals("2010年1月1日(金) 09:00 - 14:00", Helper.readableDuration(beginDate, endDate));
    }
View Full Code Here

TOP

Related Classes of in.partake.base.DateTime

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.