Skip to content

Commit 005d866

Browse files
committed
[2.x]: Use Hamcrest assertions instead of JUnit in tests/integration/jms (helidon-io#1749)
1 parent 5e3553a commit 005d866

File tree

3 files changed

+12
-12
lines changed

3 files changed

+12
-12
lines changed

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

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2020, 2022 Oracle and/or its affiliates.
2+
* Copyright (c) 2020, 2023 Oracle and/or its affiliates.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -29,7 +29,7 @@
2929
import javax.jms.TextMessage;
3030

3131
import static org.hamcrest.MatcherAssert.assertThat;
32-
import static org.junit.jupiter.api.Assertions.assertTrue;
32+
import static org.hamcrest.Matchers.is;
3333

3434
import org.hamcrest.Matchers;
3535

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

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

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2020 Oracle and/or its affiliates.
2+
* Copyright (c) 2020, 2023 Oracle and/or its affiliates.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -255,7 +255,7 @@ public static class ChannelBytes extends AbstractSampleBean {
255255

256256
public void await(long timeout) {
257257
try {
258-
assertTrue(countDownLatch.await(timeout, TimeUnit.MILLISECONDS));
258+
assertThat(countDownLatch.await(timeout, TimeUnit.MILLISECONDS), is(true));
259259
} catch (InterruptedException e) {
260260
throw new RuntimeException(e);
261261
}
@@ -292,7 +292,7 @@ public static class ChannelProperties extends AbstractSampleBean {
292292

293293
public void await(long timeout) {
294294
try {
295-
assertTrue(countDownLatch.await(timeout, TimeUnit.MILLISECONDS));
295+
assertThat(countDownLatch.await(timeout, TimeUnit.MILLISECONDS), is(true));
296296
} catch (InterruptedException e) {
297297
throw new RuntimeException(e);
298298
}
@@ -337,7 +337,7 @@ public static class ChannelCustomMapper extends AbstractSampleBean {
337337

338338
public void await(long timeout) {
339339
try {
340-
assertTrue(countDownLatch.await(timeout, TimeUnit.MILLISECONDS));
340+
assertThat(countDownLatch.await(timeout, TimeUnit.MILLISECONDS), is(true));
341341
} catch (InterruptedException e) {
342342
throw new RuntimeException(e);
343343
}
@@ -381,7 +381,7 @@ public static class ChannelDerivedMessage extends AbstractSampleBean {
381381

382382
public void await(long timeout) {
383383
try {
384-
assertTrue(countDownLatch.await(timeout, TimeUnit.MILLISECONDS));
384+
assertThat(countDownLatch.await(timeout, TimeUnit.MILLISECONDS), is(true));
385385
} catch (InterruptedException e) {
386386
throw new RuntimeException(e);
387387
}

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

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2020 Oracle and/or its affiliates.
2+
* Copyright (c) 2020, 2023 Oracle and/or its affiliates.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -30,9 +30,9 @@
3030
import io.helidon.messaging.Messaging;
3131

3232
import static org.hamcrest.MatcherAssert.assertThat;
33+
import static org.hamcrest.Matchers.is;
3334
import static org.hamcrest.Matchers.containsInAnyOrder;
3435
import static org.hamcrest.Matchers.startsWith;
35-
import static org.junit.jupiter.api.Assertions.assertTrue;
3636

3737
import org.apache.activemq.jndi.ActiveMQInitialContextFactory;
3838
import org.eclipse.microprofile.reactive.messaging.Message;
@@ -80,7 +80,7 @@ void customFactoryTest() throws InterruptedException {
8080
.build()
8181
.start();
8282

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

0 commit comments

Comments
 (0)