@Test
public void testExtendTo() {

    TsData s = new TsData(TsFrequency.Monthly, 1980, 0, 12);
    Day d0 = new Day(1980, Month.December, 30);
    assertTrue(s.extendTo(d0).getLastPeriod().lastday().equals(d0));
    Day d1 = new Day(1980, Month.December, 29);
    assertTrue(s.extendTo(d1).getLastPeriod().lastday().isBefore(d1));
    Day d2 = new Day(1981, Month.January, 1);
    assertTrue(s.extendTo(d2).getLastPeriod().lastday().equals(d0));
}