Skip to content

Commit

Permalink
[2.x]: Use Hamcrest assertions instead of JUnit in tests/integration/…
Browse files Browse the repository at this point in the history
…jms (#1749) (#6645)
  • Loading branch information
Captain1653 authored Apr 19, 2023
1 parent 5e3553a commit a446551
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020, 2022 Oracle and/or its affiliates.
* Copyright (c) 2020, 2023 Oracle and/or its affiliates.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -29,7 +29,7 @@
import javax.jms.TextMessage;

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

import org.hamcrest.Matchers;

Expand All @@ -53,8 +53,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
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020 Oracle and/or its affiliates.
* Copyright (c) 2020, 2023 Oracle and/or its affiliates.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -255,7 +255,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 @@ -292,7 +292,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 @@ -337,7 +337,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 @@ -381,7 +381,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
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020 Oracle and/or its affiliates.
* Copyright (c) 2020, 2023 Oracle and/or its affiliates.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -30,9 +30,9 @@
import io.helidon.messaging.Messaging;

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;

import org.apache.activemq.jndi.ActiveMQInitialContextFactory;
import org.eclipse.microprofile.reactive.messaging.Message;
Expand Down Expand Up @@ -80,7 +80,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

0 comments on commit a446551

Please sign in to comment.