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

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

Introduction

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

Prototype

@Override
public long getLastMillisecond(Calendar calendar) 

Source Link

Document

Returns the last millisecond of the minute.

Usage

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

/**
 * Some checks for the getLastMillisecond(TimeZone) method.
 *///from   w w w  .jav a 2s  .  co m
@Test
public void testGetLastMillisecondWithTimeZone() {
    Minute m = new Minute(1, 2, 7, 7, 1950);
    TimeZone zone = TimeZone.getTimeZone("America/Los_Angeles");
    assertEquals(-614962680001L, 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.MinuteTest.java

/**
 * In GMT, the 4.55pm on 21 Mar 2002 is java.util.Date(1016729700000L).
 * Use this to check the Minute constructor.
 *///from   www.j  av  a2 s  .c o  m
@Test
public void testDateConstructor1() {
    TimeZone zone = TimeZone.getTimeZone("GMT");
    Locale locale = Locale.getDefault(); // locale should not matter here
    Minute m1 = new Minute(new Date(1016729699999L), zone, locale);
    Minute m2 = new Minute(new Date(1016729700000L), zone, locale);

    assertEquals(54, m1.getMinute());
    assertEquals(1016729699999L, m1.getLastMillisecond(zone));

    assertEquals(55, m2.getMinute());
    assertEquals(1016729700000L, m2.getFirstMillisecond(zone));
}

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

/**
 * In Singapore, the 4.55pm on 21 Mar 2002 is
 * java.util.Date(1,014,281,700,000L). Use this to check the Minute
 * constructor./*from w w w  . j ava2  s  . c  o  m*/
 */
@Test
public void testDateConstructor2() {
    TimeZone zone = TimeZone.getTimeZone("Asia/Singapore");
    Locale locale = Locale.getDefault(); // locale should not matter here
    Minute m1 = new Minute(new Date(1016700899999L), zone, locale);
    Minute m2 = new Minute(new Date(1016700900000L), zone, locale);

    assertEquals(54, m1.getMinute());
    assertEquals(1016700899999L, m1.getLastMillisecond(zone));

    assertEquals(55, m2.getMinute());
    assertEquals(1016700900000L, m2.getFirstMillisecond(zone));
}

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

/**
 * Some checks for the getLastMillisecond(TimeZone) method.
 *//*  w  w w.ja  va  2s . co m*/
public void testGetLastMillisecondWithTimeZone() {
    Minute m = new Minute(1, 2, 7, 7, 1950);
    TimeZone zone = TimeZone.getTimeZone("America/Los_Angeles");
    Calendar c = new GregorianCalendar(zone);
    assertEquals(-614962680001L, 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.MinuteTest.java

/**
 * Some checks for the getLastMillisecond(TimeZone) method.
 *///w  w w .  java 2  s.com
@Test
public void testGetLastMillisecondWithCalendar() {
    Minute m = new Minute(45, 21, 21, 4, 2001);
    GregorianCalendar calendar = new GregorianCalendar(Locale.GERMANY);
    calendar.setTimeZone(TimeZone.getTimeZone("Europe/Frankfurt"));
    assertEquals(987889559999L, 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.MinuteTest.java

/**
 * In GMT, the 4.55pm on 21 Mar 2002 is java.util.Date(1016729700000L).
 * Use this to check the Minute constructor.
 *///  w ww .j  a  va2  s . c  om
public void testDateConstructor1() {
    TimeZone zone = TimeZone.getTimeZone("GMT");
    Locale locale = Locale.getDefault(); // locale should not matter here
    Calendar c = new GregorianCalendar(zone);
    Minute m1 = new Minute(new Date(1016729699999L), zone, locale);
    Minute m2 = new Minute(new Date(1016729700000L), zone, locale);

    assertEquals(54, m1.getMinute());
    assertEquals(1016729699999L, m1.getLastMillisecond(c));

    assertEquals(55, m2.getMinute());
    assertEquals(1016729700000L, m2.getFirstMillisecond(c));
}

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

/**
 * In Singapore, the 4.55pm on 21 Mar 2002 is
 * java.util.Date(1,014,281,700,000L). Use this to check the Minute
 * constructor.//from   ww w .  java  2  s . c o m
 */
public void testDateConstructor2() {
    TimeZone zone = TimeZone.getTimeZone("Asia/Singapore");
    Locale locale = Locale.getDefault(); // locale should not matter here
    Calendar c = new GregorianCalendar(zone);
    Minute m1 = new Minute(new Date(1016700899999L), zone, locale);
    Minute m2 = new Minute(new Date(1016700900000L), zone, locale);

    assertEquals(54, m1.getMinute());
    assertEquals(1016700899999L, m1.getLastMillisecond(c));

    assertEquals(55, m2.getMinute());
    assertEquals(1016700900000L, m2.getFirstMillisecond(c));
}

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

/**
 * Some checks for the getLastMillisecond(TimeZone) method.
 *//*w  w  w .ja v  a  2s  .  com*/
public void testGetLastMillisecondWithCalendar() {
    Minute m = new Minute(45, 21, 21, 4, 2001);
    GregorianCalendar calendar = new GregorianCalendar(Locale.GERMANY);
    calendar.setTimeZone(TimeZone.getTimeZone("Europe/Frankfurt"));
    assertEquals(987889559999L, m.getLastMillisecond(calendar));

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