Riddle me this: why does this simple JUnit assertion fail?
public void testParseDate() throws ParseException {
final SimpleDateFormat formatter = new SimpleDateFormat(
"yyyy-MM-dd HH:mm:ss z");
formatter.setTimeZone(UTC);
final Calendar c = new GregorianCalendar();
c.setTime(formatter.parse("2013-03-02 11:59:59 UTC"));
assertEquals(11, c.get(HOUR_OF_DAY));
}
I would have expected the hour of day to be 11, but according to JUnit, the hour of day is 12.
junit.framework.AssertionFailedError: expected:<11> but was:<12>
at junit.framework.Assert.fail(Assert.java:47)
... snip ...