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

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

Introduction

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

Prototype

@Override
public long getLastMillisecond(Calendar calendar) 

Source Link

Document

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

Usage

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

/**
 * Some checks for the getLastMillisecond(TimeZone) method.
 *///from   www  .ja  v  a 2 s  . c  om
@Test
public void testGetLastMillisecondWithTimeZone() {
    Year y = new Year(1950);
    TimeZone zone = TimeZone.getTimeZone("America/Los_Angeles");
    assertEquals(-599587200001L, y.getLastMillisecond(zone));

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

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

/**
 * In GMT, the end of 2001 is java.util.Date(1009843199999L).  Use this to
 * check the year constructor.// w  w w .ja  v a2s.com
 */
@Test
public void testDateConstructor1() {

    TimeZone zone = TimeZone.getTimeZone("GMT");
    Date d1 = new Date(1009843199999L);
    Date d2 = new Date(1009843200000L);
    Year y1 = new Year(d1, zone);
    Year y2 = new Year(d2, zone);

    assertEquals(2001, y1.getYear());
    assertEquals(1009843199999L, y1.getLastMillisecond(zone));

    assertEquals(2002, y2.getYear());
    assertEquals(1009843200000L, y2.getFirstMillisecond(zone));

}

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

/**
 * In Los Angeles, the end of 2001 is java.util.Date(1009871999999L).  Use
 * this to check the year constructor./* w ww. j ava2s .  c om*/
 */
@Test
public void testDateConstructor2() {

    TimeZone zone = TimeZone.getTimeZone("America/Los_Angeles");
    Year y1 = new Year(new Date(1009871999999L), zone);
    Year y2 = new Year(new Date(1009872000000L), zone);

    assertEquals(2001, y1.getYear());
    assertEquals(1009871999999L, y1.getLastMillisecond(zone));

    assertEquals(2002, y2.getYear());
    assertEquals(1009872000000L, y2.getFirstMillisecond(zone));

}

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

/**
 * Some checks for the getLastMillisecond(TimeZone) method.
 */// w  w w .  j a v  a2  s. com
@Test
public void testGetLastMillisecondWithCalendar() {
    Year y = new Year(2001);
    GregorianCalendar calendar = new GregorianCalendar(Locale.GERMANY);
    calendar.setTimeZone(TimeZone.getTimeZone("Europe/Frankfurt"));
    assertEquals(1009843199999L, y.getLastMillisecond(calendar));

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