### Question:
JsonEventLogger implements EventHandler { @SuppressWarnings({"unchecked", "squid:S3776"}) protected static Object convertValue(Object val) { if (val instanceof Calendar) { return ISO8601.format((Calendar) val); } else if (val instanceof Date) { Calendar calendar = Calendar.getInstance(); calendar.setTime((Date) val); return ISO8601.format(calendar); } return val; }  @Override void handleEvent(Event event); @Override String toString();  }### Answer:
@Test public void testConvertValue() { assertNull("null should convert to null", JsonEventLogger.convertValue(null)); assertEquals("string should convert to string", "foo", JsonEventLogger.convertValue("foo")); final Calendar curCalendar = Calendar.getInstance(); assertEquals("calendar should convert to ISO8601", ISO8601.format(curCalendar), JsonEventLogger.convertValue(curCalendar)); final Date curDate = new Date(); final Calendar curDateAsCalendar = Calendar.getInstance(); curDateAsCalendar.setTime(curDate); assertEquals("date should convert to ISO8601", ISO8601.format(curDateAsCalendar), JsonEventLogger.convertValue(curDate)); }