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

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

Introduction

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

Prototype

@Override
public long getFirstMillisecond(Calendar calendar) 

Source Link

Document

Returns the first millisecond of the minute.

Usage

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

/**
 * Some checks for the getFirstMillisecond(TimeZone) method.
 *//* w ww.  j a va 2s  .  co m*/
@Test
public void testGetFirstMillisecondWithTimeZone() {
    Minute m = new Minute(59, 15, 1, 4, 1950);
    TimeZone zone = TimeZone.getTimeZone("America/Los_Angeles");
    assertEquals(-623289660000L, m.getFirstMillisecond(zone));

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

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

/**
 * Some checks for the getFirstMillisecond(TimeZone) method.
 *//*from  w w  w .j  a v a2 s. com*/
@Test
public void testGetFirstMillisecondWithCalendar() {
    Minute m = new Minute(40, 2, 15, 4, 2000);
    GregorianCalendar calendar = new GregorianCalendar(Locale.GERMANY);
    calendar.setTimeZone(TimeZone.getTimeZone("Europe/Frankfurt"));
    assertEquals(955766400000L, m.getFirstMillisecond(calendar));

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

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

/**
 * Some checks for the getFirstMillisecond(TimeZone) method.
 *///from www. j a  va  2  s .  c  o m
public void testGetFirstMillisecondWithTimeZone() {
    Minute m = new Minute(59, 15, 1, 4, 1950);
    TimeZone zone = TimeZone.getTimeZone("America/Los_Angeles");
    Calendar c = new GregorianCalendar(zone);
    assertEquals(-623289660000L, m.getFirstMillisecond(c));

    // try null calendar
    boolean pass = false;
    try {
        m.getFirstMillisecond((Calendar) 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.
 *//*  w w w.ja va  2  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 ww w.  j ava2s  .  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 getFirstMillisecond(TimeZone) method.
 *///from   w w w  . j  a va2s .c  om
public void testGetFirstMillisecondWithCalendar() {
    Minute m = new Minute(40, 2, 15, 4, 2000);
    GregorianCalendar calendar = new GregorianCalendar(Locale.GERMANY);
    calendar.setTimeZone(TimeZone.getTimeZone("Europe/Frankfurt"));
    assertEquals(955766400000L, m.getFirstMillisecond(calendar));

    // try null calendar
    boolean pass = false;
    try {
        m.getFirstMillisecond((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.
 *//*www.jav a 2s .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  .  java2  s .  co 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));
}