@Test
public void testMonthly() throws Exception {

    final TemporalResolution daily = TemporalResolution.monthly;
    Date startDate = TimeUtil.parseShortUtcFormat("2012-09-01");
    //execution 1
    Date endDate = TimeUtil.parseShortUtcFormat("2012-11-01");
    List<RegriddingTimeStep> results = regriddingAggregator.aggregate(startDate, endDate, daily);
    //verification 1
    assertEquals("2 months, will give 2 coarser files", 2, results.size());
    assertEquals("2012-09-01", df.format(results.get(0).getStartDate()));
    assertEquals("2012-10-01", df.format(results.get(0).getEndDate()));
    assertEquals("2012-10-01", df.format(results.get(1).getStartDate()));
    assertEquals("2012-11-01", df.format(results.get(1).getEndDate()));
    //execution 2
    endDate = TimeUtil.parseShortUtcFormat("2012-11-02");
    results = regriddingAggregator.aggregate(startDate, endDate, daily);
    //verification 2
    assertEquals("2 and a started 3rd months, will give 3 coarser files", 3, results.size());
    assertEquals("2012-09-01", df.format(results.get(0).getStartDate()));
    assertEquals("2012-10-01", df.format(results.get(0).getEndDate()));
    assertEquals("2012-10-01", df.format(results.get(1).getStartDate()));
    assertEquals("2012-11-01", df.format(results.get(1).getEndDate()));
    assertEquals("2012-11-01", df.format(results.get(2).getStartDate()));
    assertEquals("2012-12-01", df.format(results.get(2).getEndDate()));
    //execution 3
    startDate = TimeUtil.parseShortUtcFormat("2012-03-04");
    endDate = TimeUtil.parseShortUtcFormat("2012-04-04");
    results = regriddingAggregator.aggregate(startDate, endDate, daily);
    //verification 3
    assertEquals("1 month, will give 1 coarser file", 1, results.size());
    assertEquals("2012-03-04", df.format(results.get(0).getStartDate()));
    assertEquals("2012-04-04", df.format(results.get(0).getEndDate()));
}