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

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

Introduction

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

Prototype

@Override
public long getLastMillisecond(Calendar calendar) 

Source Link

Document

Returns the last millisecond of the time period.

Usage

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

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

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

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

/**
 * In GMT, the 4.55:59.123pm on 21 Mar 2002 is
 * java.util.Date(1016729759123L).  Use this to check the Millisecond
 * constructor.//from  w w w  . ja  va2  s. c  om
 */
@Test
public void testDateConstructor1() {
    TimeZone zone = TimeZone.getTimeZone("GMT");
    Locale locale = Locale.getDefault(); // locale should not matter here
    Millisecond m1 = new Millisecond(new Date(1016729759122L), zone, locale);
    Millisecond m2 = new Millisecond(new Date(1016729759123L), zone, locale);

    assertEquals(122, m1.getMillisecond());
    assertEquals(1016729759122L, m1.getLastMillisecond(zone));

    assertEquals(123, m2.getMillisecond());
    assertEquals(1016729759123L, m2.getFirstMillisecond(zone));
}

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

/**
 * In Tallinn, the 4.55:59.123pm on 21 Mar 2002 is
 * java.util.Date(1016722559123L).  Use this to check the Millisecond
 * constructor.//from w ww  .j  a v  a 2s. c o  m
 */
@Test
public void testDateConstructor2() {
    TimeZone zone = TimeZone.getTimeZone("Europe/Tallinn");
    Locale locale = Locale.getDefault(); // locale should not matter here
    Millisecond m1 = new Millisecond(new Date(1016722559122L), zone, locale);
    Millisecond m2 = new Millisecond(new Date(1016722559123L), zone, locale);

    assertEquals(122, m1.getMillisecond());
    assertEquals(1016722559122L, m1.getLastMillisecond(zone));

    assertEquals(123, m2.getMillisecond());
    assertEquals(1016722559123L, m2.getFirstMillisecond(zone));
}

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

/**
 * Some checks for the getLastMillisecond(TimeZone) method.
 *///from  w ww .jav a 2 s .com
public void testGetLastMillisecondWithTimeZone() {
    Millisecond m = new Millisecond(750, 55, 1, 2, 7, 7, 1950);
    TimeZone zone = TimeZone.getTimeZone("America/Los_Angeles");
    Calendar c = new GregorianCalendar(zone);
    assertEquals(-614962684250L, m.getLastMillisecond(c));

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

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

/**
 * Some checks for the getLastMillisecond(TimeZone) method.
 *///from   ww w. j a  v  a2s . c  om
@Test
public void testGetLastMillisecondWithCalendar() {
    Millisecond m = new Millisecond(250, 50, 45, 21, 21, 4, 2001);
    GregorianCalendar calendar = new GregorianCalendar(Locale.GERMANY);
    calendar.setTimeZone(TimeZone.getTimeZone("Europe/Frankfurt"));
    assertEquals(987889550250L, m.getLastMillisecond(calendar));

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

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

/**
 * In GMT, the 4.55:59.123pm on 21 Mar 2002 is
 * java.util.Date(1016729759123L).  Use this to check the Millisecond
 * constructor./*from w  ww.j  ava 2s.  co m*/
 */
public void testDateConstructor1() {
    TimeZone zone = TimeZone.getTimeZone("GMT");
    Locale locale = Locale.getDefault(); // locale should not matter here
    Calendar c = new GregorianCalendar(zone);
    Millisecond m1 = new Millisecond(new Date(1016729759122L), zone, locale);
    Millisecond m2 = new Millisecond(new Date(1016729759123L), zone, locale);

    assertEquals(122, m1.getMillisecond());
    assertEquals(1016729759122L, m1.getLastMillisecond(c));

    assertEquals(123, m2.getMillisecond());
    assertEquals(1016729759123L, m2.getFirstMillisecond(c));
}

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

/**
 * In Tallinn, the 4.55:59.123pm on 21 Mar 2002 is
 * java.util.Date(1016722559123L).  Use this to check the Millisecond
 * constructor./*from  w  w  w . j  av  a 2  s  .c  o m*/
 */
public void testDateConstructor2() {
    TimeZone zone = TimeZone.getTimeZone("Europe/Tallinn");
    Locale locale = Locale.getDefault(); // locale should not matter here
    Calendar c = new GregorianCalendar(zone);
    Millisecond m1 = new Millisecond(new Date(1016722559122L), zone, locale);
    Millisecond m2 = new Millisecond(new Date(1016722559123L), zone, locale);

    assertEquals(122, m1.getMillisecond());
    assertEquals(1016722559122L, m1.getLastMillisecond(c));

    assertEquals(123, m2.getMillisecond());
    assertEquals(1016722559123L, m2.getFirstMillisecond(c));
}

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

/**
 * Some checks for the getLastMillisecond(TimeZone) method.
 *//*from w ww . j  a  v a 2s.c o  m*/
public void testGetLastMillisecondWithCalendar() {
    Millisecond m = new Millisecond(250, 50, 45, 21, 21, 4, 2001);
    GregorianCalendar calendar = new GregorianCalendar(Locale.GERMANY);
    calendar.setTimeZone(TimeZone.getTimeZone("Europe/Frankfurt"));
    assertEquals(987889550250L, m.getLastMillisecond(calendar));

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