Skip to content

Commit

Permalink
Used Junit 5 assertions to keep it consistent
Browse files Browse the repository at this point in the history
  • Loading branch information
SampathKumarAmex authored and vlsi committed Sep 26, 2022
1 parent c60c3ab commit 8925517
Showing 1 changed file with 16 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,13 @@

package org.apache.jmeter.timers;

import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue;

import org.apache.jmeter.control.LoopController;
import org.apache.jmeter.threads.JMeterContextService;
import org.apache.jmeter.threads.JMeterThread;
import org.apache.jorphan.collections.ListedHashTree;
import org.junit.Assert;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;

public class SyncTimerTest {
Expand All @@ -35,10 +36,9 @@ public void testTimerWithScheduledEndpoint() {
timer.setGroupSize(2);
timer.testStarted();
long duration = timeDelay(timer);
Assert.assertTrue(
"Calculating delay takes less then " + schedulerDuration * 2
+ " ms (took: " + duration + " ms)",
duration < schedulerDuration * 2);
assertTrue(duration < schedulerDuration * 2,
"Calculating delay takes less then " + schedulerDuration * 2
+ " ms (took: " + duration + " ms)");
}

@Test
Expand All @@ -51,10 +51,9 @@ public void testTimerWithLongerScheduledEndpointThanTimeoutForTimer() {
timer.testStarted();
timer.setTimeoutInMs(timerTimeout);
long duration = timeDelay(timer);
Assert.assertTrue(
"Calculating delay takes less then " + timerTimeout * 2
+ " ms (took: " + duration + " ms)",
duration < timerTimeout * 2);
assertTrue(duration < timerTimeout * 2,
"Calculating delay takes less then " + timerTimeout * 2
+ " ms (took: " + duration + " ms)");
}

@Test
Expand All @@ -67,10 +66,10 @@ public void testTimerWithShorterScheduledEndpointThanTimeoutForTimer() {
timer.testStarted();
timer.setTimeoutInMs(timerTimeout);
long duration = timeDelay(timer);
Assert.assertTrue(
"Calculating delay takes less then " + schedulerDuration * 2
+ " ms (took: " + duration + " ms)",
duration < schedulerDuration * 2);
assertTrue(
duration < schedulerDuration * 2,
"Calculating delay takes less then " + schedulerDuration * 2
+ " ms (took: " + duration + " ms)");
}

@Test
Expand All @@ -82,9 +81,9 @@ public void testTimerWithInvalidTimeout() {
timer.setGroupSize(2);
timer.testStarted();
timer.setTimeoutInMs(timerTimeout);
Assertions.assertThrows(
IllegalArgumentException.class,
timer::delay);
assertThrows(
IllegalArgumentException.class,
timer::delay);
}

private long timeDelay(SyncTimer timer) {
Expand Down

0 comments on commit 8925517

Please sign in to comment.