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

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

Introduction

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

Prototype

public Second(int second, int minute, int hour, int day, int month, int year) 

Source Link

Document

Creates a new second.

Usage

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

/**
 * Some checks for the getLastMillisecond(TimeZone) method.
 *//*from w ww  .  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.junit.SecondTest.java

/**
 * Some checks for the getFirstMillisecond(TimeZone) method.
 *///w  w w .  j  a  v a  2s  . c  o  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.SecondTest.java

/**
 * Some checks for the getLastMillisecond(TimeZone) method.
 *///from  w w  w .  ja v  a2 s. 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

/**
 * Some checks for the getLastMillisecond() method.
 */// w  w  w .ja  v a  2  s  .  com
public void testGetLastMillisecond() {
    Locale saved = Locale.getDefault();
    Locale.setDefault(Locale.UK);
    TimeZone savedZone = TimeZone.getDefault();
    TimeZone.setDefault(TimeZone.getTimeZone("Europe/London"));
    Second s = new Second(1, 1, 1, 1, 1, 1970);
    assertEquals(61999L, s.getLastMillisecond());
    Locale.setDefault(saved);
    TimeZone.setDefault(savedZone);
}

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

/**
 * Some checks for the getLastMillisecond(TimeZone) method.
 *//*from   www  . ja  va 2s  .c om*/
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 getSerialIndex() method.
 *///  w  w w.  j av a 2s  . co m
@Test
public void testGetSerialIndex() {
    Second s = new Second(1, 1, 1, 1, 1, 2000);
    assertEquals(3155850061L, s.getSerialIndex());
    s = new Second(1, 1, 1, 1, 1, 1900);
    assertEquals(176461L, s.getSerialIndex());
}

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

/**
 * Some checks for the testNext() method.
 *//*  w  w w .j  av a 2  s .c om*/
@Test
public void testNext() {
    Second s = new Second(55, 30, 1, 12, 12, 2000);
    s = (Second) s.next();
    assertEquals(2000, s.getMinute().getHour().getYear());
    assertEquals(12, s.getMinute().getHour().getMonth());
    assertEquals(12, s.getMinute().getHour().getDayOfMonth());
    assertEquals(1, s.getMinute().getHour().getHour());
    assertEquals(30, s.getMinute().getMinute());
    assertEquals(56, s.getSecond());
    s = new Second(59, 59, 23, 31, 12, 9999);
    assertNull(s.next());
}

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

/**
 * Some checks for the getLastMillisecond(TimeZone) method.
 *///from  w  w  w. j  av a  2s  .c om
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

/**
 * Some checks for the getSerialIndex() method.
 *///w ww  . j a v a2 s .  c o m
public void testGetSerialIndex() {
    Second s = new Second(1, 1, 1, 1, 1, 2000);
    assertEquals(3155850061L, s.getSerialIndex());
    s = new Second(1, 1, 1, 1, 1, 1900);
    assertEquals(176461L, s.getSerialIndex());
}

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

/**
 * Some checks for the getStart() method.
 *///w  w w. java  2 s.c om
@Test
public void testGetStart() {
    Locale saved = Locale.getDefault();
    Locale.setDefault(Locale.ITALY);
    Calendar cal = Calendar.getInstance(Locale.ITALY);
    cal.set(2006, Calendar.JANUARY, 16, 3, 47, 55);
    cal.set(Calendar.MILLISECOND, 0);
    Second s = new Second(55, 47, 3, 16, 1, 2006);
    assertEquals(cal.getTime(), s.getStart());
    Locale.setDefault(saved);
}