calendar.set(Calendar.YEAR, 2012);
TimeTextField field = new TimeTextField(formatter);
field.setYear(2012);
TimeVerifier verifier = field.new TimeVerifier();
field.setText("000/08:22:51");
Assert.assertFalse(verifier.verify(field));
field.setText("001/08:22:51");
Assert.assertTrue(verifier.verify(field));
field.setText("020/00:59:59");
Assert.assertTrue(verifier.verify(field));
field.setText("365/23:59:00");
Assert.assertTrue(verifier.verify(field));
field.setText("365/23:60:00");
Assert.assertTrue(verifier.verify(field));
// Test for 2012 (a leap year)
field.setText("365/23:60:00");
Assert.assertTrue(verifier.verify(field));
Assert.assertEquals("366/00:00:00", field.getValue().toString());
field.setText("366/23:60:00");
Assert.assertTrue(verifier.verify(field));
Assert.assertEquals(field.getYear(), calendar.get(Calendar.YEAR) + 1);
// Test for 2013 (non-leap year)
calendar.set(Calendar.YEAR, 2013);
field.setYear(2013);
field.setText("364/23:60:00");
Assert.assertTrue(verifier.verify(field));
Assert.assertEquals("365/00:00:00", field.getValue().toString());
field.setText("365/23:60:00");
Assert.assertTrue(verifier.verify(field));
Assert.assertEquals("001/00:00:00", field.getValue().toString());
// Test carryover of days to year
Assert.assertEquals(field.getYear(), calendar.get(Calendar.YEAR) + 1);
}