Example usage for org.jfree.data.time Day getLastMillisecond

List of usage examples for org.jfree.data.time Day getLastMillisecond

Introduction

In this page you can find the example usage for org.jfree.data.time Day getLastMillisecond.

Prototype

@Override
public long getLastMillisecond(Calendar calendar) 

Source Link

Document

Returns the last millisecond of the day, evaluated using the supplied calendar (which determines the time zone).

Usage

From source file:org.jfree.data.time.DayTest.java

/**
 * Some checks for the getLastMillisecond(TimeZone) method.
 *//*from   w ww . ja  v  a 2 s. c  om*/
@Test
public void testGetLastMillisecondWithTimeZone() {
    Day d = new Day(1, 2, 1950);
    TimeZone zone = TimeZone.getTimeZone("America/Los_Angeles");
    assertEquals(-628358400001L, d.getLastMillisecond(zone));

    // try null calendar
    boolean pass = false;
    try {
        d.getLastMillisecond((TimeZone) null);
    } catch (NullPointerException e) {
        pass = true;
    }
    assertTrue(pass);
}

From source file:org.jfree.data.time.DayTest.java

/**
 * Some checks for the getLastMillisecond(TimeZone) method.
 *///from   w  w  w. jav  a  2 s.c o  m
@Test
public void testGetLastMillisecondWithCalendar() {

    Day d = new Day(4, 5, 2001);
    Calendar calendar = Calendar.getInstance(TimeZone.getTimeZone("Europe/London"), Locale.UK);
    assertEquals(989017199999L, d.getLastMillisecond(calendar));

    // try null calendar
    boolean pass = false;
    try {
        d.getLastMillisecond((Calendar) null);
    } catch (NullPointerException e) {
        pass = true;
    }
    assertTrue(pass);
}

From source file:org.jfree.data.time.junit.DayTest.java

/**
 * Some checks for the getLastMillisecond(TimeZone) method.
 *//*from  w w w  . ja va  2s .c  om*/
public void testGetLastMillisecondWithCalendar() {

    Day d = new Day(4, 5, 2001);
    Calendar calendar = Calendar.getInstance(TimeZone.getTimeZone("Europe/London"), Locale.UK);
    assertEquals(989017199999L, d.getLastMillisecond(calendar));

    // try null calendar
    boolean pass = false;
    try {
        d.getLastMillisecond((Calendar) null);
    } catch (NullPointerException e) {
        pass = true;
    }
    assertTrue(pass);
}

From source file:org.jfree.data.time.junit.DayTest.java

/**
 * Some checks for the getLastMillisecond(TimeZone) method.
 *///ww w. jav a  2s. c o m
public void testGetLastMillisecondWithTimeZone() {
    Day d = new Day(1, 2, 1950);
    TimeZone zone = TimeZone.getTimeZone("America/Los_Angeles");
    Calendar c = new GregorianCalendar(zone);
    assertEquals(-628358400001L, d.getLastMillisecond(c));

    // try null calendar
    boolean pass = false;
    try {
        d.getLastMillisecond((Calendar) null);
    } catch (NullPointerException e) {
        pass = true;
    }
    assertTrue(pass);
}

From source file:org.jfree.data.time.DayTest.java

/**
 * In GMT, the end of 29 Feb 2004 is java.util.Date(1,078,099,199,999L).
 * Use this to check the day constructor.
 *//*from w  w  w  .  ja va  2 s. c o m*/
@Test
public void testDateConstructor1() {
    TimeZone zone = TimeZone.getTimeZone("GMT");
    Locale locale = Locale.UK;
    Day d1 = new Day(new Date(1078099199999L), zone, locale);
    Day d2 = new Day(new Date(1078099200000L), zone, locale);

    assertEquals(MonthConstants.FEBRUARY, d1.getMonth());
    assertEquals(1078099199999L, d1.getLastMillisecond(zone));

    assertEquals(MonthConstants.MARCH, d2.getMonth());
    assertEquals(1078099200000L, d2.getFirstMillisecond(zone));
}

From source file:org.jfree.data.time.DayTest.java

/**
 * In Helsinki, the end of 29 Feb 2004 is
 * java.util.Date(1,078,091,999,999L).  Use this to check the Day
 * constructor./*from  w w  w  . j  a v  a2 s.c o  m*/
 */
@Test
public void testDateConstructor2() {
    TimeZone zone = TimeZone.getTimeZone("Europe/Helsinki");
    Locale locale = Locale.getDefault(); // locale shouldn't matter here
    Day d1 = new Day(new Date(1078091999999L), zone, locale);
    Day d2 = new Day(new Date(1078092000000L), zone, locale);

    assertEquals(MonthConstants.FEBRUARY, d1.getMonth());
    assertEquals(1078091999999L, d1.getLastMillisecond(zone));

    assertEquals(MonthConstants.MARCH, d2.getMonth());
    assertEquals(1078092000000L, d2.getFirstMillisecond(zone));
}

From source file:org.jfree.data.time.junit.DayTest.java

/**
 * In GMT, the end of 29 Feb 2004 is java.util.Date(1,078,099,199,999L).
 * Use this to check the day constructor.
 *//*from  w  ww  .  j  av  a2  s.  c  om*/
public void testDateConstructor1() {
    TimeZone zone = TimeZone.getTimeZone("GMT");
    Calendar c = new GregorianCalendar(zone);
    Locale locale = Locale.UK;
    Day d1 = new Day(new Date(1078099199999L), zone, locale);
    Day d2 = new Day(new Date(1078099200000L), zone, locale);

    assertEquals(MonthConstants.FEBRUARY, d1.getMonth());
    assertEquals(1078099199999L, d1.getLastMillisecond(c));

    assertEquals(MonthConstants.MARCH, d2.getMonth());
    assertEquals(1078099200000L, d2.getFirstMillisecond(c));
}

From source file:org.jfree.data.time.junit.DayTest.java

/**
 * In Helsinki, the end of 29 Feb 2004 is
 * java.util.Date(1,078,091,999,999L).  Use this to check the Day
 * constructor./*from  w  ww .j av  a 2  s  .co  m*/
 */
public void testDateConstructor2() {
    TimeZone zone = TimeZone.getTimeZone("Europe/Helsinki");
    Calendar c = new GregorianCalendar(zone);
    Locale locale = Locale.getDefault(); // locale shouldn't matter here
    Day d1 = new Day(new Date(1078091999999L), zone, locale);
    Day d2 = new Day(new Date(1078092000000L), zone, locale);

    assertEquals(MonthConstants.FEBRUARY, d1.getMonth());
    assertEquals(1078091999999L, d1.getLastMillisecond(c));

    assertEquals(MonthConstants.MARCH, d2.getMonth());
    assertEquals(1078092000000L, d2.getFirstMillisecond(c));
}