List of usage examples for org.jfree.data.time Day getFirstMillisecond
@Override public long getFirstMillisecond(Calendar calendar)
From source file:org.jfree.data.time.DayTest.java
/** * Some checks for the getFirstMillisecond(TimeZone) method. *///w w w . ja v a2 s .c o m @Test public void testGetFirstMillisecondWithTimeZone() { Day d = new Day(26, 4, 1950); TimeZone zone = TimeZone.getTimeZone("America/Los_Angeles"); assertEquals(-621187200000L, d.getFirstMillisecond(zone)); // try null calendar boolean pass = false; try { d.getFirstMillisecond((TimeZone) null); } catch (NullPointerException e) { pass = true; } assertTrue(pass); }
From source file:org.jfree.data.time.junit.DayTest.java
/** * Some checks for the getFirstMillisecond(TimeZone) method. *//*from w ww.jav a 2s.co m*/ public void testGetFirstMillisecondWithTimeZone() { Day d = new Day(26, 4, 1950); TimeZone zone = TimeZone.getTimeZone("America/Los_Angeles"); Calendar c = new GregorianCalendar(zone); assertEquals(-621187200000L, d.getFirstMillisecond(c)); // try null calendar boolean pass = false; try { d.getFirstMillisecond((Calendar) null); } catch (NullPointerException e) { pass = true; } assertTrue(pass); }
From source file:org.jfree.data.time.DayTest.java
/** * Some checks for the getFirstMillisecond(TimeZone) method. *//*from ww w . j a va2 s. co m*/ @Test public void testGetFirstMillisecondWithCalendar() { Day d = new Day(1, 12, 2001); GregorianCalendar calendar = new GregorianCalendar(Locale.GERMANY); calendar.setTimeZone(TimeZone.getTimeZone("Europe/Frankfurt")); assertEquals(1007164800000L, d.getFirstMillisecond(calendar)); // try null calendar boolean pass = false; try { d.getFirstMillisecond((Calendar) null); } catch (NullPointerException e) { pass = true; } assertTrue(pass); }
From source file:org.jfree.data.time.junit.DayTest.java
/** * Some checks for the getFirstMillisecond(TimeZone) method. *///www .j a va 2 s. co m public void testGetFirstMillisecondWithCalendar() { Day d = new Day(1, 12, 2001); GregorianCalendar calendar = new GregorianCalendar(Locale.GERMANY); calendar.setTimeZone(TimeZone.getTimeZone("Europe/Frankfurt")); assertEquals(1007164800000L, d.getFirstMillisecond(calendar)); // try null calendar boolean pass = false; try { d.getFirstMillisecond((Calendar) null); } catch (NullPointerException e) { pass = true; } assertTrue(pass); }
From source file:org.jfree.data.time.DayTest.java
/** * In GMT, the end of 29 Feb 2004 is java.util.Date(1,078,099,199,999L). * Use this to check the day constructor. */// ww w .ja va2 s . co m @Test public void testDateConstructor1() { TimeZone zone = TimeZone.getTimeZone("GMT"); Locale locale = Locale.UK; Day d1 = new Day(new Date(1078099199999L), zone, locale); Day d2 = new Day(new Date(1078099200000L), zone, locale); assertEquals(MonthConstants.FEBRUARY, d1.getMonth()); assertEquals(1078099199999L, d1.getLastMillisecond(zone)); assertEquals(MonthConstants.MARCH, d2.getMonth()); assertEquals(1078099200000L, d2.getFirstMillisecond(zone)); }
From source file:org.jfree.data.time.DayTest.java
/** * In Helsinki, the end of 29 Feb 2004 is * java.util.Date(1,078,091,999,999L). Use this to check the Day * constructor.//from w ww.j a v a 2s . c o m */ @Test public void testDateConstructor2() { TimeZone zone = TimeZone.getTimeZone("Europe/Helsinki"); Locale locale = Locale.getDefault(); // locale shouldn't matter here Day d1 = new Day(new Date(1078091999999L), zone, locale); Day d2 = new Day(new Date(1078092000000L), zone, locale); assertEquals(MonthConstants.FEBRUARY, d1.getMonth()); assertEquals(1078091999999L, d1.getLastMillisecond(zone)); assertEquals(MonthConstants.MARCH, d2.getMonth()); assertEquals(1078092000000L, d2.getFirstMillisecond(zone)); }
From source file:org.jfree.data.time.junit.DayTest.java
/** * In GMT, the end of 29 Feb 2004 is java.util.Date(1,078,099,199,999L). * Use this to check the day constructor. *//*from w w w. j a v a 2 s .com*/ public void testDateConstructor1() { TimeZone zone = TimeZone.getTimeZone("GMT"); Calendar c = new GregorianCalendar(zone); Locale locale = Locale.UK; Day d1 = new Day(new Date(1078099199999L), zone, locale); Day d2 = new Day(new Date(1078099200000L), zone, locale); assertEquals(MonthConstants.FEBRUARY, d1.getMonth()); assertEquals(1078099199999L, d1.getLastMillisecond(c)); assertEquals(MonthConstants.MARCH, d2.getMonth()); assertEquals(1078099200000L, d2.getFirstMillisecond(c)); }
From source file:org.jfree.data.time.junit.DayTest.java
/** * In Helsinki, the end of 29 Feb 2004 is * java.util.Date(1,078,091,999,999L). Use this to check the Day * constructor.//from w w w. j a v a2s . c om */ public void testDateConstructor2() { TimeZone zone = TimeZone.getTimeZone("Europe/Helsinki"); Calendar c = new GregorianCalendar(zone); Locale locale = Locale.getDefault(); // locale shouldn't matter here Day d1 = new Day(new Date(1078091999999L), zone, locale); Day d2 = new Day(new Date(1078092000000L), zone, locale); assertEquals(MonthConstants.FEBRUARY, d1.getMonth()); assertEquals(1078091999999L, d1.getLastMillisecond(c)); assertEquals(MonthConstants.MARCH, d2.getMonth()); assertEquals(1078092000000L, d2.getFirstMillisecond(c)); }