void () { NlsMessages.NlsDurationFormatter formatter = new NlsMessages.NlsDurationFormatter() .setNarrow(false).setDurationTimeUnit(TimeUnit.MILLISECONDS); assertEquals("0 ms", formatter.formatDuration(0)); assertEquals("1 ms", formatter.formatDuration(1)); assertEquals("1 sec", formatter.formatDuration(1000)); assertEquals("3 wks, 3 days, 20 hr, 31 min, 23 sec, 647 ms", formatter.formatDuration(Integer.MAX_VALUE)); assertEquals("11 wks, 5 days, 17 hr, 24 min, 43 sec, 647 ms", formatter.formatDuration(Integer.MAX_VALUE + 5000000000L)); formatter.setDurationTimeUnit(TimeUnit.DAYS); assertEquals("1 day", formatter.formatDuration(1)); formatter.setDurationTimeUnit(TimeUnit.MILLISECONDS); assertEquals("1 min, 0 sec, 100 ms", formatter.formatDuration(60100)); }