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

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

Introduction

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

Prototype

@Override
public long getLastMillisecond(Calendar calendar) 

Source Link

Document

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

Usage

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

/**
 * Some checks for the getLastMillisecond(TimeZone) method.
 *//*from w w  w .  j  a  va 2 s  .c o  m*/
@Test
public void testGetLastMillisecondWithTimeZone() {
    Month m = new Month(2, 1950);
    TimeZone zone = TimeZone.getTimeZone("America/Los_Angeles");
    assertEquals(-626025600001L, m.getLastMillisecond(zone));

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

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

/**
 * Some checks for the getLastMillisecond(TimeZone) method.
 *///from ww w.j  a v a 2s .  co m
public void testGetLastMillisecondWithTimeZone() {
    Month m = new Month(2, 1950);
    TimeZone zone = TimeZone.getTimeZone("America/Los_Angeles");
    Calendar c = new GregorianCalendar(zone);
    assertEquals(-626025600001L, m.getLastMillisecond(c));

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

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

/**
 * In GMT, the end of Feb 2000 is java.util.Date(951,868,799,999L).  Use
 * this to check the Month constructor.//from  w w  w . ja v a  2s. c  om
 */
@Test
public void testDateConstructor1() {

    TimeZone zone = TimeZone.getTimeZone("GMT");
    Month m1 = new Month(new Date(951868799999L), zone);
    Month m2 = new Month(new Date(951868800000L), zone);

    assertEquals(MonthConstants.FEBRUARY, m1.getMonth());
    assertEquals(951868799999L, m1.getLastMillisecond(zone));

    assertEquals(MonthConstants.MARCH, m2.getMonth());
    assertEquals(951868800000L, m2.getFirstMillisecond(zone));

}

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

/**
 * In Auckland, the end of Feb 2000 is java.util.Date(951,821,999,999L).
 * Use this to check the Month constructor.
 *///  w  w w.ja va 2 s  .  com
@Test
public void testDateConstructor2() {

    TimeZone zone = TimeZone.getTimeZone("Pacific/Auckland");
    Month m1 = new Month(new Date(951821999999L), zone);
    Month m2 = new Month(new Date(951822000000L), zone);

    assertEquals(MonthConstants.FEBRUARY, m1.getMonth());
    assertEquals(951821999999L, m1.getLastMillisecond(zone));

    assertEquals(MonthConstants.MARCH, m2.getMonth());
    assertEquals(951822000000L, m2.getFirstMillisecond(zone));

}

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

/**
 * Some checks for the getLastMillisecond(TimeZone) method.
 *///from w  w  w  .j av  a  2  s  .c o m
@Test
public void testGetLastMillisecondWithCalendar() {
    Month m = new Month(3, 2001);
    GregorianCalendar calendar = new GregorianCalendar(Locale.GERMANY);
    calendar.setTimeZone(TimeZone.getTimeZone("Europe/Frankfurt"));
    assertEquals(986083199999L, m.getLastMillisecond(calendar));

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

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

/**
 * Some checks for the getLastMillisecond(TimeZone) method.
 *//* w  w w.  j  a va 2  s.c  o  m*/
public void testGetLastMillisecondWithCalendar() {
    Month m = new Month(3, 2001);
    GregorianCalendar calendar = new GregorianCalendar(Locale.GERMANY);
    calendar.setTimeZone(TimeZone.getTimeZone("Europe/Frankfurt"));
    assertEquals(986083199999L, m.getLastMillisecond(calendar));

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

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

/**
 * In GMT, the end of Feb 2000 is java.util.Date(951,868,799,999L).  Use
 * this to check the Month constructor./* w ww.ja v  a2  s  . c om*/
 */
public void testDateConstructor1() {

    TimeZone zone = TimeZone.getTimeZone("GMT");
    Calendar c = new GregorianCalendar(zone);
    Locale locale = Locale.UK;
    Month m1 = new Month(new Date(951868799999L), zone, locale);
    Month m2 = new Month(new Date(951868800000L), zone, locale);

    assertEquals(MonthConstants.FEBRUARY, m1.getMonth());
    assertEquals(951868799999L, m1.getLastMillisecond(c));

    assertEquals(MonthConstants.MARCH, m2.getMonth());
    assertEquals(951868800000L, m2.getFirstMillisecond(c));

}

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

/**
 * In Auckland, the end of Feb 2000 is java.util.Date(951,821,999,999L).
 * Use this to check the Month constructor.
 *///from  w  w  w  .  j av  a2 s .c  o m
public void testDateConstructor2() {

    TimeZone zone = TimeZone.getTimeZone("Pacific/Auckland");
    Calendar c = new GregorianCalendar(zone);
    Month m1 = new Month(new Date(951821999999L), zone, Locale.UK);
    Month m2 = new Month(new Date(951822000000L), zone, Locale.UK);

    assertEquals(MonthConstants.FEBRUARY, m1.getMonth());
    assertEquals(951821999999L, m1.getLastMillisecond(c));

    assertEquals(MonthConstants.MARCH, m2.getMonth());
    assertEquals(951822000000L, m2.getFirstMillisecond(c));

}