public void testTo12HourClock() throws Exception { assertEquals(0, TimeUtil.to12HourClock(0)); assertEquals(8, TimeUtil.to12HourClock(8)); assertEquals(0, TimeUtil.to12HourClock(12)); assertEquals(8, TimeUtil.to12HourClock(20)); try { TimeUtil.to12HourClock(24); fail(); } catch (AssertionError e) { // ok } try { TimeUtil.to12HourClock(-1); fail(); } catch (AssertionError e) { // ok } }
public void testTo12HourClock1() throws Exception { assertEquals("12:00:00", TimeUtil.to12HourClock("00:00:00")); assertEquals("8:05:03", TimeUtil.to12HourClock("08:05:03")); assertEquals("12:00:00", TimeUtil.to12HourClock("12:00:00")); assertEquals("8:00:00", TimeUtil.to12HourClock("20:00:00")); }