@Test public void getDurationFormattedBiggest5() { Duration duration = Duration.ofMinutes(100); assertEquals("100 minutes", getFormattedDuration(duration, DurationFormat.BIGGEST)); }
public static String getFormattedDuration(Duration duration, DurationFormat format) { switch (format) { case X_HOURS_Y_MINUTES_SECONDS: return getDurationFormattedXHoursYMinutesSeconds(duration); case BIGGEST: return getDurationFormattedBiggest(duration); case X_HRS_Y_MINS_SECS: return getDurationFormattedXHrsYMinsSecs(duration); case DAYS: return getDurationFormattedDays(duration); case X_HRS_Y_MINS: return getDurationFormattedXHrsYMins(duration); default: throw new UnsupportedOperationException("Unknown format for duration."); } }
DurationFormatter { public static String getFormattedDuration(Duration duration, DurationFormat format) { switch (format) { case X_HOURS_Y_MINUTES_SECONDS: return getDurationFormattedXHoursYMinutesSeconds(duration); case BIGGEST: return getDurationFormattedBiggest(duration); case X_HRS_Y_MINS_SECS: return getDurationFormattedXHrsYMinsSecs(duration); case DAYS: return getDurationFormattedDays(duration); case X_HRS_Y_MINS: return getDurationFormattedXHrsYMins(duration); default: throw new UnsupportedOperationException("Unknown format for duration."); } } }
DurationFormatter { public static String getFormattedDuration(Duration duration, DurationFormat format) { switch (format) { case X_HOURS_Y_MINUTES_SECONDS: return getDurationFormattedXHoursYMinutesSeconds(duration); case BIGGEST: return getDurationFormattedBiggest(duration); case X_HRS_Y_MINS_SECS: return getDurationFormattedXHrsYMinsSecs(duration); case DAYS: return getDurationFormattedDays(duration); case X_HRS_Y_MINS: return getDurationFormattedXHrsYMins(duration); default: throw new UnsupportedOperationException("Unknown format for duration."); } }  }
DurationFormatter { public static String getFormattedDuration(Duration duration, DurationFormat format) { switch (format) { case X_HOURS_Y_MINUTES_SECONDS: return getDurationFormattedXHoursYMinutesSeconds(duration); case BIGGEST: return getDurationFormattedBiggest(duration); case X_HRS_Y_MINS_SECS: return getDurationFormattedXHrsYMinsSecs(duration); case DAYS: return getDurationFormattedDays(duration); case X_HRS_Y_MINS: return getDurationFormattedXHrsYMins(duration); default: throw new UnsupportedOperationException("Unknown format for duration."); } }  static String getFormattedDuration(Duration duration, DurationFormat format); }
DurationFormatter { public static String getFormattedDuration(Duration duration, DurationFormat format) { switch (format) { case X_HOURS_Y_MINUTES_SECONDS: return getDurationFormattedXHoursYMinutesSeconds(duration); case BIGGEST: return getDurationFormattedBiggest(duration); case X_HRS_Y_MINS_SECS: return getDurationFormattedXHrsYMinsSecs(duration); case DAYS: return getDurationFormattedDays(duration); case X_HRS_Y_MINS: return getDurationFormattedXHrsYMins(duration); default: throw new UnsupportedOperationException("Unknown format for duration."); } }  static String getFormattedDuration(Duration duration, DurationFormat format);  }