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

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

Introduction

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

Prototype

@Override
public long getFirstMillisecond(Calendar calendar) 

Source Link

Document

Returns the first 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 getFirstMillisecond(TimeZone) method.
 */// ww  w  .j  a va  2  s .c om
@Test
public void testGetFirstMillisecondWithTimeZone() {
    Month m = new Month(2, 1950);
    TimeZone zone = TimeZone.getTimeZone("America/Los_Angeles");
    assertEquals(-628444800000L, m.getFirstMillisecond(zone));

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

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

/**
 * Some checks for the getFirstMillisecond(TimeZone) method.
 *///from w  w w.ja va  2  s .  com
public void testGetFirstMillisecondWithTimeZone() {
    Month m = new Month(2, 1950);
    TimeZone zone = TimeZone.getTimeZone("America/Los_Angeles");
    Calendar c = new GregorianCalendar(zone);
    assertEquals(-628444800000L, m.getFirstMillisecond(c));

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

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

/**
 * Some checks for the getFirstMillisecond(TimeZone) method.
 *//*w w w  . j  a  va  2s . c om*/
@Test
public void testGetFirstMillisecondWithCalendar() {
    Month m = new Month(1, 2001);
    GregorianCalendar calendar = new GregorianCalendar(Locale.GERMANY);
    calendar.setTimeZone(TimeZone.getTimeZone("Europe/Frankfurt"));
    assertEquals(978307200000L, m.getFirstMillisecond(calendar));

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

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

/**
 * Some checks for the getFirstMillisecond(TimeZone) method.
 *//*from  w w  w .j ava2  s  .c o m*/
public void testGetFirstMillisecondWithCalendar() {
    Month m = new Month(1, 2001);
    GregorianCalendar calendar = new GregorianCalendar(Locale.GERMANY);
    calendar.setTimeZone(TimeZone.getTimeZone("Europe/Frankfurt"));
    assertEquals(978307200000L, m.getFirstMillisecond(calendar));

    // try null calendar
    boolean pass = false;
    try {
        m.getFirstMillisecond((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./* w w w .j av  a  2 s .c o  m*/
 */
@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.
 *///from www .j  a  v  a  2s.  c o  m
@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.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./*from   w  ww.  java2 s  .  c o  m*/
 */
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  a  v a 2 s.co  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));

}