Skip to content

Commit 5c239f1

Browse files
harshpreet08damianszczepanik
authored andcommitted
Add test for the formatDuration method in Util class
- Introduce a new test case to verify the correct formatting of different durations. - Improve test coverage for the Util class, specifically focusing on the formatDuration method.
1 parent 607b863 commit 5c239f1

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/test/java/net/masterthought/cucumber/util/UtilTest.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,4 +85,16 @@ void eliminateEmptyHooks_RemovesEmptyHooks() {
8585
// then
8686
assertThat(reducedHooks).containsExactly(hook);
8787
}
88+
89+
@Test
90+
public void formatDuration_FormatsDifferentDurations() {
91+
// Arrange
92+
final long[] durations = {0, 1000, 60000, 3600000, 86400000};
93+
String[] formatted = {"0.000", "0.001", "1.000", "60.000", "1440.000"};
94+
95+
// Act, Assert
96+
for (int i = 0; i < durations.length; i++) {
97+
assertThat(Util.formatDuration(durations[i])).isEqualTo(formatted[i]);
98+
}
99+
}
88100
}

0 commit comments

Comments
 (0)