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

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

Introduction

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

Prototype

@Override
public long getLastMillisecond(Calendar calendar) 

Source Link

Document

Returns the last millisecond of the hour.

Usage

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

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

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

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

/**
 * In GMT, the 4pm on 21 Mar 2002 is java.util.Date(1,014,307,200,000L).
 * Use this to check the hour constructor.
 *///  w  ww.  ja va  2 s .c  o m
@Test
public void testDateConstructor1() {
    TimeZone zone = TimeZone.getTimeZone("GMT");
    Locale locale = Locale.getDefault(); // locale should not matter here
    Hour h1 = new Hour(new Date(1014307199999L), zone, locale);
    Hour h2 = new Hour(new Date(1014307200000L), zone, locale);

    assertEquals(15, h1.getHour());
    assertEquals(1014307199999L, h1.getLastMillisecond(zone));

    assertEquals(16, h2.getHour());
    assertEquals(1014307200000L, h2.getFirstMillisecond(zone));
}

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

/**
 * In Sydney, the 4pm on 21 Mar 2002 is java.util.Date(1,014,267,600,000L).
 * Use this to check the hour constructor.
 *///from   w ww .j av a 2  s .  co  m
@Test
public void testDateConstructor2() {
    TimeZone zone = TimeZone.getTimeZone("Australia/Sydney");
    Locale locale = Locale.getDefault(); // locale should not matter here
    Hour h1 = new Hour(new Date(1014267599999L), zone, locale);
    Hour h2 = new Hour(new Date(1014267600000L), zone, locale);

    assertEquals(15, h1.getHour());
    assertEquals(1014267599999L, h1.getLastMillisecond(zone));

    assertEquals(16, h2.getHour());
    assertEquals(1014267600000L, h2.getFirstMillisecond(zone));
}

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

/**
 * Some checks for the getLastMillisecond(TimeZone) method.
 *///ww w  . j  av  a2s .  co m
public void testGetLastMillisecondWithTimeZone() {
    Hour h = new Hour(2, 7, 7, 1950);
    TimeZone zone = TimeZone.getTimeZone("America/Los_Angeles");
    Calendar c = new GregorianCalendar(zone);
    assertEquals(-614959200001L, h.getLastMillisecond(c));

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

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

/**
 * Some checks for the getLastMillisecond(TimeZone) method.
 *//*w ww.j av a 2  s.  c  om*/
@Test
public void testGetLastMillisecondWithCalendar() {
    Hour h = new Hour(21, 21, 4, 2001);
    GregorianCalendar calendar = new GregorianCalendar(Locale.GERMANY);
    calendar.setTimeZone(TimeZone.getTimeZone("Europe/Frankfurt"));
    assertEquals(987890399999L, h.getLastMillisecond(calendar));

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

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

/**
 * In GMT, the 4pm on 21 Mar 2002 is java.util.Date(1,014,307,200,000L).
 * Use this to check the hour constructor.
 *//* w  ww.ja  v a 2  s .c  o m*/
public void testDateConstructor1() {
    TimeZone zone = TimeZone.getTimeZone("GMT");
    Calendar c = new GregorianCalendar(zone);
    Locale locale = Locale.getDefault(); // locale should not matter here
    Hour h1 = new Hour(new Date(1014307199999L), zone, locale);
    Hour h2 = new Hour(new Date(1014307200000L), zone, locale);

    assertEquals(15, h1.getHour());
    assertEquals(1014307199999L, h1.getLastMillisecond(c));

    assertEquals(16, h2.getHour());
    assertEquals(1014307200000L, h2.getFirstMillisecond(c));
}

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

/**
 * In Sydney, the 4pm on 21 Mar 2002 is java.util.Date(1,014,267,600,000L).
 * Use this to check the hour constructor.
 *//*from   w w  w  .  j a  v  a2  s  .  co  m*/
public void testDateConstructor2() {
    TimeZone zone = TimeZone.getTimeZone("Australia/Sydney");
    Locale locale = Locale.getDefault(); // locale should not matter here
    Calendar c = new GregorianCalendar(zone);
    Hour h1 = new Hour(new Date(1014267599999L), zone, locale);
    Hour h2 = new Hour(new Date(1014267600000L), zone, locale);

    assertEquals(15, h1.getHour());
    assertEquals(1014267599999L, h1.getLastMillisecond(c));

    assertEquals(16, h2.getHour());
    assertEquals(1014267600000L, h2.getFirstMillisecond(c));
}

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

/**
 * Some checks for the getLastMillisecond(TimeZone) method.
 *///from ww w  .java2  s . co m
public void testGetLastMillisecondWithCalendar() {
    Hour h = new Hour(21, 21, 4, 2001);
    GregorianCalendar calendar = new GregorianCalendar(Locale.GERMANY);
    calendar.setTimeZone(TimeZone.getTimeZone("Europe/Frankfurt"));
    assertEquals(987890399999L, h.getLastMillisecond(calendar));

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