Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SyncTimerTest | Used Junit 5 assertions to keep it consistent #726

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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