This is an automated email from the ASF dual-hosted git repository. orpiske pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/master by this push: new 3a78908 (chores) Simplified assertions (#4641) 3a78908 is described below commit 3a789087d99ffd7c4420f5fd6690634f434a5f32 Author: Otavio Rodolfo Piske <orpi...@users.noreply.github.com> AuthorDate: Fri Nov 20 12:32:33 2020 +0100 (chores) Simplified assertions (#4641) Components: camel-aws2-sqs, camel-hazelcast, camel-jetty, camel-jms, camel-jmx, camel-mail, camel-mongodb, camel-mybatis, camel-netty, camel-openstack --- .../aws2/sqs/SqsConsumerIdleMessageTest.java | 6 +++--- .../sqs/SqsDoesNotExtendMessageVisibilityTest.java | 4 ++-- .../hazelcast/HazelcastConfigurationTest.java | 21 +++++++++++---------- .../camel/component/jetty/HttpConverterTest.java | 3 +-- .../component/jms/tx/AbstractTransactionTest.java | 4 ++-- ...nsactionWithoutDefineTransactionManagerTest.java | 4 ++-- .../jmx/JMXRobustRemoteConnectionTest.java | 3 ++- .../component/mail/MailConsumerIdleMessageTest.java | 6 +++--- .../mongodb/MongoDbBigDecimalConverterTest.java | 2 +- .../mongodb/MongoDbHeaderHandlingTest.java | 2 +- .../mybatis/MyBatisConsumerIdleMessageTest.java | 6 +++--- .../NettyTcpWithInOutUsingPlainSocketTest.java | 4 ++-- .../openstack/keystone/DomainProducerTest.java | 3 +-- .../openstack/keystone/GroupProducerTest.java | 3 +-- .../openstack/keystone/ProjectProducerTest.java | 3 +-- .../openstack/keystone/RegionProducerTest.java | 3 +-- .../openstack/keystone/UserProducerTest.java | 3 +-- .../openstack/neutron/NetworkProducerTest.java | 3 +-- .../openstack/neutron/PortProducerTest.java | 3 +-- .../openstack/neutron/RouterProducerTest.java | 3 +-- .../openstack/neutron/SubnetProducerTest.java | 3 +-- .../openstack/nova/FlavorProducerTest.java | 3 +-- .../openstack/nova/ServerProducerTest.java | 4 ++-- 23 files changed, 45 insertions(+), 54 deletions(-) diff --git a/components/camel-aws2-sqs/src/test/java/org/apache/camel/component/aws2/sqs/SqsConsumerIdleMessageTest.java b/components/camel-aws2-sqs/src/test/java/org/apache/camel/component/aws2/sqs/SqsConsumerIdleMessageTest.java index 8ecb044..7afc88b 100644 --- a/components/camel-aws2-sqs/src/test/java/org/apache/camel/component/aws2/sqs/SqsConsumerIdleMessageTest.java +++ b/components/camel-aws2-sqs/src/test/java/org/apache/camel/component/aws2/sqs/SqsConsumerIdleMessageTest.java @@ -22,7 +22,7 @@ import org.apache.camel.component.mock.MockEndpoint; import org.apache.camel.test.junit5.CamelTestSupport; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.assertNull; /** * Test to verify that the polling consumer delivers an empty Exchange when the sendEmptyMessageWhenIdle property is set @@ -39,8 +39,8 @@ public class SqsConsumerIdleMessageTest extends CamelTestSupport { MockEndpoint mock = getMockEndpoint("mock:result"); mock.expectedMinimumMessageCount(2); assertMockEndpointsSatisfied(); - assertTrue(mock.getExchanges().get(0).getIn().getBody() == null); - assertTrue(mock.getExchanges().get(1).getIn().getBody() == null); + assertNull(mock.getExchanges().get(0).getIn().getBody()); + assertNull(mock.getExchanges().get(1).getIn().getBody()); } @Override diff --git a/components/camel-aws2-sqs/src/test/java/org/apache/camel/component/aws2/sqs/SqsDoesNotExtendMessageVisibilityTest.java b/components/camel-aws2-sqs/src/test/java/org/apache/camel/component/aws2/sqs/SqsDoesNotExtendMessageVisibilityTest.java index 9bdae36..404560a 100644 --- a/components/camel-aws2-sqs/src/test/java/org/apache/camel/component/aws2/sqs/SqsDoesNotExtendMessageVisibilityTest.java +++ b/components/camel-aws2-sqs/src/test/java/org/apache/camel/component/aws2/sqs/SqsDoesNotExtendMessageVisibilityTest.java @@ -26,7 +26,7 @@ import org.apache.camel.test.junit5.CamelTestSupport; import org.junit.jupiter.api.Test; import software.amazon.awssdk.services.sqs.model.Message; -import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; public class SqsDoesNotExtendMessageVisibilityTest extends CamelTestSupport { @@ -58,7 +58,7 @@ public class SqsDoesNotExtendMessageVisibilityTest extends CamelTestSupport { this.client.messages.add(message.build()); assertMockEndpointsSatisfied(); // Wait for message to arrive. - assertTrue(this.client.changeMessageVisibilityRequests.size() == 0); + assertEquals(0, this.client.changeMessageVisibilityRequests.size()); } @Override diff --git a/components/camel-hazelcast/src/test/java/org/apache/camel/component/hazelcast/HazelcastConfigurationTest.java b/components/camel-hazelcast/src/test/java/org/apache/camel/component/hazelcast/HazelcastConfigurationTest.java index b037dc0..27971e0 100644 --- a/components/camel-hazelcast/src/test/java/org/apache/camel/component/hazelcast/HazelcastConfigurationTest.java +++ b/components/camel-hazelcast/src/test/java/org/apache/camel/component/hazelcast/HazelcastConfigurationTest.java @@ -32,7 +32,9 @@ import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNotSame; import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertSame; import static org.junit.jupiter.api.Assertions.assertTrue; public class HazelcastConfigurationTest { @@ -66,7 +68,7 @@ public class HazelcastConfigurationTest { assertNotNull(endpoint1.getHazelcastInstance()); assertNotNull(endpoint2.getHazelcastInstance()); - assertTrue(endpoint1.getHazelcastInstance() == endpoint2.getHazelcastInstance()); + assertSame(endpoint1.getHazelcastInstance(), endpoint2.getHazelcastInstance()); HazelcastMapComponent component = context.getComponent("hazelcast-map", HazelcastMapComponent.class); assertNull(component.getHazelcastInstance()); @@ -99,7 +101,7 @@ public class HazelcastConfigurationTest { assertNotNull(endpoint1.getHazelcastInstance()); assertNotNull(endpoint2.getHazelcastInstance()); - assertTrue(endpoint1.getHazelcastInstance() != endpoint2.getHazelcastInstance()); + assertNotSame(endpoint1.getHazelcastInstance(), endpoint2.getHazelcastInstance()); HazelcastMapComponent component = context.getComponent("hazelcast-map", HazelcastMapComponent.class); assertNull(component.getHazelcastInstance()); @@ -133,7 +135,7 @@ public class HazelcastConfigurationTest { assertNotNull(endpoint1.getHazelcastInstance()); assertNotNull(endpoint2.getHazelcastInstance()); - assertTrue(endpoint1.getHazelcastInstance() == endpoint2.getHazelcastInstance()); + assertSame(endpoint1.getHazelcastInstance(), endpoint2.getHazelcastInstance()); HazelcastMapComponent component = context.getComponent("hazelcast-map", HazelcastMapComponent.class); assertNull(component.getHazelcastInstance()); @@ -166,7 +168,7 @@ public class HazelcastConfigurationTest { assertNotNull(endpoint1.getHazelcastInstance()); assertNotNull(endpoint2.getHazelcastInstance()); - assertTrue(endpoint1.getHazelcastInstance() != endpoint2.getHazelcastInstance()); + assertNotSame(endpoint1.getHazelcastInstance(), endpoint2.getHazelcastInstance()); HazelcastMapComponent component = context.getComponent("hazelcast-map", HazelcastMapComponent.class); assertNull(component.getHazelcastInstance()); @@ -288,14 +290,13 @@ public class HazelcastConfigurationTest { assertEquals(4, Hazelcast.getAllHazelcastInstances().size()); - assertTrue(hzNamed == endpoint1.getHazelcastInstance()); - assertTrue( - Hazelcast.getHazelcastInstanceByName(customConfig.getInstanceName()) == endpoint2.getHazelcastInstance()); - assertTrue(hzShared == endpoint3.getHazelcastInstance()); - assertTrue(hzComponent == endpoint4.getHazelcastInstance()); + assertSame(hzNamed, endpoint1.getHazelcastInstance()); + assertSame(Hazelcast.getHazelcastInstanceByName(customConfig.getInstanceName()), endpoint2.getHazelcastInstance()); + assertSame(hzShared, endpoint3.getHazelcastInstance()); + assertSame(hzComponent, endpoint4.getHazelcastInstance()); assertNotNull(component.getHazelcastInstance()); - assertTrue(hzComponent == component.getHazelcastInstance()); + assertSame(hzComponent, component.getHazelcastInstance()); context.stop(); diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpConverterTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpConverterTest.java index 288b500..62b540a 100644 --- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpConverterTest.java +++ b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpConverterTest.java @@ -32,7 +32,6 @@ import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertNull; -import static org.junit.jupiter.api.Assertions.assertTrue; public class HttpConverterTest extends BaseJettyTest { @@ -80,7 +79,7 @@ public class HttpConverterTest extends BaseJettyTest { assertNotNull(sis); // The ServletInputStream should be cached and you can't // read message here - assertTrue(sis.available() == 0); + assertEquals(0, sis.available()); String s = msg.getBody(String.class); assertEquals("Hello World", s); diff --git a/components/camel-jms/src/test/java/org/apache/camel/component/jms/tx/AbstractTransactionTest.java b/components/camel-jms/src/test/java/org/apache/camel/component/jms/tx/AbstractTransactionTest.java index c98651d..11d09c4 100644 --- a/components/camel-jms/src/test/java/org/apache/camel/component/jms/tx/AbstractTransactionTest.java +++ b/components/camel-jms/src/test/java/org/apache/camel/component/jms/tx/AbstractTransactionTest.java @@ -32,8 +32,8 @@ import org.junit.jupiter.api.AfterEach; import org.springframework.context.support.AbstractXmlApplicationContext; import static org.apache.camel.test.junit5.TestSupport.assertIsInstanceOf; +import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; -import static org.junit.jupiter.api.Assertions.assertTrue; /** * Test case derived from: http://camel.apache.org/transactional-client.html and Martin Krasser's sample: @@ -63,7 +63,7 @@ public abstract class AbstractTransactionTest extends CamelSpringTestSupport { notify.matchesWaitTime(); - assertTrue(getConditionalExceptionProcessor().getCount() == 2, + assertEquals(2, getConditionalExceptionProcessor().getCount(), "Expected only 2 calls to process() (1 failure, 1 success) but encountered " + getConditionalExceptionProcessor().getCount() + "."); } diff --git a/components/camel-jms/src/test/java/org/apache/camel/component/jms/tx/QueueToQueueTransactionWithoutDefineTransactionManagerTest.java b/components/camel-jms/src/test/java/org/apache/camel/component/jms/tx/QueueToQueueTransactionWithoutDefineTransactionManagerTest.java index e1735c0..5702318 100644 --- a/components/camel-jms/src/test/java/org/apache/camel/component/jms/tx/QueueToQueueTransactionWithoutDefineTransactionManagerTest.java +++ b/components/camel-jms/src/test/java/org/apache/camel/component/jms/tx/QueueToQueueTransactionWithoutDefineTransactionManagerTest.java @@ -22,7 +22,7 @@ import org.apache.xbean.spring.context.ClassPathXmlApplicationContext; import org.junit.jupiter.api.Test; import org.springframework.context.support.AbstractXmlApplicationContext; -import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; public class QueueToQueueTransactionWithoutDefineTransactionManagerTest extends AbstractTransactionTest { @@ -52,7 +52,7 @@ public class QueueToQueueTransactionWithoutDefineTransactionManagerTest extends notify.matchesWaitTime(); - assertTrue(getConditionalExceptionProcessor().getCount() == 1, + assertEquals(1, getConditionalExceptionProcessor().getCount(), "Expected only 1 calls to process() (1 failure) but encountered " + getConditionalExceptionProcessor().getCount() + "."); } diff --git a/components/camel-jmx/src/test/java/org/apache/camel/component/jmx/JMXRobustRemoteConnectionTest.java b/components/camel-jmx/src/test/java/org/apache/camel/component/jmx/JMXRobustRemoteConnectionTest.java index 9076f73..833bf1e 100644 --- a/components/camel-jmx/src/test/java/org/apache/camel/component/jmx/JMXRobustRemoteConnectionTest.java +++ b/components/camel-jmx/src/test/java/org/apache/camel/component/jmx/JMXRobustRemoteConnectionTest.java @@ -31,6 +31,7 @@ import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertTrue; import static org.junit.jupiter.api.Assertions.fail; @@ -95,7 +96,7 @@ public class JMXRobustRemoteConnectionTest extends SimpleBeanFixture { fail("The mxbean should not be available."); } catch (Exception e) { assertTrue(e instanceof java.lang.IllegalArgumentException); - assertTrue(e.getMessage().equals("Null connection")); + assertEquals("Null connection", e.getMessage()); } // start the server; the JMX consumer should connect and start; the mock should receive a notification diff --git a/components/camel-mail/src/test/java/org/apache/camel/component/mail/MailConsumerIdleMessageTest.java b/components/camel-mail/src/test/java/org/apache/camel/component/mail/MailConsumerIdleMessageTest.java index 4350dae..e121886 100644 --- a/components/camel-mail/src/test/java/org/apache/camel/component/mail/MailConsumerIdleMessageTest.java +++ b/components/camel-mail/src/test/java/org/apache/camel/component/mail/MailConsumerIdleMessageTest.java @@ -21,7 +21,7 @@ import org.apache.camel.component.mock.MockEndpoint; import org.apache.camel.test.junit5.CamelTestSupport; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.assertNull; /** * Test to verify that the polling consumer delivers an empty Exchange when the sendEmptyMessageWhenIdle property is set @@ -35,8 +35,8 @@ public class MailConsumerIdleMessageTest extends CamelTestSupport { MockEndpoint mock = getMockEndpoint("mock:result"); mock.expectedMinimumMessageCount(2); assertMockEndpointsSatisfied(); - assertTrue(mock.getExchanges().get(0).getIn().getBody() == null); - assertTrue(mock.getExchanges().get(1).getIn().getBody() == null); + assertNull(mock.getExchanges().get(0).getIn().getBody()); + assertNull(mock.getExchanges().get(1).getIn().getBody()); } @Override diff --git a/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/MongoDbBigDecimalConverterTest.java b/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/MongoDbBigDecimalConverterTest.java index 00e4e03..ac86783 100644 --- a/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/MongoDbBigDecimalConverterTest.java +++ b/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/MongoDbBigDecimalConverterTest.java @@ -48,7 +48,7 @@ public class MongoDbBigDecimalConverterTest extends AbstractMongoDbTest { Document b = testCollection.find(new BasicDBObject("_id", testClass._id)).first(); assertNotNull(b, "No record with 'testInsertString' _id"); - assertTrue(testClass.aNumber.equals(new BigDecimal((double) b.get("aNumber")))); + assertEquals(new BigDecimal((double) b.get("aNumber")), testClass.aNumber); assertEquals(testClass.bNumber, new BigDecimal((double) b.get("bNumber"))); } diff --git a/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/MongoDbHeaderHandlingTest.java b/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/MongoDbHeaderHandlingTest.java index 75821fa..8403e99 100644 --- a/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/MongoDbHeaderHandlingTest.java +++ b/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/MongoDbHeaderHandlingTest.java @@ -91,7 +91,7 @@ public class MongoDbHeaderHandlingTest extends AbstractMongoDbTest { } }); assertTrue(resultExch.getMessage().getBody() instanceof Document); - assertTrue(resultExch.getMessage().getBody().equals(record1)); + assertEquals(record1, resultExch.getMessage().getBody()); assertTrue(resultExch.getMessage().getHeader(MongoDbConstants.WRITERESULT) instanceof UpdateResult); Document record2 = testCollection.find(eq(MONGO_ID, "testSave1")).first(); diff --git a/components/camel-mybatis/src/test/java/org/apache/camel/component/mybatis/MyBatisConsumerIdleMessageTest.java b/components/camel-mybatis/src/test/java/org/apache/camel/component/mybatis/MyBatisConsumerIdleMessageTest.java index 2f65468..609ffc4 100644 --- a/components/camel-mybatis/src/test/java/org/apache/camel/component/mybatis/MyBatisConsumerIdleMessageTest.java +++ b/components/camel-mybatis/src/test/java/org/apache/camel/component/mybatis/MyBatisConsumerIdleMessageTest.java @@ -20,7 +20,7 @@ import org.apache.camel.builder.RouteBuilder; import org.apache.camel.component.mock.MockEndpoint; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.assertNull; /** * Test to verify that the polling consumer delivers an empty Exchange when the sendEmptyMessageWhenIdle property is set @@ -39,8 +39,8 @@ public class MyBatisConsumerIdleMessageTest extends MyBatisTestSupport { MockEndpoint mock = getMockEndpoint("mock:result"); mock.expectedMinimumMessageCount(2); assertMockEndpointsSatisfied(); - assertTrue(mock.getExchanges().get(0).getIn().getBody() == null); - assertTrue(mock.getExchanges().get(1).getIn().getBody() == null); + assertNull(mock.getExchanges().get(0).getIn().getBody()); + assertNull(mock.getExchanges().get(1).getIn().getBody()); } @Override diff --git a/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyTcpWithInOutUsingPlainSocketTest.java b/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyTcpWithInOutUsingPlainSocketTest.java index c6ce46d..5b9aee7 100644 --- a/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyTcpWithInOutUsingPlainSocketTest.java +++ b/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyTcpWithInOutUsingPlainSocketTest.java @@ -28,7 +28,7 @@ import org.apache.camel.builder.RouteBuilder; import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertNull; @@ -71,7 +71,7 @@ public class NettyTcpWithInOutUsingPlainSocketTest extends BaseNettyTest { @Test public void testExchangeFailedOutShouldBeNull() throws Exception { String out = sendAndReceive("force-exception"); - assertFalse("force-exception".equals(out), "out should not be the same as in when the exchange has failed"); + assertNotEquals("force-exception", out, "out should not be the same as in when the exchange has failed"); assertEquals("java.lang.IllegalArgumentException: Forced exception", out, "should get the exception here"); } diff --git a/components/camel-openstack/src/test/java/org/apache/camel/component/openstack/keystone/DomainProducerTest.java b/components/camel-openstack/src/test/java/org/apache/camel/component/openstack/keystone/DomainProducerTest.java index 6f2bb30..6451149 100644 --- a/components/camel-openstack/src/test/java/org/apache/camel/component/openstack/keystone/DomainProducerTest.java +++ b/components/camel-openstack/src/test/java/org/apache/camel/component/openstack/keystone/DomainProducerTest.java @@ -36,7 +36,6 @@ import org.openstack4j.model.network.Network; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; -import static org.junit.jupiter.api.Assertions.assertTrue; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.Mockito.doReturn; @@ -114,7 +113,7 @@ public class DomainProducerTest extends KeystoneProducerTestSupport { producer.process(exchange); final List<Network> result = msg.getBody(List.class); - assertTrue(result.size() == 2); + assertEquals(2, result.size()); assertEquals(testOSdomain, result.get(0)); } diff --git a/components/camel-openstack/src/test/java/org/apache/camel/component/openstack/keystone/GroupProducerTest.java b/components/camel-openstack/src/test/java/org/apache/camel/component/openstack/keystone/GroupProducerTest.java index f57c1e0..b34b799 100644 --- a/components/camel-openstack/src/test/java/org/apache/camel/component/openstack/keystone/GroupProducerTest.java +++ b/components/camel-openstack/src/test/java/org/apache/camel/component/openstack/keystone/GroupProducerTest.java @@ -36,7 +36,6 @@ import org.openstack4j.model.network.Network; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; -import static org.junit.jupiter.api.Assertions.assertTrue; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.Mockito.doReturn; @@ -115,7 +114,7 @@ public class GroupProducerTest extends KeystoneProducerTestSupport { producer.process(exchange); final List<Network> result = msg.getBody(List.class); - assertTrue(result.size() == 2); + assertEquals(2, result.size()); assertEquals(testOSgroup, result.get(0)); } diff --git a/components/camel-openstack/src/test/java/org/apache/camel/component/openstack/keystone/ProjectProducerTest.java b/components/camel-openstack/src/test/java/org/apache/camel/component/openstack/keystone/ProjectProducerTest.java index f4cf432..8216633 100644 --- a/components/camel-openstack/src/test/java/org/apache/camel/component/openstack/keystone/ProjectProducerTest.java +++ b/components/camel-openstack/src/test/java/org/apache/camel/component/openstack/keystone/ProjectProducerTest.java @@ -36,7 +36,6 @@ import org.openstack4j.model.network.Network; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; -import static org.junit.jupiter.api.Assertions.assertTrue; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.Mockito.doReturn; @@ -116,7 +115,7 @@ public class ProjectProducerTest extends KeystoneProducerTestSupport { producer.process(exchange); final List<Network> result = msg.getBody(List.class); - assertTrue(result.size() == 2); + assertEquals(2, result.size()); assertEquals(testOSproject, result.get(0)); } diff --git a/components/camel-openstack/src/test/java/org/apache/camel/component/openstack/keystone/RegionProducerTest.java b/components/camel-openstack/src/test/java/org/apache/camel/component/openstack/keystone/RegionProducerTest.java index df91fcb..6284f5d 100644 --- a/components/camel-openstack/src/test/java/org/apache/camel/component/openstack/keystone/RegionProducerTest.java +++ b/components/camel-openstack/src/test/java/org/apache/camel/component/openstack/keystone/RegionProducerTest.java @@ -36,7 +36,6 @@ import org.openstack4j.model.network.Network; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; -import static org.junit.jupiter.api.Assertions.assertTrue; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.Mockito.doReturn; @@ -112,7 +111,7 @@ public class RegionProducerTest extends KeystoneProducerTestSupport { producer.process(exchange); final List<Network> result = msg.getBody(List.class); - assertTrue(result.size() == 2); + assertEquals(2, result.size()); assertEquals(testOSregion, result.get(0)); } diff --git a/components/camel-openstack/src/test/java/org/apache/camel/component/openstack/keystone/UserProducerTest.java b/components/camel-openstack/src/test/java/org/apache/camel/component/openstack/keystone/UserProducerTest.java index 5f1b22d..687b1ed 100644 --- a/components/camel-openstack/src/test/java/org/apache/camel/component/openstack/keystone/UserProducerTest.java +++ b/components/camel-openstack/src/test/java/org/apache/camel/component/openstack/keystone/UserProducerTest.java @@ -36,7 +36,6 @@ import org.openstack4j.model.network.Network; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; -import static org.junit.jupiter.api.Assertions.assertTrue; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.Mockito.doReturn; @@ -120,7 +119,7 @@ public class UserProducerTest extends KeystoneProducerTestSupport { producer.process(exchange); final List<Network> result = msg.getBody(List.class); - assertTrue(result.size() == 2); + assertEquals(2, result.size()); assertEquals(testOSuser, result.get(0)); } diff --git a/components/camel-openstack/src/test/java/org/apache/camel/component/openstack/neutron/NetworkProducerTest.java b/components/camel-openstack/src/test/java/org/apache/camel/component/openstack/neutron/NetworkProducerTest.java index d11354e..82ac88a 100644 --- a/components/camel-openstack/src/test/java/org/apache/camel/component/openstack/neutron/NetworkProducerTest.java +++ b/components/camel-openstack/src/test/java/org/apache/camel/component/openstack/neutron/NetworkProducerTest.java @@ -37,7 +37,6 @@ import org.openstack4j.model.network.NetworkType; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; -import static org.junit.jupiter.api.Assertions.assertTrue; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.Mockito.doReturn; @@ -117,7 +116,7 @@ public class NetworkProducerTest extends NeutronProducerTestSupport { producer.process(exchange); final List<Network> result = msg.getBody(List.class); - assertTrue(result.size() == 2); + assertEquals(2, result.size()); assertEquals(testOSnetwork, result.get(0)); } diff --git a/components/camel-openstack/src/test/java/org/apache/camel/component/openstack/neutron/PortProducerTest.java b/components/camel-openstack/src/test/java/org/apache/camel/component/openstack/neutron/PortProducerTest.java index d6255a8..b5ad980 100644 --- a/components/camel-openstack/src/test/java/org/apache/camel/component/openstack/neutron/PortProducerTest.java +++ b/components/camel-openstack/src/test/java/org/apache/camel/component/openstack/neutron/PortProducerTest.java @@ -36,7 +36,6 @@ import org.openstack4j.model.network.Port; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; -import static org.junit.jupiter.api.Assertions.assertTrue; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.Mockito.doReturn; @@ -119,7 +118,7 @@ public class PortProducerTest extends NeutronProducerTestSupport { producer.process(exchange); final List<Port> result = msg.getBody(List.class); - assertTrue(result.size() == 2); + assertEquals(2, result.size()); assertEquals(testOSport, result.get(0)); } diff --git a/components/camel-openstack/src/test/java/org/apache/camel/component/openstack/neutron/RouterProducerTest.java b/components/camel-openstack/src/test/java/org/apache/camel/component/openstack/neutron/RouterProducerTest.java index 3c19720..4f4940f 100644 --- a/components/camel-openstack/src/test/java/org/apache/camel/component/openstack/neutron/RouterProducerTest.java +++ b/components/camel-openstack/src/test/java/org/apache/camel/component/openstack/neutron/RouterProducerTest.java @@ -39,7 +39,6 @@ import org.openstack4j.openstack.networking.domain.NeutronRouterInterface; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; -import static org.junit.jupiter.api.Assertions.assertTrue; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.Mockito.doReturn; @@ -126,7 +125,7 @@ public class RouterProducerTest extends NeutronProducerTestSupport { producer.process(exchange); final List<Router> result = msg.getBody(List.class); - assertTrue(result.size() == 2); + assertEquals(2, result.size()); assertEquals(testOSrouter, result.get(0)); } diff --git a/components/camel-openstack/src/test/java/org/apache/camel/component/openstack/neutron/SubnetProducerTest.java b/components/camel-openstack/src/test/java/org/apache/camel/component/openstack/neutron/SubnetProducerTest.java index bf136ee..f942adf 100644 --- a/components/camel-openstack/src/test/java/org/apache/camel/component/openstack/neutron/SubnetProducerTest.java +++ b/components/camel-openstack/src/test/java/org/apache/camel/component/openstack/neutron/SubnetProducerTest.java @@ -37,7 +37,6 @@ import org.openstack4j.model.network.Subnet; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; -import static org.junit.jupiter.api.Assertions.assertTrue; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.Mockito.doReturn; @@ -116,7 +115,7 @@ public class SubnetProducerTest extends NeutronProducerTestSupport { producer.process(exchange); final List<Subnet> result = msg.getBody(List.class); - assertTrue(result.size() == 2); + assertEquals(2, result.size()); assertEquals(testOSsubnet, result.get(0)); } diff --git a/components/camel-openstack/src/test/java/org/apache/camel/component/openstack/nova/FlavorProducerTest.java b/components/camel-openstack/src/test/java/org/apache/camel/component/openstack/nova/FlavorProducerTest.java index 09f7ca6..e19903a 100644 --- a/components/camel-openstack/src/test/java/org/apache/camel/component/openstack/nova/FlavorProducerTest.java +++ b/components/camel-openstack/src/test/java/org/apache/camel/component/openstack/nova/FlavorProducerTest.java @@ -40,7 +40,6 @@ import org.openstack4j.model.compute.builder.FlavorBuilder; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertNull; -import static org.junit.jupiter.api.Assertions.assertTrue; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.Mockito.doReturn; @@ -145,7 +144,7 @@ public class FlavorProducerTest extends NovaProducerTestSupport { producer.process(exchange); List<Flavor> result = msg.getBody(List.class); - assertTrue(result.size() == 2); + assertEquals(2, result.size()); for (Flavor f : result) { assertEqualsFlavors(dummyFlavor, f); assertNotNull(f.getId()); diff --git a/components/camel-openstack/src/test/java/org/apache/camel/component/openstack/nova/ServerProducerTest.java b/components/camel-openstack/src/test/java/org/apache/camel/component/openstack/nova/ServerProducerTest.java index 43e8c8c..3ae897a 100644 --- a/components/camel-openstack/src/test/java/org/apache/camel/component/openstack/nova/ServerProducerTest.java +++ b/components/camel-openstack/src/test/java/org/apache/camel/component/openstack/nova/ServerProducerTest.java @@ -37,7 +37,7 @@ import org.openstack4j.model.compute.ServerCreate; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertNull; -import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.assertSame; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.Mockito.verify; @@ -118,7 +118,7 @@ public class ServerProducerTest extends NovaProducerTestSupport { verify(serverService).action(idArgumentCaptor.capture(), actionArgumentCaptor.capture()); assertEquals(id, idArgumentCaptor.getValue()); - assertTrue(actionArgumentCaptor.getValue() == Action.PAUSE); + assertSame(Action.PAUSE, actionArgumentCaptor.getValue()); assertNull(msg.getBody()); }