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

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

Introduction

In this page you can find the example usage for org.jfree.data.time Second 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.SecondTest.java

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

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

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

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

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

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

/**
 * Some checks for the getFirstMillisecond(TimeZone) method.
 *//*from  w ww.j a  v  a 2 s.  co  m*/
public void testGetFirstMillisecondWithTimeZone() {
    Second s = new Second(50, 59, 15, 1, 4, 1950);
    TimeZone zone = TimeZone.getTimeZone("America/Los_Angeles");
    Calendar c = new GregorianCalendar(zone);
    assertEquals(-623289610000L, s.getFirstMillisecond(c));

    // try null calendar
    boolean pass = false;
    try {
        s.getFirstMillisecond((Calendar) 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.
 *///w  ww. j a va  2s  . 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  w  ww  . ja  v  a2  s.com
@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 getFirstMillisecond(TimeZone) method.
 *///from  w  w w.j a  v a 2  s .co  m
public void testGetFirstMillisecondWithCalendar() {
    Second s = new Second(55, 40, 2, 15, 4, 2000);
    GregorianCalendar calendar = new GregorianCalendar(Locale.GERMANY);
    calendar.setTimeZone(TimeZone.getTimeZone("Europe/Frankfurt"));
    assertEquals(955766455000L, s.getFirstMillisecond(calendar));

    // try null calendar
    boolean pass = false;
    try {
        s.getFirstMillisecond((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  w w. jav  a2s  .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));
}

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 w w  .  j a va2s  . c  om
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));
}