TradingSessionImpl implements TradingSession { @Override public long sessionMillis() { return SESSION_MILLIS; } TradingSessionImpl(int day, int endDay, LocalTime start, LocalTime end); @Override int hourCount(); @Override int day(); @Override int endDay(); @Override LocalTime start(); @Override LocalTime end(); @Override long sessionMillis(); static long sessionMillis(DateTime startDate, DateTime endDate); static long sessionMillis(int startDay, LocalTime startTime, int endDay, LocalTime endTime); @Override String dayToString(); @Override boolean contains(DateTime date); @Override int compareTo(TradingSession other); @Override int hashCode(); @Override boolean equals(Object obj); @Override String toString();  }
@Test public void testSessionMillis() { long millisInHour = 3600000; long millisInDay = millisInHour * 24; DateTime dt = new DateTime(2010, 9, 13, 0, 0, 0, 0); DateTime dt2 = new DateTime(2010, 9, 15, 0, 0, 0, 0); long sessionMillis = TradingSessionImpl.sessionMillis( dt.dayOfWeek().get(), dt.toLocalTime(), dt2.dayOfWeek().get(), dt2.toLocalTime()); assertEquals(millisInDay * 2, sessionMillis); dt = new DateTime(2010, 9, 12, 0, 0, 0, 0); dt2 = new DateTime(2010, 9, 14, 0, 0, 0, 0); sessionMillis = TradingSessionImpl.sessionMillis( dt.dayOfWeek().get(), dt.toLocalTime(), dt2.dayOfWeek().get(), dt2.toLocalTime()); assertEquals(millisInDay * 2, sessionMillis); }