ARTEMIS-4778: replace various assertEquals checks with more apropriate assertTrue / assertFalse / assertNull

This commit is contained in:
Robbie Gemmell 2024-05-21 16:15:51 +01:00
parent 98e1389a6e
commit 3e20687cf3
8 changed files with 26 additions and 26 deletions

View File

@ -106,7 +106,7 @@ public class ActiveMQXAConnectionFactoryTest extends CombinationTestSupport {
assertEquals(10, cf.getRedeliveryPolicy().getMaximumRedeliveries());
assertEquals(10000, cf.getRedeliveryPolicy().getInitialRedeliveryDelay());
assertEquals(10000, cf.getRedeliveryPolicy().getRedeliveryDelay());
assertEquals(true, cf.getRedeliveryPolicy().isUseExponentialBackOff());
assertTrue(cf.getRedeliveryPolicy().isUseExponentialBackOff());
assertEquals(2.0, cf.getRedeliveryPolicy().getBackOffMultiplier(), 0.1);
// the broker url have been adjusted.

View File

@ -531,7 +531,7 @@ public class ActiveMQMessageTest extends TestCase {
assertEquals("Cheddar", msg.getStringProperty(name));
msg.setStringProperty(name, null);
assertEquals(null, msg.getStringProperty(name));
assertNull(msg.getStringProperty(name));
}
public void testSetNullPropertyName() throws JMSException {

View File

@ -91,7 +91,7 @@ public class JMSXPropertyTest extends PTPTestCase {
// senderSession has been created as non transacted
// we create it again but as a transacted session
senderSession = senderConnection.createQueueSession(true, 0);
Assert.assertEquals(true, senderSession.getTransacted());
Assert.assertTrue(senderSession.getTransacted());
// we create again the sender
sender = senderSession.createSender(senderQueue);
senderConnection.start();
@ -100,7 +100,7 @@ public class JMSXPropertyTest extends PTPTestCase {
// receiverSession has been created as non transacted
// we create it again but as a transacted session
receiverSession = receiverConnection.createQueueSession(true, 0);
Assert.assertEquals(true, receiverSession.getTransacted());
Assert.assertTrue(receiverSession.getTransacted());
// we create again the receiver
if (receiver != null) {
receiver.close();
@ -123,7 +123,7 @@ public class JMSXPropertyTest extends PTPTestCase {
// ... which is the one which was sent...
Assert.assertEquals("testJMSXDeliveryCount", msg.getText());
// ...and has not been redelivered
Assert.assertEquals(false, msg.getJMSRedelivered());
Assert.assertFalse(msg.getJMSRedelivered());
// ... so it has been delivered once
int jmsxDeliveryCount = msg.getIntProperty("JMSXDeliveryCount");
Assert.assertEquals(1, jmsxDeliveryCount);
@ -138,7 +138,7 @@ public class JMSXPropertyTest extends PTPTestCase {
// ... which is still the one which was sent...
Assert.assertEquals("testJMSXDeliveryCount", msg.getText());
// .. but this time, it has been redelivered
Assert.assertEquals(true, msg.getJMSRedelivered());
Assert.assertTrue(msg.getJMSRedelivered());
// ... so it has been delivered a second time
jmsxDeliveryCount = msg.getIntProperty("JMSXDeliveryCount");
Assert.assertEquals(2, jmsxDeliveryCount);

View File

@ -293,7 +293,7 @@ public class MessagePropertyConversionTest extends PTPTestCase {
try {
Message message = senderSession.createMessage();
message.setStringProperty("prop", "test");
Assert.assertEquals(false, message.getBooleanProperty("prop"));
Assert.assertFalse(message.getBooleanProperty("prop"));
} catch (MessageFormatException e) {
} catch (JMSException e) {
fail(e);
@ -310,7 +310,7 @@ public class MessagePropertyConversionTest extends PTPTestCase {
try {
Message message = senderSession.createMessage();
message.setStringProperty("prop", "true");
Assert.assertEquals(true, message.getBooleanProperty("prop"));
Assert.assertTrue(message.getBooleanProperty("prop"));
} catch (JMSException e) {
fail(e);
}
@ -1240,7 +1240,7 @@ public class MessagePropertyConversionTest extends PTPTestCase {
try {
Message message = senderSession.createMessage();
message.setBooleanProperty("prop", true);
Assert.assertEquals(true, message.getBooleanProperty("prop"));
Assert.assertTrue(message.getBooleanProperty("prop"));
} catch (JMSException e) {
fail(e);
}

View File

@ -198,7 +198,7 @@ public class MessagePropertyTest extends PTPTestCase {
public void testGetBooleanProperty() {
try {
Message message = senderSession.createMessage();
Assert.assertEquals(false, message.getBooleanProperty("prop"));
Assert.assertFalse(message.getBooleanProperty("prop"));
} catch (JMSException e) {
fail(e);
}

View File

@ -46,7 +46,7 @@ public class QueueSessionTest extends PTPTestCase {
// senderSession has been created as non transacted
// we create it again but as a transacted session
senderSession = senderConnection.createQueueSession(true, 0);
Assert.assertEquals(true, senderSession.getTransacted());
Assert.assertTrue(senderSession.getTransacted());
// we create again the sender
sender = senderSession.createSender(senderQueue);
senderConnection.start();
@ -55,7 +55,7 @@ public class QueueSessionTest extends PTPTestCase {
// receiverSession has been created as non transacted
// we create it again but as a transacted session
receiverSession = receiverConnection.createQueueSession(true, 0);
Assert.assertEquals(true, receiverSession.getTransacted());
Assert.assertTrue(receiverSession.getTransacted());
if (receiver != null) {
receiver.close();
@ -79,7 +79,7 @@ public class QueueSessionTest extends PTPTestCase {
// ... which is the one which was sent...
Assert.assertEquals("testRollbackRececeivedMessage", msg.getText());
// ...and has not been redelivered
Assert.assertEquals(false, msg.getJMSRedelivered());
Assert.assertFalse(msg.getJMSRedelivered());
// we rollback the *consumer* transaction
receiverSession.rollback();
@ -92,7 +92,7 @@ public class QueueSessionTest extends PTPTestCase {
// ... which is still the one which was sent...
Assert.assertEquals("testRollbackRececeivedMessage", msg.getText());
// .. but this time, it has been redelivered
Assert.assertEquals(true, msg.getJMSRedelivered());
Assert.assertTrue(msg.getJMSRedelivered());
} catch (Exception e) {
fail(e);

View File

@ -42,10 +42,10 @@ public class SessionTest extends PTPTestCase {
public void testRecoverTransactedSession() {
try {
// senderSession has been created as non transacted
Assert.assertEquals(false, senderSession.getTransacted());
Assert.assertFalse(senderSession.getTransacted());
// we create it again but as a transacted session
senderSession = senderConnection.createQueueSession(true, 0);
Assert.assertEquals(true, senderSession.getTransacted());
Assert.assertTrue(senderSession.getTransacted());
senderSession.recover();
Assert.fail("Should raise an IllegalStateException, the session is not transacted.\n");
} catch (javax.jms.IllegalStateException e) {
@ -67,7 +67,7 @@ public class SessionTest extends PTPTestCase {
// re-create senderSession as a transacted session
senderSession = senderConnection.createQueueSession(true, 0);
sender = senderSession.createSender(senderQueue);
Assert.assertEquals(true, senderSession.getTransacted());
Assert.assertTrue(senderSession.getTransacted());
TextMessage message = senderSession.createTextMessage();
message.setText("testRollbackTransactedSession");
@ -79,7 +79,7 @@ public class SessionTest extends PTPTestCase {
TextMessage m = (TextMessage) receiver.receiveNoWait();
// test that no message has been received
Assert.assertEquals(null, m);
Assert.assertNull(m);
} catch (Exception e) {
fail(e);
}
@ -96,7 +96,7 @@ public class SessionTest extends PTPTestCase {
// re-create senderSession as a transacted session
senderSession = senderConnection.createQueueSession(true, 0);
sender = senderSession.createSender(senderQueue);
Assert.assertEquals(true, senderSession.getTransacted());
Assert.assertTrue(senderSession.getTransacted());
TextMessage message = senderSession.createTextMessage();
message.setText("testCommitTransactedSession");
@ -105,7 +105,7 @@ public class SessionTest extends PTPTestCase {
TextMessage m = (TextMessage) receiver.receiveNoWait();
// test that no message has been received (the transaction has not been committed yet)
Assert.assertEquals(null, m);
Assert.assertNull(m);
// commit the transaction -> the sent message should be received
senderSession.commit();
@ -127,7 +127,7 @@ public class SessionTest extends PTPTestCase {
public void testRollbackNonTransactedSession() {
try {
// senderSession has been created as non transacted in the setUp() method
Assert.assertEquals(false, senderSession.getTransacted());
Assert.assertFalse(senderSession.getTransacted());
senderSession.rollback();
Assert.fail("Should raise an IllegalStateException, the session is not transacted.\n");
} catch (javax.jms.IllegalStateException e) {
@ -147,7 +147,7 @@ public class SessionTest extends PTPTestCase {
public void testCommitNonTransactedSession() {
try {
// senderSession has been created as non transacted in the setUp() method
Assert.assertEquals(false, senderSession.getTransacted());
Assert.assertFalse(senderSession.getTransacted());
senderSession.commit();
Assert.fail("Should raise an IllegalStateException, the session is not transacted.\n");
} catch (javax.jms.IllegalStateException e) {
@ -166,10 +166,10 @@ public class SessionTest extends PTPTestCase {
public void testGetTransacted() {
try {
// senderSession has been created as non transacted
Assert.assertEquals(false, senderSession.getTransacted());
Assert.assertFalse(senderSession.getTransacted());
// we re-create senderSession as a transacted session
senderSession = senderConnection.createQueueSession(true, Session.AUTO_ACKNOWLEDGE);
Assert.assertEquals(true, senderSession.getTransacted());
Assert.assertTrue(senderSession.getTransacted());
} catch (Exception e) {
fail(e);
}

View File

@ -47,7 +47,7 @@ public class TopicSessionTest extends PubSubTestCase {
// publisherSession has been declared has non transacted
// we recreate it as a transacted session
publisherSession = publisherConnection.createTopicSession(true, 0);
Assert.assertEquals(true, publisherSession.getTransacted());
Assert.assertTrue(publisherSession.getTransacted());
// we also recreate the publisher
publisher = publisherSession.createPublisher(publisherTopic);
publisherConnection.start();
@ -56,7 +56,7 @@ public class TopicSessionTest extends PubSubTestCase {
// subscriberSession has been declared has non transacted
// we recreate it as a transacted session
subscriberSession = subscriberConnection.createTopicSession(true, 0);
Assert.assertEquals(true, subscriberSession.getTransacted());
Assert.assertTrue(subscriberSession.getTransacted());
// we also recreate the subscriber
subscriber = subscriberSession.createSubscriber(subscriberTopic);
subscriberConnection.start();