1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.apache.maven.cli;
20
21 import org.junit.jupiter.api.Test;
22
23 import static org.junit.jupiter.api.Assertions.assertEquals;
24
25 class CLIReportingUtilsTest {
26
27 @Test
28 void testFormatDuration() {
29 assertEquals("0.001 s", CLIReportingUtils.formatDuration(1));
30 assertEquals("0.999 s", CLIReportingUtils.formatDuration(1000 - 1));
31 assertEquals("1.000 s", CLIReportingUtils.formatDuration(1000));
32 assertEquals("59.999 s", CLIReportingUtils.formatDuration(60 * 1000 - 1));
33 assertEquals("01:00 min", CLIReportingUtils.formatDuration(60 * 1000));
34 assertEquals("59:59 min", CLIReportingUtils.formatDuration(60 * 60 * 1000 - 1));
35 assertEquals("01:00 h", CLIReportingUtils.formatDuration(60 * 60 * 1000));
36 assertEquals("23:59 h", CLIReportingUtils.formatDuration(24 * 60 * 60 * 1000 - 1));
37 assertEquals("1 d 00:00 h", CLIReportingUtils.formatDuration(24 * 60 * 60 * 1000));
38 }
39 }