Skip to content

Commit

Permalink
Use static import for assertThat (#7188)
Browse files Browse the repository at this point in the history
  • Loading branch information
eddumelendez committed Jun 13, 2023
1 parent 09b1e47 commit 19a3c14
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 16 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package org.testcontainers.solace;

import org.apache.qpid.jms.JmsConnectionFactory;
import org.assertj.core.api.Assertions;
import org.junit.Assert;
import org.junit.Test;
import org.slf4j.Logger;
Expand All @@ -19,6 +18,8 @@
import javax.jms.TextMessage;
import javax.jms.Topic;

import static org.assertj.core.api.Assertions.assertThat;

public class SolaceContainerAMQPTest {

private static final Logger LOGGER = LoggerFactory.getLogger(SolaceContainerAMQPTest.class);
Expand All @@ -42,8 +43,8 @@ public void testSolaceContainer() throws JMSException {
solaceContainer.getOrigin(Service.AMQP)
);
// }
Assertions.assertThat(session).isNotNull();
Assertions.assertThat(consumeMessageFromSolace(session)).isEqualTo(MESSAGE);
assertThat(session).isNotNull();
assertThat(consumeMessageFromSolace(session)).isEqualTo(MESSAGE);
session.close();
}
}
Expand Down Expand Up @@ -86,7 +87,7 @@ private String consumeMessageFromSolace(Session session) {
}
});
publishMessageToSolace(session, topic);
Assertions.assertThat(latch.await(10L, TimeUnit.SECONDS)).isTrue();
assertThat(latch.await(10L, TimeUnit.SECONDS)).isTrue();
messageConsumer.close();
return result[0];
} catch (Exception e) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package org.testcontainers.solace;

import org.assertj.core.api.Assertions;
import org.eclipse.paho.client.mqttv3.IMqttDeliveryToken;
import org.eclipse.paho.client.mqttv3.MqttCallback;
import org.eclipse.paho.client.mqttv3.MqttClient;
Expand All @@ -15,6 +14,8 @@
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;

import static org.assertj.core.api.Assertions.assertThat;

public class SolaceContainerMQTTTest {

private static final Logger LOGGER = LoggerFactory.getLogger(SolaceContainerMQTTTest.class);
Expand All @@ -36,8 +37,8 @@ public void testSolaceContainer() {
solaceContainer.getPassword(),
solaceContainer.getOrigin(Service.MQTT)
);
Assertions.assertThat(client).isNotNull();
Assertions.assertThat(consumeMessageFromSolace(client)).isEqualTo(MESSAGE);
assertThat(client).isNotNull();
assertThat(consumeMessageFromSolace(client)).isEqualTo(MESSAGE);
}
}

Expand Down Expand Up @@ -86,7 +87,7 @@ public void deliveryComplete(IMqttDeliveryToken token) {}
);
client.subscribe(TOPIC_NAME, 0);
publishMessageToSolace(client);
Assertions.assertThat(latch.await(10L, TimeUnit.SECONDS)).isTrue();
assertThat(latch.await(10L, TimeUnit.SECONDS)).isTrue();
return result[0];
} catch (Exception e) {
throw new RuntimeException("Cannot receive message from solace", e);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,13 @@
import org.apache.http.impl.client.BasicCredentialsProvider;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.util.EntityUtils;
import org.assertj.core.api.Assertions;
import org.junit.Assert;
import org.junit.Test;

import java.io.IOException;

import static org.assertj.core.api.Assertions.assertThat;

public class SolaceContainerRESTTest {

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

private HttpClient createClient(SolaceContainer solaceContainer) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
import com.solacesystems.jcsmp.XMLMessageConsumer;
import com.solacesystems.jcsmp.XMLMessageListener;
import com.solacesystems.jcsmp.XMLMessageProducer;
import org.assertj.core.api.Assertions;
import org.junit.Assert;
import org.junit.Test;
import org.slf4j.Logger;
Expand All @@ -21,6 +20,8 @@
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;

import static org.assertj.core.api.Assertions.assertThat;

public class SolaceContainerSMFTest {

private static final Logger LOGGER = LoggerFactory.getLogger(SolaceContainerSMFTest.class);
Expand All @@ -41,8 +42,8 @@ public void testSolaceContainerWithSimpleAuthentication() {
) {
solaceContainer.start();
JCSMPSession session = createSessionWithBasicAuth(solaceContainer);
Assertions.assertThat(session).isNotNull();
Assertions.assertThat(consumeMessageFromSolace(session)).isEqualTo(MESSAGE);
assertThat(session).isNotNull();
assertThat(consumeMessageFromSolace(session)).isEqualTo(MESSAGE);
session.closeSession();
}
}
Expand All @@ -61,8 +62,8 @@ public void testSolaceContainerWithCertificates() {
) {
solaceContainer.start();
JCSMPSession session = createSessionWithCertificates(solaceContainer);
Assertions.assertThat(session).isNotNull();
Assertions.assertThat(consumeMessageFromSolace(session)).isEqualTo(MESSAGE);
assertThat(session).isNotNull();
assertThat(consumeMessageFromSolace(session)).isEqualTo(MESSAGE);
session.closeSession();
}
}
Expand Down Expand Up @@ -157,7 +158,7 @@ public void onException(JCSMPException e) {
session.addSubscription(TOPIC);
cons.start();
publishMessageToSolace(session);
Assertions.assertThat(latch.await(10L, TimeUnit.SECONDS)).isTrue();
assertThat(latch.await(10L, TimeUnit.SECONDS)).isTrue();
return result[0];
} catch (Exception e) {
throw new RuntimeException("Cannot receive message from solace", e);
Expand Down

0 comments on commit 19a3c14

Please sign in to comment.