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

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

Introduction

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

Prototype

@Override
public long getLastMillisecond(Calendar calendar) 

Source Link

Document

Returns the last millisecond of the second.

Usage

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

/**
 * Some checks for the getLastMillisecond(TimeZone) method.
 *///w  w w  .  j a  v  a 2  s.co  m
@Test
public void testGetLastMillisecondWithTimeZone() {
    Second s = new Second(55, 1, 2, 7, 7, 1950);
    TimeZone zone = TimeZone.getTimeZone("America/Los_Angeles");
    assertEquals(-614962684001L, s.getLastMillisecond(zone));

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

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 w w.  ja va  2  s .c  o m*/
@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  a  va2s.  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

/**
 * Some checks for the getLastMillisecond(TimeZone) method.
 *///from w w w. ja v  a  2 s.  c  o  m
public void testGetLastMillisecondWithTimeZone() {
    Second s = new Second(55, 1, 2, 7, 7, 1950);
    TimeZone zone = TimeZone.getTimeZone("America/Los_Angeles");
    Calendar c = new GregorianCalendar(zone);
    assertEquals(-614962684001L, s.getLastMillisecond(c));

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

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

/**
 * Some checks for the getLastMillisecond(TimeZone) method.
 *///w  w  w . ja v a 2s .c  om
@Test
public void testGetLastMillisecondWithCalendar() {
    Second s = new Second(50, 45, 21, 21, 4, 2001);
    GregorianCalendar calendar = new GregorianCalendar(Locale.GERMANY);
    calendar.setTimeZone(TimeZone.getTimeZone("Europe/Frankfurt"));
    assertEquals(987889550999L, s.getLastMillisecond(calendar));

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

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  w  ww  .  ja  v  a  2  s.com*/
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));
}

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.
 *//*  w  ww  . j  av  a  2  s.  co  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

/**
 * Some checks for the getLastMillisecond(TimeZone) method.
 *//*from w w  w.  ja va 2  s  .  c o  m*/
public void testGetLastMillisecondWithCalendar() {
    Second s = new Second(50, 45, 21, 21, 4, 2001);
    GregorianCalendar calendar = new GregorianCalendar(Locale.GERMANY);
    calendar.setTimeZone(TimeZone.getTimeZone("Europe/Frankfurt"));
    assertEquals(987889550999L, s.getLastMillisecond(calendar));

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