*/
package org.opendaylight.yangtools.util;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNull;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNull;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
-public class SynchronizedDurationStatsTrackerTest {
+class SynchronizedDurationStatsTrackerTest {
@Test
- public void testAllMethodsOfSynchronizedDurationStatsTracker() {
- final SynchronizedDurationStatsTracker statsTracker = new SynchronizedDurationStatsTracker();
+ void testAllMethodsOfSynchronizedDurationStatsTracker() {
+ final var statsTracker = new SynchronizedDurationStatsTracker();
statsTracker.addDuration(1000);
statsTracker.addDuration(2000);
statsTracker.addDuration(3000);
- assertEquals("Shortest recorded duration should be '1000'.", 1000, statsTracker.getShortest().duration());
- assertEquals("Average recorded duration should be '2000'.", 2000, statsTracker.getAverageDuration(), 0.0001);
- assertEquals("Longest recorded duration should be '3000'.", 3000, statsTracker.getLongest().duration());
- assertEquals("Total recorded duration count should be '3'.", 3, statsTracker.getTotalDurations());
+ assertEquals(1000, statsTracker.getShortest().duration(), "Shortest recorded duration should be '1000'.");
+ assertEquals(2000, statsTracker.getAverageDuration(), 0.0001, "Average recorded duration should be '2000'.");
+ assertEquals(3000, statsTracker.getLongest().duration(), "Longest recorded duration should be '3000'.");
+ assertEquals(3, statsTracker.getTotalDurations(), "Total recorded duration count should be '3'.");
statsTracker.reset();
- assertNull("Shortest recorded duration should be 'null'.", statsTracker.getShortest());
- assertEquals("Average recorded duration should be '0'.", 0, statsTracker.getAverageDuration(), 0.0001);
- assertNull("Longest recorded duration should be '0'.", statsTracker.getLongest());
- assertEquals("Total recorded duration should be '0'.", 0, statsTracker.getTotalDurations());
+ assertNull(statsTracker.getShortest(), "Shortest recorded duration should be 'null'.");
+ assertEquals(0, statsTracker.getAverageDuration(), 0.0001, "Average recorded duration should be '0'.");
+ assertNull(statsTracker.getLongest(), "Longest recorded duration should be '0'.");
+ assertEquals(0, statsTracker.getTotalDurations(), "Total recorded duration should be '0'.");
}
}