@Test public final void shouldReturnErrorStringValueIfDurationIsNull() { String strVal = TimeConverterService.durationToString(null); assertEquals("###", strVal); }
public static String durationToString(final Integer duration) { if (duration == null) { return ERROR_STRING_VALUE; } boolean minus = false; long longValueFromDuration = duration.longValue(); if (longValueFromDuration < 0 ) { minus = true; longValueFromDuration = -longValueFromDuration; } long hours = longValueFromDuration / 3600; long minutes = longValueFromDuration % 3600 / 60; long seconds = longValueFromDuration % 3600 % 60; return (minus ? "-" : "") + ((hours < 10) ? "0" : "") + hours + ":" + ((minutes < 10) ? "0" : "") + minutes + ":" + ((seconds < 10) ? "0" : "") + seconds; }
TimeConverterService { public static String durationToString(final Integer duration) { if (duration == null) { return ERROR_STRING_VALUE; } boolean minus = false; long longValueFromDuration = duration.longValue(); if (longValueFromDuration < 0 ) { minus = true; longValueFromDuration = -longValueFromDuration; } long hours = longValueFromDuration / 3600; long minutes = longValueFromDuration % 3600 / 60; long seconds = longValueFromDuration % 3600 % 60; return (minus ? "-" : "") + ((hours < 10) ? "0" : "") + hours + ":" + ((minutes < 10) ? "0" : "") + minutes + ":" + ((seconds < 10) ? "0" : "") + seconds; } }
TimeConverterService { public static String durationToString(final Integer duration) { if (duration == null) { return ERROR_STRING_VALUE; } boolean minus = false; long longValueFromDuration = duration.longValue(); if (longValueFromDuration < 0 ) { minus = true; longValueFromDuration = -longValueFromDuration; } long hours = longValueFromDuration / 3600; long minutes = longValueFromDuration % 3600 / 60; long seconds = longValueFromDuration % 3600 % 60; return (minus ? "-" : "") + ((hours < 10) ? "0" : "") + hours + ":" + ((minutes < 10) ? "0" : "") + minutes + ":" + ((seconds < 10) ? "0" : "") + seconds; }  }
TimeConverterService { public static String durationToString(final Integer duration) { if (duration == null) { return ERROR_STRING_VALUE; } boolean minus = false; long longValueFromDuration = duration.longValue(); if (longValueFromDuration < 0 ) { minus = true; longValueFromDuration = -longValueFromDuration; } long hours = longValueFromDuration / 3600; long minutes = longValueFromDuration % 3600 / 60; long seconds = longValueFromDuration % 3600 % 60; return (minus ? "-" : "") + ((hours < 10) ? "0" : "") + hours + ":" + ((minutes < 10) ? "0" : "") + minutes + ":" + ((seconds < 10) ? "0" : "") + seconds; }  static String convertTimeToString(final Object duration); static String durationToString(final Integer duration); @Deprecated Date getDateTimeFromField(final Object dateFromField); @Deprecated Object setDateTimeToField(final Date date); @Deprecated Date getDateFromField(final Object dateFromField); @Deprecated Object setDateToField(final Date date); }
TimeConverterService { public static String durationToString(final Integer duration) { if (duration == null) { return ERROR_STRING_VALUE; } boolean minus = false; long longValueFromDuration = duration.longValue(); if (longValueFromDuration < 0 ) { minus = true; longValueFromDuration = -longValueFromDuration; } long hours = longValueFromDuration / 3600; long minutes = longValueFromDuration % 3600 / 60; long seconds = longValueFromDuration % 3600 % 60; return (minus ? "-" : "") + ((hours < 10) ? "0" : "") + hours + ":" + ((minutes < 10) ? "0" : "") + minutes + ":" + ((seconds < 10) ? "0" : "") + seconds; }  static String convertTimeToString(final Object duration); static String durationToString(final Integer duration); @Deprecated Date getDateTimeFromField(final Object dateFromField); @Deprecated Object setDateTimeToField(final Date date); @Deprecated Date getDateFromField(final Object dateFromField); @Deprecated Object setDateToField(final Date date);  }