Skip to content

Commit 19a3c14

Browse files
authored
Use static import for assertThat (#7188)
1 parent 09b1e47 commit 19a3c14

File tree

4 files changed

+20
-16
lines changed

4 files changed

+20
-16
lines changed

modules/solace/src/test/java/org/testcontainers/solace/SolaceContainerAMQPTest.java

+5-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package org.testcontainers.solace;
22

33
import org.apache.qpid.jms.JmsConnectionFactory;
4-
import org.assertj.core.api.Assertions;
54
import org.junit.Assert;
65
import org.junit.Test;
76
import org.slf4j.Logger;
@@ -19,6 +18,8 @@
1918
import javax.jms.TextMessage;
2019
import javax.jms.Topic;
2120

21+
import static org.assertj.core.api.Assertions.assertThat;
22+
2223
public class SolaceContainerAMQPTest {
2324

2425
private static final Logger LOGGER = LoggerFactory.getLogger(SolaceContainerAMQPTest.class);
@@ -42,8 +43,8 @@ public void testSolaceContainer() throws JMSException {
4243
solaceContainer.getOrigin(Service.AMQP)
4344
);
4445
// }
45-
Assertions.assertThat(session).isNotNull();
46-
Assertions.assertThat(consumeMessageFromSolace(session)).isEqualTo(MESSAGE);
46+
assertThat(session).isNotNull();
47+
assertThat(consumeMessageFromSolace(session)).isEqualTo(MESSAGE);
4748
session.close();
4849
}
4950
}
@@ -86,7 +87,7 @@ private String consumeMessageFromSolace(Session session) {
8687
}
8788
});
8889
publishMessageToSolace(session, topic);
89-
Assertions.assertThat(latch.await(10L, TimeUnit.SECONDS)).isTrue();
90+
assertThat(latch.await(10L, TimeUnit.SECONDS)).isTrue();
9091
messageConsumer.close();
9192
return result[0];
9293
} catch (Exception e) {

modules/solace/src/test/java/org/testcontainers/solace/SolaceContainerMQTTTest.java

+5-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package org.testcontainers.solace;
22

3-
import org.assertj.core.api.Assertions;
43
import org.eclipse.paho.client.mqttv3.IMqttDeliveryToken;
54
import org.eclipse.paho.client.mqttv3.MqttCallback;
65
import org.eclipse.paho.client.mqttv3.MqttClient;
@@ -15,6 +14,8 @@
1514
import java.util.concurrent.CountDownLatch;
1615
import java.util.concurrent.TimeUnit;
1716

17+
import static org.assertj.core.api.Assertions.assertThat;
18+
1819
public class SolaceContainerMQTTTest {
1920

2021
private static final Logger LOGGER = LoggerFactory.getLogger(SolaceContainerMQTTTest.class);
@@ -36,8 +37,8 @@ public void testSolaceContainer() {
3637
solaceContainer.getPassword(),
3738
solaceContainer.getOrigin(Service.MQTT)
3839
);
39-
Assertions.assertThat(client).isNotNull();
40-
Assertions.assertThat(consumeMessageFromSolace(client)).isEqualTo(MESSAGE);
40+
assertThat(client).isNotNull();
41+
assertThat(consumeMessageFromSolace(client)).isEqualTo(MESSAGE);
4142
}
4243
}
4344

@@ -86,7 +87,7 @@ public void deliveryComplete(IMqttDeliveryToken token) {}
8687
);
8788
client.subscribe(TOPIC_NAME, 0);
8889
publishMessageToSolace(client);
89-
Assertions.assertThat(latch.await(10L, TimeUnit.SECONDS)).isTrue();
90+
assertThat(latch.await(10L, TimeUnit.SECONDS)).isTrue();
9091
return result[0];
9192
} catch (Exception e) {
9293
throw new RuntimeException("Cannot receive message from solace", e);

modules/solace/src/test/java/org/testcontainers/solace/SolaceContainerRESTTest.java

+3-2
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,13 @@
1212
import org.apache.http.impl.client.BasicCredentialsProvider;
1313
import org.apache.http.impl.client.HttpClientBuilder;
1414
import org.apache.http.util.EntityUtils;
15-
import org.assertj.core.api.Assertions;
1615
import org.junit.Assert;
1716
import org.junit.Test;
1817

1918
import java.io.IOException;
2019

20+
import static org.assertj.core.api.Assertions.assertThat;
21+
2122
public class SolaceContainerRESTTest {
2223

2324
private static final String MESSAGE = "HelloWorld";
@@ -45,7 +46,7 @@ private void testPublishMessageToSolace(SolaceContainer solaceContainer, Service
4546
if (response.getStatusLine().getStatusCode() != HttpStatus.SC_OK) {
4647
Assert.fail("Cannot send message to solace - " + EntityUtils.toString(response.getEntity()));
4748
}
48-
Assertions.assertThat(EntityUtils.toString(response.getEntity())).isEmpty();
49+
assertThat(EntityUtils.toString(response.getEntity())).isEmpty();
4950
}
5051

5152
private HttpClient createClient(SolaceContainer solaceContainer) {

modules/solace/src/test/java/org/testcontainers/solace/SolaceContainerSMFTest.java

+7-6
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
import com.solacesystems.jcsmp.XMLMessageConsumer;
1212
import com.solacesystems.jcsmp.XMLMessageListener;
1313
import com.solacesystems.jcsmp.XMLMessageProducer;
14-
import org.assertj.core.api.Assertions;
1514
import org.junit.Assert;
1615
import org.junit.Test;
1716
import org.slf4j.Logger;
@@ -21,6 +20,8 @@
2120
import java.util.concurrent.CountDownLatch;
2221
import java.util.concurrent.TimeUnit;
2322

23+
import static org.assertj.core.api.Assertions.assertThat;
24+
2425
public class SolaceContainerSMFTest {
2526

2627
private static final Logger LOGGER = LoggerFactory.getLogger(SolaceContainerSMFTest.class);
@@ -41,8 +42,8 @@ public void testSolaceContainerWithSimpleAuthentication() {
4142
) {
4243
solaceContainer.start();
4344
JCSMPSession session = createSessionWithBasicAuth(solaceContainer);
44-
Assertions.assertThat(session).isNotNull();
45-
Assertions.assertThat(consumeMessageFromSolace(session)).isEqualTo(MESSAGE);
45+
assertThat(session).isNotNull();
46+
assertThat(consumeMessageFromSolace(session)).isEqualTo(MESSAGE);
4647
session.closeSession();
4748
}
4849
}
@@ -61,8 +62,8 @@ public void testSolaceContainerWithCertificates() {
6162
) {
6263
solaceContainer.start();
6364
JCSMPSession session = createSessionWithCertificates(solaceContainer);
64-
Assertions.assertThat(session).isNotNull();
65-
Assertions.assertThat(consumeMessageFromSolace(session)).isEqualTo(MESSAGE);
65+
assertThat(session).isNotNull();
66+
assertThat(consumeMessageFromSolace(session)).isEqualTo(MESSAGE);
6667
session.closeSession();
6768
}
6869
}
@@ -157,7 +158,7 @@ public void onException(JCSMPException e) {
157158
session.addSubscription(TOPIC);
158159
cons.start();
159160
publishMessageToSolace(session);
160-
Assertions.assertThat(latch.await(10L, TimeUnit.SECONDS)).isTrue();
161+
assertThat(latch.await(10L, TimeUnit.SECONDS)).isTrue();
161162
return result[0];
162163
} catch (Exception e) {
163164
throw new RuntimeException("Cannot receive message from solace", e);

0 commit comments

Comments
 (0)