@Test
public void testGetNextSessionDate() {

    TradingWeek tradingWeek = getTestTradingWeek(TEST);
    
    DateTime testDate = new DateTime(2009, 5, 1, 0, 0, 0, 999);//Friday, May 1st
    
    Period tu = new Period(PeriodType.YEAR, 1);
    DateTime nextDate = tradingWeek.getNextSessionDate(testDate, tu);
    assertEquals("2010-01-01T08:30:00.000", noZone(nextDate.toString()));
    
    tu = new Period(PeriodType.QUARTER, 1);
    nextDate = tradingWeek.getNextSessionDate(testDate, tu);
    assertEquals("2009-07-01T08:30:00.000", noZone(nextDate.toString()));
    
    tu = new Period(PeriodType.MONTH, 1);
    nextDate = tradingWeek.getNextSessionDate(testDate, tu);
    assertEquals("2009-06-01T08:30:00.000", noZone(nextDate.toString()));
    
    tu = new Period(PeriodType.WEEK, 1);
    nextDate = tradingWeek.getNextSessionDate(testDate, tu);
    assertEquals("2009-05-10T08:30:00.000", noZone(nextDate.toString()));
    
    tu = new Period(PeriodType.DAY, 1);
    nextDate = tradingWeek.getNextSessionDate(testDate, tu);
    assertEquals("2009-05-02T08:30:00.000", noZone(nextDate.toString()));
    
    testDate = new DateTime(2009, 5, 1, 8, 30, 0, 999);
    tu = new Period(PeriodType.HOUR, 1);
    nextDate = tradingWeek.getNextSessionDate(testDate, tu);
    assertEquals("2009-05-01T09:30:00.000", noZone(nextDate.toString()));
    
    tu = new Period(PeriodType.MINUTE, 1);
    nextDate = tradingWeek.getNextSessionDate(testDate, tu);
    assertEquals("2009-05-01T08:31:00.000", noZone(nextDate.toString()));
    
    tu = new Period(PeriodType.SECOND, 1);
    nextDate = tradingWeek.getNextSessionDate(testDate, tu);
    assertEquals("2009-05-01T08:30:01.000", noZone(nextDate.toString()));
    
    //Test advancement to following week
    testDate = new DateTime(2009, 5, 1, 0, 0, 0, 999);//Friday, May 1st
    tradingWeek = getTestTradingWeek(TEST3); //Trading Week includes only Tue, Wed, Thur
    tu = new Period(PeriodType.DAY, 1);
    nextDate = tradingWeek.getNextSessionDate(testDate, tu);
    assertEquals("2009-05-05T08:30:00.000", noZone(nextDate.toString()));
    
}