Skip to content

Commit 1292eda

Browse files
authored
[3.x]: Use Hamcrest assertions instead of JUnit in tests/integration/jms (helidon-io#1749) (helidon-io#6638)
1 parent 144edb3 commit 1292eda

3 files changed

Lines changed: 9 additions & 10 deletions

File tree

tests/integration/jms/src/test/java/io/helidon/messaging/connectors/jms/AbstractMPTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
import org.hamcrest.Matchers;
3131

3232
import static org.hamcrest.MatcherAssert.assertThat;
33-
import static org.junit.jupiter.api.Assertions.assertTrue;
33+
import static org.hamcrest.Matchers.is;
3434

3535
public abstract class AbstractMPTest extends AbstractJmsTest {
3636

@@ -52,8 +52,8 @@ protected void produceAndCheck(final AbstractSampleBean consumingBean,
5252
if (expected.size() > 0) {
5353
// Wait till records are delivered
5454
boolean done = consumingBean.await();
55-
assertTrue(done, String.format("Timeout waiting for results.\nExpected: %s \nBut was: %s",
56-
expected.toString(), consumingBean.consumed().toString()));
55+
assertThat(String.format("Timeout waiting for results.\nExpected: %s \nBut was: %s",
56+
expected.toString(), consumingBean.consumed().toString()), done, is(true));
5757
}
5858
if (!expected.isEmpty()) {
5959
assertThat(consumingBean.consumed(), Matchers.containsInAnyOrder(expected.toArray()));

tests/integration/jms/src/test/java/io/helidon/messaging/connectors/jms/AbstractSampleBean.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@
4848
import static org.hamcrest.Matchers.containsInAnyOrder;
4949
import static org.hamcrest.Matchers.equalTo;
5050
import static org.hamcrest.Matchers.is;
51-
import static org.junit.jupiter.api.Assertions.assertTrue;
5251

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

250249
public void await(long timeout) {
251250
try {
252-
assertTrue(countDownLatch.await(timeout, TimeUnit.MILLISECONDS));
251+
assertThat(countDownLatch.await(timeout, TimeUnit.MILLISECONDS), is(true));
253252
} catch (InterruptedException e) {
254253
throw new RuntimeException(e);
255254
}
@@ -286,7 +285,7 @@ public static class ChannelProperties extends AbstractSampleBean {
286285

287286
public void await(long timeout) {
288287
try {
289-
assertTrue(countDownLatch.await(timeout, TimeUnit.MILLISECONDS));
288+
assertThat(countDownLatch.await(timeout, TimeUnit.MILLISECONDS), is(true));
290289
} catch (InterruptedException e) {
291290
throw new RuntimeException(e);
292291
}
@@ -331,7 +330,7 @@ public static class ChannelCustomMapper extends AbstractSampleBean {
331330

332331
public void await(long timeout) {
333332
try {
334-
assertTrue(countDownLatch.await(timeout, TimeUnit.MILLISECONDS));
333+
assertThat(countDownLatch.await(timeout, TimeUnit.MILLISECONDS), is(true));
335334
} catch (InterruptedException e) {
336335
throw new RuntimeException(e);
337336
}
@@ -375,7 +374,7 @@ public static class ChannelDerivedMessage extends AbstractSampleBean {
375374

376375
public void await(long timeout) {
377376
try {
378-
assertTrue(countDownLatch.await(timeout, TimeUnit.MILLISECONDS));
377+
assertThat(countDownLatch.await(timeout, TimeUnit.MILLISECONDS), is(true));
379378
} catch (InterruptedException e) {
380379
throw new RuntimeException(e);
381380
}

tests/integration/jms/src/test/java/io/helidon/messaging/connectors/jms/JmsSeTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@
3434
import org.junit.jupiter.api.Test;
3535

3636
import static org.hamcrest.MatcherAssert.assertThat;
37+
import static org.hamcrest.Matchers.is;
3738
import static org.hamcrest.Matchers.containsInAnyOrder;
3839
import static org.hamcrest.Matchers.startsWith;
39-
import static org.junit.jupiter.api.Assertions.assertTrue;
4040

4141
public class JmsSeTest extends AbstractJmsTest {
4242

@@ -81,7 +81,7 @@ void customFactoryTest() throws InterruptedException {
8181
.build()
8282
.start();
8383

84-
assertTrue(cdl.await(2, TimeUnit.SECONDS));
84+
assertThat(cdl.await(2, TimeUnit.SECONDS), is(true));
8585
assertThat(result, containsInAnyOrder("1", "2", "3", "4"));
8686
}
8787

0 commit comments

Comments
 (0)