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

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

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
@@ -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