@Test
public void testBoundaries() throws Exception
{

    // I seriously can't be arsed to adapt the unit test for
    // Windows.
    if (! "/".equals(File.separator)) {
        return;
    }
    SlotMapper mapper = new SlotMapper();
    GregorianCalendar c1;
    GregorianCalendar c2;
    // Test hour rollover
    c1 = new GregorianCalendar(2011,0,20,1,59,59);
    c2 = new GregorianCalendar(2011,0,20,2,0,0);
    ensureDifferent(mapper, c1, c2);
    ensureConsistentMapping(mapper, c1);
    ensureConsistentMapping(mapper, c2);
    assertEquals("2011/01/20/"+SERVICENAME+"_2011-01-20_01", mapper.map(c1.getTimeInMillis(), SERVICENAME));
    assertEquals("2011/01/20/"+SERVICENAME+"_2011-01-20_02", mapper.map(c2.getTimeInMillis(), SERVICENAME));
    // Test day rollover
    c1 = new GregorianCalendar(2011,0,20,23,59,59);
    c2 = new GregorianCalendar(2011,0,21,0,0,0);
    ensureDifferent(mapper, c1, c2);
    ensureConsistentMapping(mapper, c1);
    ensureConsistentMapping(mapper, c2);
    assertEquals("2011/01/20/"+SERVICENAME+"_2011-01-20_23", mapper.map(c1.getTimeInMillis(), SERVICENAME));
    assertEquals("2011/01/21/"+SERVICENAME+"_2011-01-21_00", mapper.map(c2.getTimeInMillis(), SERVICENAME));
    // Test month rollover
    c1 = new GregorianCalendar(2011,0,31,23,59,59);
    c2 = new GregorianCalendar(2011,1,1,0,0,0);
    ensureDifferent(mapper, c1, c2);
    ensureConsistentMapping(mapper, c1);
    ensureConsistentMapping(mapper, c2);
    assertEquals("2011/01/31/"+SERVICENAME+"_2011-01-31_23", mapper.map(c1.getTimeInMillis(), SERVICENAME));
    assertEquals("2011/02/01/"+SERVICENAME+"_2011-02-01_00", mapper.map(c2.getTimeInMillis(), SERVICENAME));
    // Test month rollover, february, non-leap year
    c1 = new GregorianCalendar(2011,1,28,23,59,59);
    c2 = new GregorianCalendar(2011,2,1,0,0,0);
    ensureDifferent(mapper, c1, c2);
    ensureConsistentMapping(mapper, c1);
    ensureConsistentMapping(mapper, c2);
    assertEquals("2011/02/28/"+SERVICENAME+"_2011-02-28_23", mapper.map(c1.getTimeInMillis(), SERVICENAME));
    assertEquals("2011/03/01/"+SERVICENAME+"_2011-03-01_00", mapper.map(c2.getTimeInMillis(), SERVICENAME));
    // Test month rollover, february, leap year
    c1 = new GregorianCalendar(2012,1,29,23,59,59);
    c2 = new GregorianCalendar(2012,2,1,0,0,0);
    ensureDifferent(mapper, c1, c2);
    ensureConsistentMapping(mapper, c1);
    ensureConsistentMapping(mapper, c2);
    assertEquals("2012/02/29/"+SERVICENAME+"_2012-02-29_23", mapper.map(c1.getTimeInMillis(), SERVICENAME));
    assertEquals("2012/03/01/"+SERVICENAME+"_2012-03-01_00", mapper.map(c2.getTimeInMillis(), SERVICENAME));
    // Test year rollover
    c1 = new GregorianCalendar(2011,11,31,23,59,59);
    c2 = new GregorianCalendar(2012,0,1,0,0,0);
    ensureDifferent(mapper, c1, c2);
    ensureConsistentMapping(mapper, c1);
    ensureConsistentMapping(mapper, c2);
    assertEquals("2011/12/31/"+SERVICENAME+"_2011-12-31_23", mapper.map(c1.getTimeInMillis(), SERVICENAME));
    assertEquals("2012/01/01/"+SERVICENAME+"_2012-01-01_00", mapper.map(c2.getTimeInMillis(), SERVICENAME));
}