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

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

Introduction

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

Prototype

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

Source Link

Document

Creates a new second based on the supplied time and time zone.

Usage

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

/**
 * In GMT, the 4.55:59pm on 21 Mar 2002 is java.util.Date(1016729759000L).
 * Use this to check the Second constructor.
 *///from   w ww .  j a va2  s . c om
@Test
public void testDateConstructor1() {
    TimeZone zone = TimeZone.getTimeZone("GMT");
    Locale locale = Locale.getDefault(); // locale shouldn't matter here
    Second s1 = new Second(new Date(1016729758999L), zone, locale);
    Second s2 = new Second(new Date(1016729759000L), zone, locale);

    assertEquals(58, s1.getSecond());
    assertEquals(1016729758999L, s1.getLastMillisecond(zone));

    assertEquals(59, s2.getSecond());
    assertEquals(1016729759000L, s2.getFirstMillisecond(zone));
}

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

/**
 * In Chicago, the 4.55:59pm on 21 Mar 2002 is
 * java.util.Date(1016751359000L). Use this to check the Second constructor.
 *//*from   ww w  . j  av  a  2  s.  c o  m*/
@Test
public void testDateConstructor2() {
    TimeZone zone = TimeZone.getTimeZone("America/Chicago");
    Locale locale = Locale.getDefault(); // locale shouldn't matter here
    Second s1 = new Second(new Date(1016751358999L), zone, locale);
    Second s2 = new Second(new Date(1016751359000L), zone, locale);

    assertEquals(58, s1.getSecond());
    assertEquals(1016751358999L, s1.getLastMillisecond(zone));

    assertEquals(59, s2.getSecond());
    assertEquals(1016751359000L, s2.getFirstMillisecond(zone));
}

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

/**
 * In GMT, the 4.55:59pm on 21 Mar 2002 is java.util.Date(1016729759000L).
 * Use this to check the Second constructor.
 *//*  ww w.  j  a  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 shouldn't matter here
    Second s1 = new Second(new Date(1016729758999L), zone, locale);
    Second s2 = new Second(new Date(1016729759000L), zone, locale);

    assertEquals(58, s1.getSecond());
    assertEquals(1016729758999L, s1.getLastMillisecond(c));

    assertEquals(59, s2.getSecond());
    assertEquals(1016729759000L, s2.getFirstMillisecond(c));
}

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

/**
 * In Chicago, the 4.55:59pm on 21 Mar 2002 is
 * java.util.Date(1016751359000L). Use this to check the Second constructor.
 *//*from ww  w .j  a  v a 2 s .c  o m*/
public void testDateConstructor2() {
    TimeZone zone = TimeZone.getTimeZone("America/Chicago");
    Calendar c = new GregorianCalendar(zone);
    Locale locale = Locale.getDefault(); // locale shouldn't matter here
    Second s1 = new Second(new Date(1016751358999L), zone, locale);
    Second s2 = new Second(new Date(1016751359000L), zone, locale);

    assertEquals(58, s1.getSecond());
    assertEquals(1016751358999L, s1.getLastMillisecond(c));

    assertEquals(59, s2.getSecond());
    assertEquals(1016751359000L, s2.getFirstMillisecond(c));
}