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

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

Introduction

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

Prototype

public Hour(Date time, TimeZone zone, Locale locale) 

Source Link

Document

Constructs a new instance, based on the supplied date/time evaluated in the specified time zone.

Usage

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.
 *//*from ww w .j  a  v a 2  s .  co  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.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 w  w.j  a  va2s .  com*/
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.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   ww w  .java 2 s . c om*/
@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

/**
 * 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  ww w  .  ja  va2  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));
}