DateTimeTools { public static String formatDuration(int duration) { StringBuilder returnString = new StringBuilder(); int nbHours = duration / 3600; if (nbHours != 0) { returnString.append(nbHours).append("h"); } int nbMinutes = (duration - (nbHours * 3600)) / 60; if (nbMinutes != 0) { if (nbHours != 0) { returnString.append(" "); } returnString.append(nbMinutes).append("m"); } LOG.trace("Formatted duration {} to {}", duration, returnString); return returnString.toString(); } private  DateTimeTools(); static String getDateFormatString(); static String getDateFormatLongString(); static SimpleDateFormat getDateFormat(); static SimpleDateFormat getDateFormatLong(); static String convertDateToString(Date convertDate); static String convertDateToString(DateTime convertDate); static String convertDateToString(Date convertDate, final String dateFormat); static String convertDateToString(DateTime convertDate, final String dateFormat); static String formatDuration(int duration); static int processRuntime(final String runtime); static String parseDateToString(String dateToParse); static Date parseStringToDate(final String dateToParse); static int extractYear(String date);  }
@Test public void testFormatDuration() { LOG.info("formatDuration"); int duration = ((2 * 60) + (12)) * 60; String expResult = "2h 12m"; String result = DateTimeTools.formatDuration(duration); assertEquals(expResult, result); }