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

[3.x]: Use Hamcrest assertions instead of JUnit in tests/integration/jms (#1749) #6638

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
import org.hamcrest.Matchers;

import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.hamcrest.Matchers.is;

public abstract class AbstractMPTest extends AbstractJmsTest {

Expand All @@ -52,8 +52,8 @@ protected void produceAndCheck(final AbstractSampleBean consumingBean,
if (expected.size() > 0) {
// Wait till records are delivered
boolean done = consumingBean.await();
assertTrue(done, String.format("Timeout waiting for results.\nExpected: %s \nBut was: %s",
expected.toString(), consumingBean.consumed().toString()));
assertThat(String.format("Timeout waiting for results.\nExpected: %s \nBut was: %s",
expected.toString(), consumingBean.consumed().toString()), done, is(true));
}
if (!expected.isEmpty()) {
assertThat(consumingBean.consumed(), Matchers.containsInAnyOrder(expected.toArray()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@
import static org.hamcrest.Matchers.containsInAnyOrder;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.is;
import static org.junit.jupiter.api.Assertions.assertTrue;

/**
* This class contains the outputs of the tests. In order to avoid that one test mess up in the results
Expand Down Expand Up @@ -249,7 +248,7 @@ public static class ChannelBytes extends AbstractSampleBean {

public void await(long timeout) {
try {
assertTrue(countDownLatch.await(timeout, TimeUnit.MILLISECONDS));
assertThat(countDownLatch.await(timeout, TimeUnit.MILLISECONDS), is(true));
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
Expand Down Expand Up @@ -286,7 +285,7 @@ public static class ChannelProperties extends AbstractSampleBean {

public void await(long timeout) {
try {
assertTrue(countDownLatch.await(timeout, TimeUnit.MILLISECONDS));
assertThat(countDownLatch.await(timeout, TimeUnit.MILLISECONDS), is(true));
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
Expand Down Expand Up @@ -331,7 +330,7 @@ public static class ChannelCustomMapper extends AbstractSampleBean {

public void await(long timeout) {
try {
assertTrue(countDownLatch.await(timeout, TimeUnit.MILLISECONDS));
assertThat(countDownLatch.await(timeout, TimeUnit.MILLISECONDS), is(true));
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
Expand Down Expand Up @@ -375,7 +374,7 @@ public static class ChannelDerivedMessage extends AbstractSampleBean {

public void await(long timeout) {
try {
assertTrue(countDownLatch.await(timeout, TimeUnit.MILLISECONDS));
assertThat(countDownLatch.await(timeout, TimeUnit.MILLISECONDS), is(true));
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@
import org.junit.jupiter.api.Test;

import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.containsInAnyOrder;
import static org.hamcrest.Matchers.startsWith;
import static org.junit.jupiter.api.Assertions.assertTrue;

public class JmsSeTest extends AbstractJmsTest {

Expand Down Expand Up @@ -81,7 +81,7 @@ void customFactoryTest() throws InterruptedException {
.build()
.start();

assertTrue(cdl.await(2, TimeUnit.SECONDS));
assertThat(cdl.await(2, TimeUnit.SECONDS), is(true));
assertThat(result, containsInAnyOrder("1", "2", "3", "4"));
}

Expand Down