This is an automated email from the ASF dual-hosted git repository. davsclaus pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/main by this push: new 7f803e4b3e5 chore: Cleanup assertions (#11824) 7f803e4b3e5 is described below commit 7f803e4b3e55f52c00bd803c67ea5c6f80bfd581 Author: Adriano Machado <60320+ammach...@users.noreply.github.com> AuthorDate: Wed Oct 25 04:18:43 2023 -0300 chore: Cleanup assertions (#11824) Co-authored-by: Adriano Machado <admac...@redhat.com> --- .../aws2/ddb/localstack/AWS2DeleteTableRuleIT.java | 3 ++- .../bean/validator/BeanValidatorRouteTest.java | 7 ++++--- .../BindySimpleIgnoreTrailingCharsTest.java | 3 ++- .../fixed/skipfields/BindySimpleSkipFieldsTest.java | 3 ++- .../camel/component/cometd/CometBindingTest.java | 15 ++++++++------- .../language/csimple/joor/OriginalSimpleTest.java | 5 ++--- .../camel/dataformat/csv/CsvDataFormatTest.java | 6 +++--- .../camel/component/cxf/converter/ConverterTest.java | 2 +- .../component/cxf/jaxrs/CxfRsSpringEndpointTest.java | 2 +- .../DisruptorShouldNotUseSameThreadTest.java | 4 ++-- .../component/disruptor/DisruptorUnitOfWorkTest.java | 3 ++- .../FhirJsonDataformatErrorHandlerTest.java | 3 ++- .../component/google/mail/GmailUsersMessagesIT.java | 4 ++-- .../hazelcast/HazelcastListConsumerTest.java | 3 ++- .../HazelcastReliableTopicConsumerTest.java | 3 ++- .../hazelcast/HazelcastSetConsumerTest.java | 3 ++- .../hazelcast/HazelcastTopicConsumerTest.java | 3 ++- .../converters/CamelInfluxDbConverterTest.java | 3 ++- .../converters/CamelInfluxDbConverterTest.java | 3 ++- .../component/jetty/HttpFilterCamelHeadersTest.java | 4 ++-- .../camel/component/jetty/HttpHeaderCaseTest.java | 5 +++-- .../component/jetty/HttpRedirectNoLocationTest.java | 17 ++++++++--------- .../jetty/rest/RestJettyNoContentRestConfigTest.java | 10 +++++----- .../jira/JiraComponentConfigurationTest.java | 7 ++++--- .../apache/camel/component/jolt/JoltRemovrTest.java | 3 ++- ...LevelDBAggregationRepositoryLoadExistingTest.java | 3 ++- ...LevelDBAggregationRepositoryMultipleRepoTest.java | 17 +++++++++-------- ...elDBAggregationRepositoryRecoverExistingTest.java | 2 +- .../leveldb/LevelDBAggregationRepositoryTest.java | 9 +++++---- .../camel/component/mail/MailComponentTest.java | 4 ++-- .../integration/MongoDbIdempotentRepositoryIT.java | 7 ++++--- .../netty/http/NettyHttpHeaderCaseTest.java | 5 +++-- .../camel/component/smpp/SmppComponentTest.java | 20 ++++++++++---------- .../camel/component/smpp/SmppConfigurationTest.java | 10 +++++----- .../splunkhec/SplunkHECConfigurationTest.java | 13 ++++++++----- .../apache/camel/component/redis/RedisSetTest.java | 3 ++- .../camel/component/redis/RedisSortedSetTest.java | 5 +++-- .../SpringCamelContextThreadPoolProfilesTest.java | 11 ++++++----- .../DualSpringManagedThreadsThreadPoolTest.java | 9 +++++---- .../SpringManagedThreadsThreadPoolTest.java | 5 +++-- .../apache/camel/spring/util/EndpointHelperTest.java | 3 ++- .../component/sql/SqlProducerInsertNullTest.java | 3 ++- .../sql/SqlProducerUseMessageBodyForSqlTest.java | 3 ++- .../jdbc/JdbcAggregateStoreAsText2Test.java | 17 +++++++++-------- .../aggregate/jdbc/JdbcAggregateStoreAsTextTest.java | 17 +++++++++-------- .../JdbcAggregationRepositoryMultipleRepoTest.java | 17 +++++++++-------- ...JdbcAggregationRepositoryRecoverExistingTest.java | 2 +- .../jdbc/JdbcAggregationRepositoryTest.java | 9 +++++---- .../ssh/SshShellOutputStringHelperTest.java | 5 +++-- .../CamelMessagingHeadersInjectAdapterTest.java | 3 ++- .../xmlsecurity/XAdESSignaturePropertiesTest.java | 6 +++--- .../dataformat/zipfile/ZipFileDataFormatTest.java | 2 +- .../integration/ChildrenChangedOperationIT.java | 3 ++- .../operations/integration/SetDataOperationIT.java | 3 ++- .../camel/management/BacklogTracerFilterTest.java | 3 ++- .../apache/camel/management/BacklogTracerTest.java | 5 +++-- .../management/ManagedTransformerRegistryTest.java | 5 +++-- .../org/apache/camel/util/CamelURIParserTest.java | 20 ++++++++++---------- .../java/org/apache/camel/util/StringHelperTest.java | 2 +- .../java/org/apache/camel/util/URISupportTest.java | 7 ++++--- 60 files changed, 212 insertions(+), 170 deletions(-) diff --git a/components/camel-aws/camel-aws2-ddb/src/test/java/org/apache/camel/component/aws2/ddb/localstack/AWS2DeleteTableRuleIT.java b/components/camel-aws/camel-aws2-ddb/src/test/java/org/apache/camel/component/aws2/ddb/localstack/AWS2DeleteTableRuleIT.java index 25587d9d1eb..81e4749aed4 100644 --- a/components/camel-aws/camel-aws2-ddb/src/test/java/org/apache/camel/component/aws2/ddb/localstack/AWS2DeleteTableRuleIT.java +++ b/components/camel-aws/camel-aws2-ddb/src/test/java/org/apache/camel/component/aws2/ddb/localstack/AWS2DeleteTableRuleIT.java @@ -29,6 +29,7 @@ import software.amazon.awssdk.services.dynamodb.model.ScalarAttributeType; import software.amazon.awssdk.services.dynamodb.model.TableStatus; import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNull; public class AWS2DeleteTableRuleIT extends Aws2DDBBase { @@ -59,7 +60,7 @@ public class AWS2DeleteTableRuleIT extends Aws2DDBBase { exchange.getIn().setHeader(Ddb2Constants.CONSISTENT_READ, true); } }); - assertEquals(null, exchange.getIn().getHeader(Ddb2Constants.TABLE_STATUS)); + assertNull(exchange.getIn().getHeader(Ddb2Constants.TABLE_STATUS)); } @Override diff --git a/components/camel-bean-validator/src/test/java/org/apache/camel/component/bean/validator/BeanValidatorRouteTest.java b/components/camel-bean-validator/src/test/java/org/apache/camel/component/bean/validator/BeanValidatorRouteTest.java index 4838228f5e3..aacc4b9ef79 100644 --- a/components/camel-bean-validator/src/test/java/org/apache/camel/component/bean/validator/BeanValidatorRouteTest.java +++ b/components/camel-bean-validator/src/test/java/org/apache/camel/component/bean/validator/BeanValidatorRouteTest.java @@ -38,6 +38,7 @@ import org.junit.jupiter.params.provider.MethodSource; 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.assertNull; import static org.junit.jupiter.api.Assertions.fail; import static org.junit.jupiter.api.condition.OS.AIX; @@ -101,7 +102,7 @@ class BeanValidatorRouteTest extends CamelTestSupport { assertEquals(numberOfViolations, constraintViolations.size()); constraintViolations.forEach(cv -> { assertEquals("licensePlate", cv.getPropertyPath().toString()); - assertEquals(null, cv.getInvalidValue()); + assertNull(cv.getInvalidValue()); assertEquals("must not be null", cv.getMessage()); }); } @@ -135,7 +136,7 @@ class BeanValidatorRouteTest extends CamelTestSupport { assertEquals(numberOfViolations, constraintViolations.size()); constraintViolations.forEach(cv -> { assertEquals("licensePlate", cv.getPropertyPath().toString()); - assertEquals(null, cv.getInvalidValue()); + assertNull(cv.getInvalidValue()); assertEquals("must not be null", cv.getMessage()); }); } @@ -203,7 +204,7 @@ class BeanValidatorRouteTest extends CamelTestSupport { assertEquals(numberOfViolations, constraintViolations.size()); constraintViolations.forEach(cv -> { assertEquals("manufacturer", cv.getPropertyPath().toString()); - assertEquals(null, cv.getInvalidValue()); + assertNull(cv.getInvalidValue()); assertEquals("must not be null", cv.getMessage()); }); } diff --git a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fixed/ignoretrailing/BindySimpleIgnoreTrailingCharsTest.java b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fixed/ignoretrailing/BindySimpleIgnoreTrailingCharsTest.java index e1891672630..277fabddeed 100644 --- a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fixed/ignoretrailing/BindySimpleIgnoreTrailingCharsTest.java +++ b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fixed/ignoretrailing/BindySimpleIgnoreTrailingCharsTest.java @@ -30,6 +30,7 @@ import org.apache.camel.test.junit5.CamelTestSupport; import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNull; /** * This test validates that bindy will ignore trailing characters in a record when the ignoreTrailingCharacters property @@ -68,7 +69,7 @@ public class BindySimpleIgnoreTrailingCharsTest extends CamelTestSupport { = (BindySimpleIgnoreTrailingCharsTest.Order) unmarshallResult.getReceivedExchanges().get(0).getIn().getBody(); assertEquals(10, order.getOrderNr()); // the field is not trimmed - assertEquals(null, order.getFirstName()); + assertNull(order.getFirstName()); assertEquals("M ", order.getLastName()); assertEquals("Hello ", order.getComment()); } diff --git a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fixed/skipfields/BindySimpleSkipFieldsTest.java b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fixed/skipfields/BindySimpleSkipFieldsTest.java index 4b9fc1ef4de..b37633dff73 100644 --- a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fixed/skipfields/BindySimpleSkipFieldsTest.java +++ b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fixed/skipfields/BindySimpleSkipFieldsTest.java @@ -30,6 +30,7 @@ import org.apache.camel.test.junit5.CamelTestSupport; import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNull; /** * This test validates that bindy can skip values in the fixed-length record when absolute pos values are provided @@ -66,7 +67,7 @@ public class BindySimpleSkipFieldsTest extends CamelTestSupport { = (BindySimpleSkipFieldsTest.Order) unmarshallResult.getReceivedExchanges().get(0).getIn().getBody(); assertEquals(10, order.getOrderNr()); // the field is not trimmed - assertEquals(null, order.getFirstName()); + assertNull(order.getFirstName()); assertEquals("M ", order.getLastName()); assertEquals("Hello ", order.getComment()); } diff --git a/components/camel-cometd/src/test/java/org/apache/camel/component/cometd/CometBindingTest.java b/components/camel-cometd/src/test/java/org/apache/camel/component/cometd/CometBindingTest.java index abfb8ade8d9..705260fd1b1 100644 --- a/components/camel-cometd/src/test/java/org/apache/camel/component/cometd/CometBindingTest.java +++ b/components/camel-cometd/src/test/java/org/apache/camel/component/cometd/CometBindingTest.java @@ -33,6 +33,7 @@ import org.mockito.Mock; import org.mockito.junit.jupiter.MockitoExtension; import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNull; import static org.junit.jupiter.api.Assertions.assertTrue; import static org.mockito.Mockito.when; @@ -90,7 +91,7 @@ public class CometBindingTest { assertEquals(EIGHT, result.getHeader(INTEGER_ATTR_NAME)); assertEquals(THIRTY_FOUR, result.getHeader(LONG_ATTR_NAME)); assertEquals(TWO_POINT_ONE, result.getHeader(DOUBLE_ATTR_NAME)); - assertEquals(null, result.getHeader(FOO_ATTR_NAME)); + assertNull(result.getHeader(FOO_ATTR_NAME)); assertTrue((Boolean) result.getHeader(BOOLEAN_ATT_NAME)); } @@ -101,12 +102,12 @@ public class CometBindingTest { // assert assertEquals(1, result.getHeaders().size()); - assertEquals(null, result.getHeader(STRING_ATTR_NAME)); - assertEquals(null, result.getHeader(INTEGER_ATTR_NAME)); - assertEquals(null, result.getHeader(LONG_ATTR_NAME)); - assertEquals(null, result.getHeader(FOO_ATTR_NAME)); - assertEquals(null, result.getHeader(DOUBLE_ATTR_NAME)); - assertEquals(null, result.getHeader(BOOLEAN_ATT_NAME)); + assertNull(result.getHeader(STRING_ATTR_NAME)); + assertNull(result.getHeader(INTEGER_ATTR_NAME)); + assertNull(result.getHeader(LONG_ATTR_NAME)); + assertNull(result.getHeader(FOO_ATTR_NAME)); + assertNull(result.getHeader(DOUBLE_ATTR_NAME)); + assertNull(result.getHeader(BOOLEAN_ATT_NAME)); } @Test diff --git a/components/camel-csimple-joor/src/test/java/org/apache/camel/language/csimple/joor/OriginalSimpleTest.java b/components/camel-csimple-joor/src/test/java/org/apache/camel/language/csimple/joor/OriginalSimpleTest.java index 19dd1cd1ac8..5abd0240c51 100644 --- a/components/camel-csimple-joor/src/test/java/org/apache/camel/language/csimple/joor/OriginalSimpleTest.java +++ b/components/camel-csimple-joor/src/test/java/org/apache/camel/language/csimple/joor/OriginalSimpleTest.java @@ -107,9 +107,8 @@ public class OriginalSimpleTest extends LanguageTestSupport { assertEquals("123", context.resolveLanguage("csimple").createExpression("${header.bar}").evaluate(exchange, String.class)); // should not be possible - assertEquals(null, context.resolveLanguage("csimple").createExpression("${header.bar}").evaluate(exchange, Date.class)); - assertEquals(null, - context.resolveLanguage("csimple").createExpression("${header.unknown}").evaluate(exchange, String.class)); + assertNull(context.resolveLanguage("csimple").createExpression("${header.bar}").evaluate(exchange, Date.class)); + assertNull(context.resolveLanguage("csimple").createExpression("${header.unknown}").evaluate(exchange, String.class)); } @Test diff --git a/components/camel-csv/src/test/java/org/apache/camel/dataformat/csv/CsvDataFormatTest.java b/components/camel-csv/src/test/java/org/apache/camel/dataformat/csv/CsvDataFormatTest.java index eadf60f2b0a..41a9e2eb34c 100644 --- a/components/camel-csv/src/test/java/org/apache/camel/dataformat/csv/CsvDataFormatTest.java +++ b/components/camel-csv/src/test/java/org/apache/camel/dataformat/csv/CsvDataFormatTest.java @@ -450,7 +450,7 @@ public class CsvDataFormatTest { dataFormat = new CsvDataFormat(); // Properly saved assertSame(CSVFormat.DEFAULT, dataFormat.getFormat()); - assertEquals(null, dataFormat.getTrim()); + assertNull(dataFormat.getTrim()); // Properly used assertFalse(dataFormat.getActiveFormat().getTrim()); @@ -478,7 +478,7 @@ public class CsvDataFormatTest { dataFormat = new CsvDataFormat(); // Properly saved assertSame(CSVFormat.DEFAULT, dataFormat.getFormat()); - assertEquals(null, dataFormat.getIgnoreHeaderCase()); + assertNull(dataFormat.getIgnoreHeaderCase()); // Properly used assertFalse(dataFormat.getActiveFormat().getIgnoreHeaderCase()); @@ -505,7 +505,7 @@ public class CsvDataFormatTest { dataFormat = new CsvDataFormat(); // Properly saved assertSame(CSVFormat.DEFAULT, dataFormat.getFormat()); - assertEquals(null, dataFormat.getTrailingDelimiter()); + assertNull(dataFormat.getTrailingDelimiter()); // Properly used assertFalse(dataFormat.getActiveFormat().getTrailingDelimiter()); diff --git a/components/camel-cxf/camel-cxf-soap/src/test/java/org/apache/camel/component/cxf/converter/ConverterTest.java b/components/camel-cxf/camel-cxf-soap/src/test/java/org/apache/camel/component/cxf/converter/ConverterTest.java index 7cf81bab063..692a054a3b7 100644 --- a/components/camel-cxf/camel-cxf-soap/src/test/java/org/apache/camel/component/cxf/converter/ConverterTest.java +++ b/components/camel-cxf/camel-cxf-soap/src/test/java/org/apache/camel/component/cxf/converter/ConverterTest.java @@ -88,6 +88,6 @@ public class ConverterTest { list.add("haha"); exchange.getIn().setBody(list); String ret = exchange.getIn().getBody(String.class); - assertEquals(ret, "[hehe, haha]", "shouldn't miss list content"); + assertEquals("[hehe, haha]", ret, "shouldn't miss list content"); } } diff --git a/components/camel-cxf/camel-cxf-spring-rest/src/test/java/org/apache/camel/component/cxf/jaxrs/CxfRsSpringEndpointTest.java b/components/camel-cxf/camel-cxf-spring-rest/src/test/java/org/apache/camel/component/cxf/jaxrs/CxfRsSpringEndpointTest.java index 71f7184b5e4..077ed721036 100644 --- a/components/camel-cxf/camel-cxf-spring-rest/src/test/java/org/apache/camel/component/cxf/jaxrs/CxfRsSpringEndpointTest.java +++ b/components/camel-cxf/camel-cxf-spring-rest/src/test/java/org/apache/camel/component/cxf/jaxrs/CxfRsSpringEndpointTest.java @@ -49,7 +49,7 @@ public class CxfRsSpringEndpointTest extends CamelSpringTestSupport { assertEquals("rsServer", sfb.getBeanId(), "Get a wrong beanId"); assertEquals("http://localhost:9000/router", sfb.getAddress(), "Get a wrong address"); assertEquals(1, sfb.getResourceClasses().size(), "Get a wrong size of resource classes"); - assertEquals(sfb.getResourceClasses().get(0), CustomerService.class, "Get a wrong resource class"); + assertEquals(CustomerService.class, sfb.getResourceClasses().get(0), "Get a wrong resource class"); assertEquals(true, sfb.isLoggingFeatureEnabled(), "Got the wrong loggingFeatureEnabled"); assertEquals(200, sfb.getLoggingSizeLimit(), "Got the wrong loggingSizeLimit"); assertEquals(1, sfb.getInInterceptors().size(), "Got a wrong size of interceptors"); diff --git a/components/camel-disruptor/src/test/java/org/apache/camel/component/disruptor/DisruptorShouldNotUseSameThreadTest.java b/components/camel-disruptor/src/test/java/org/apache/camel/component/disruptor/DisruptorShouldNotUseSameThreadTest.java index 0a8217fe7c7..dbd7e3494ff 100644 --- a/components/camel-disruptor/src/test/java/org/apache/camel/component/disruptor/DisruptorShouldNotUseSameThreadTest.java +++ b/components/camel-disruptor/src/test/java/org/apache/camel/component/disruptor/DisruptorShouldNotUseSameThreadTest.java @@ -23,8 +23,8 @@ 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.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotSame; +import static org.junit.jupiter.api.Assertions.assertNull; /** * Unit test to verify continuing using NOT same thread on the consumer side. @@ -61,7 +61,7 @@ public class DisruptorShouldNotUseSameThreadTest extends CamelTestSupport { from("disruptor:foo").process(new Processor() { @Override public void process(final Exchange exchange) { - assertEquals(null, local.get()); + assertNull(local.get()); assertNotSame(id, Thread.currentThread().getId(), "Thread ids should not be same"); } }).to("mock:result"); diff --git a/components/camel-disruptor/src/test/java/org/apache/camel/component/disruptor/DisruptorUnitOfWorkTest.java b/components/camel-disruptor/src/test/java/org/apache/camel/component/disruptor/DisruptorUnitOfWorkTest.java index a48dff94fd6..dce3a8c14f7 100644 --- a/components/camel-disruptor/src/test/java/org/apache/camel/component/disruptor/DisruptorUnitOfWorkTest.java +++ b/components/camel-disruptor/src/test/java/org/apache/camel/component/disruptor/DisruptorUnitOfWorkTest.java @@ -26,6 +26,7 @@ import org.apache.camel.test.junit5.CamelTestSupport; import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNull; /** * Unit test to verify unit of work with disruptor. That the UnitOfWork is able to route using disruptor but keeping the @@ -65,7 +66,7 @@ public class DisruptorUnitOfWorkTest extends CamelTestSupport { from("disruptor:foo").process(new Processor() { @Override public void process(final Exchange exchange) { - assertEquals(null, sync); + assertNull(sync); } }).process(new Processor() { @Override diff --git a/components/camel-fhir/camel-fhir-component/src/test/java/org/apache/camel/component/fhir/dataformat/FhirJsonDataformatErrorHandlerTest.java b/components/camel-fhir/camel-fhir-component/src/test/java/org/apache/camel/component/fhir/dataformat/FhirJsonDataformatErrorHandlerTest.java index c7d74f26872..971a7374934 100644 --- a/components/camel-fhir/camel-fhir-component/src/test/java/org/apache/camel/component/fhir/dataformat/FhirJsonDataformatErrorHandlerTest.java +++ b/components/camel-fhir/camel-fhir-component/src/test/java/org/apache/camel/component/fhir/dataformat/FhirJsonDataformatErrorHandlerTest.java @@ -32,6 +32,7 @@ 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.assertNull; import static org.junit.jupiter.api.Assertions.assertTrue; import static org.junit.jupiter.api.Assertions.fail; @@ -71,7 +72,7 @@ public class FhirJsonDataformatErrorHandlerTest extends CamelTestSupport { Exchange exchange = mockEndpoint.getExchanges().get(0); Patient patient = (Patient) exchange.getIn().getBody(); assertEquals(1, patient.getExtension().size()); - assertEquals(null, patient.getExtension().get(0).getUrl()); + assertNull(patient.getExtension().get(0).getUrl()); assertEquals("2011-01-02T11:13:15", patient.getExtension().get(0).getValueAsPrimitive().getValueAsString()); } diff --git a/components/camel-google/camel-google-mail/src/test/java/org/apache/camel/component/google/mail/GmailUsersMessagesIT.java b/components/camel-google/camel-google-mail/src/test/java/org/apache/camel/component/google/mail/GmailUsersMessagesIT.java index 54d6f497ae5..1a4634d01df 100644 --- a/components/camel-google/camel-google-mail/src/test/java/org/apache/camel/component/google/mail/GmailUsersMessagesIT.java +++ b/components/camel-google/camel-google-mail/src/test/java/org/apache/camel/component/google/mail/GmailUsersMessagesIT.java @@ -124,8 +124,8 @@ public class GmailUsersMessagesIT extends AbstractGoogleMailTestSupport { } private boolean idInList(String testEmailId, ListMessagesResponse listOfMessages) { - assertNotNull(listOfMessages, "list result"); - assertTrue(!listOfMessages.getMessages().isEmpty()); + assertNotNull(listOfMessages, "list result"); + assertFalse(listOfMessages.getMessages().isEmpty()); boolean foundMessage = false; for (Message m : listOfMessages.getMessages()) { if (testEmailId.equals(m.getId())) { diff --git a/components/camel-hazelcast/src/test/java/org/apache/camel/component/hazelcast/HazelcastListConsumerTest.java b/components/camel-hazelcast/src/test/java/org/apache/camel/component/hazelcast/HazelcastListConsumerTest.java index 8e74214bb64..cfb2683c93b 100644 --- a/components/camel-hazelcast/src/test/java/org/apache/camel/component/hazelcast/HazelcastListConsumerTest.java +++ b/components/camel-hazelcast/src/test/java/org/apache/camel/component/hazelcast/HazelcastListConsumerTest.java @@ -34,6 +34,7 @@ import org.mockito.Mock; 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.mockito.Mockito.any; import static org.mockito.Mockito.eq; import static org.mockito.Mockito.verify; @@ -105,7 +106,7 @@ public class HazelcastListConsumerTest extends HazelcastCamelTestSupport { private void checkHeaders(Map<String, Object> headers, String action) { assertEquals(action, headers.get(HazelcastConstants.LISTENER_ACTION)); assertEquals(HazelcastConstants.CACHE_LISTENER, headers.get(HazelcastConstants.LISTENER_TYPE)); - assertEquals(null, headers.get(HazelcastConstants.OBJECT_ID)); + assertNull(headers.get(HazelcastConstants.OBJECT_ID)); assertNotNull(headers.get(HazelcastConstants.LISTENER_TIME)); } } diff --git a/components/camel-hazelcast/src/test/java/org/apache/camel/component/hazelcast/HazelcastReliableTopicConsumerTest.java b/components/camel-hazelcast/src/test/java/org/apache/camel/component/hazelcast/HazelcastReliableTopicConsumerTest.java index 46b5f0cd358..6bf4fe9ddf3 100644 --- a/components/camel-hazelcast/src/test/java/org/apache/camel/component/hazelcast/HazelcastReliableTopicConsumerTest.java +++ b/components/camel-hazelcast/src/test/java/org/apache/camel/component/hazelcast/HazelcastReliableTopicConsumerTest.java @@ -33,6 +33,7 @@ import org.mockito.Mock; 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.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; @@ -90,7 +91,7 @@ public class HazelcastReliableTopicConsumerTest extends HazelcastCamelTestSuppor private void checkHeaders(Map<String, Object> headers, String action) { assertEquals(action, headers.get(HazelcastConstants.LISTENER_ACTION)); assertEquals(HazelcastConstants.CACHE_LISTENER, headers.get(HazelcastConstants.LISTENER_TYPE)); - assertEquals(null, headers.get(HazelcastConstants.OBJECT_ID)); + assertNull(headers.get(HazelcastConstants.OBJECT_ID)); assertNotNull(headers.get(HazelcastConstants.LISTENER_TIME)); } diff --git a/components/camel-hazelcast/src/test/java/org/apache/camel/component/hazelcast/HazelcastSetConsumerTest.java b/components/camel-hazelcast/src/test/java/org/apache/camel/component/hazelcast/HazelcastSetConsumerTest.java index 86df349a9ed..8125836f321 100644 --- a/components/camel-hazelcast/src/test/java/org/apache/camel/component/hazelcast/HazelcastSetConsumerTest.java +++ b/components/camel-hazelcast/src/test/java/org/apache/camel/component/hazelcast/HazelcastSetConsumerTest.java @@ -34,6 +34,7 @@ import org.mockito.Mock; 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.mockito.Mockito.any; import static org.mockito.Mockito.eq; import static org.mockito.Mockito.verify; @@ -105,7 +106,7 @@ public class HazelcastSetConsumerTest extends HazelcastCamelTestSupport { private void checkHeaders(Map<String, Object> headers, String action) { assertEquals(action, headers.get(HazelcastConstants.LISTENER_ACTION)); assertEquals(HazelcastConstants.CACHE_LISTENER, headers.get(HazelcastConstants.LISTENER_TYPE)); - assertEquals(null, headers.get(HazelcastConstants.OBJECT_ID)); + assertNull(headers.get(HazelcastConstants.OBJECT_ID)); assertNotNull(headers.get(HazelcastConstants.LISTENER_TIME)); } } diff --git a/components/camel-hazelcast/src/test/java/org/apache/camel/component/hazelcast/HazelcastTopicConsumerTest.java b/components/camel-hazelcast/src/test/java/org/apache/camel/component/hazelcast/HazelcastTopicConsumerTest.java index 1bfd04daa4f..00ca0b8ebc2 100644 --- a/components/camel-hazelcast/src/test/java/org/apache/camel/component/hazelcast/HazelcastTopicConsumerTest.java +++ b/components/camel-hazelcast/src/test/java/org/apache/camel/component/hazelcast/HazelcastTopicConsumerTest.java @@ -33,6 +33,7 @@ import org.mockito.Mock; 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.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; @@ -90,7 +91,7 @@ public class HazelcastTopicConsumerTest extends HazelcastCamelTestSupport { private void checkHeaders(Map<String, Object> headers, String action) { assertEquals(action, headers.get(HazelcastConstants.LISTENER_ACTION)); assertEquals(HazelcastConstants.CACHE_LISTENER, headers.get(HazelcastConstants.LISTENER_TYPE)); - assertEquals(null, headers.get(HazelcastConstants.OBJECT_ID)); + assertNull(headers.get(HazelcastConstants.OBJECT_ID)); assertNotNull(headers.get(HazelcastConstants.LISTENER_TIME)); } diff --git a/components/camel-influxdb/src/test/java/org/apache/camel/component/influxdb/converters/CamelInfluxDbConverterTest.java b/components/camel-influxdb/src/test/java/org/apache/camel/component/influxdb/converters/CamelInfluxDbConverterTest.java index 7af4caac74a..ac405932bff 100644 --- a/components/camel-influxdb/src/test/java/org/apache/camel/component/influxdb/converters/CamelInfluxDbConverterTest.java +++ b/components/camel-influxdb/src/test/java/org/apache/camel/component/influxdb/converters/CamelInfluxDbConverterTest.java @@ -25,6 +25,7 @@ import org.junit.jupiter.api.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertTrue; @@ -46,7 +47,7 @@ public class CamelInfluxDbConverterTest { assertNotNull(line); LOG.debug("doesNotAddCamelHeaders generated: \"{}\"", line); - assertTrue(!line.contains(InfluxDbConstants.MEASUREMENT_NAME)); + assertFalse(line.contains(InfluxDbConstants.MEASUREMENT_NAME)); } diff --git a/components/camel-influxdb2/src/test/java/org/apache/camel/component/influxdb2/converters/CamelInfluxDbConverterTest.java b/components/camel-influxdb2/src/test/java/org/apache/camel/component/influxdb2/converters/CamelInfluxDbConverterTest.java index 379e8276d8f..9eb33d60aa0 100644 --- a/components/camel-influxdb2/src/test/java/org/apache/camel/component/influxdb2/converters/CamelInfluxDbConverterTest.java +++ b/components/camel-influxdb2/src/test/java/org/apache/camel/component/influxdb2/converters/CamelInfluxDbConverterTest.java @@ -25,6 +25,7 @@ import org.junit.jupiter.api.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertTrue; @@ -46,7 +47,7 @@ public class CamelInfluxDbConverterTest { assertNotNull(line); LOG.debug("doesNotAddCamelHeaders generated: \"{}\"", line); - assertTrue(!line.contains(InfluxDb2Constants.MEASUREMENT)); + assertFalse(line.contains(InfluxDb2Constants.MEASUREMENT)); } diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpFilterCamelHeadersTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpFilterCamelHeadersTest.java index 5ad9f7321d1..3b0be81adce 100644 --- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpFilterCamelHeadersTest.java +++ b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpFilterCamelHeadersTest.java @@ -25,8 +25,8 @@ 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.assertNotNull; -import static org.junit.jupiter.api.Assertions.assertTrue; public class HttpFilterCamelHeadersTest extends BaseJettyTest { @@ -52,7 +52,7 @@ public class HttpFilterCamelHeadersTest extends BaseJettyTest { boolean valid = key.equalsIgnoreCase(Exchange.HTTP_RESPONSE_CODE) || key.equalsIgnoreCase(Exchange.HTTP_RESPONSE_TEXT); if (!valid) { - assertTrue(!key.toLowerCase().startsWith("camel"), "Should not contain any Camel internal headers"); + assertFalse(key.toLowerCase().startsWith("camel"), "Should not contain any Camel internal headers"); } else { assertEquals(200, headers.get(Exchange.HTTP_RESPONSE_CODE)); } diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpHeaderCaseTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpHeaderCaseTest.java index 44d8bda2be7..b84c74c22a8 100644 --- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpHeaderCaseTest.java +++ b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpHeaderCaseTest.java @@ -31,6 +31,7 @@ import org.apache.hc.core5.http.io.entity.EntityUtils; import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNull; public class HttpHeaderCaseTest extends BaseJettyTest { @@ -63,9 +64,9 @@ public class HttpHeaderCaseTest extends BaseJettyTest { Map<String, Object> map = new LinkedHashMap<>(exchange.getIn().getHeaders()); assertEquals("123", map.get("OTHER")); - assertEquals(null, map.get("other")); + assertNull(map.get("other")); assertEquals("Carlsberg", map.get("beer")); - assertEquals(null, map.get("Beer")); + assertNull(map.get("Beer")); exchange.getMessage().setBody("Bye World"); exchange.getMessage().setHeader("MyCaseHeader", "aBc123"); diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpRedirectNoLocationTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpRedirectNoLocationTest.java index f85e3748346..d68e05ea017 100644 --- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpRedirectNoLocationTest.java +++ b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpRedirectNoLocationTest.java @@ -17,7 +17,6 @@ package org.apache.camel.component.jetty; import org.apache.camel.Exchange; -import org.apache.camel.Processor; import org.apache.camel.RuntimeCamelException; import org.apache.camel.builder.RouteBuilder; import org.apache.camel.http.base.HttpOperationFailedException; @@ -25,6 +24,9 @@ import org.junit.jupiter.api.Test; import static org.apache.camel.test.junit5.TestSupport.assertIsInstanceOf; import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertTrue; import static org.junit.jupiter.api.Assertions.fail; public class HttpRedirectNoLocationTest extends BaseJettyTest { @@ -37,9 +39,9 @@ public class HttpRedirectNoLocationTest extends BaseJettyTest { } catch (RuntimeCamelException e) { HttpOperationFailedException cause = assertIsInstanceOf(HttpOperationFailedException.class, e.getCause()); assertEquals(302, cause.getStatusCode()); - assertEquals(true, cause.isRedirectError()); - assertEquals(false, cause.hasRedirectLocation()); - assertEquals(null, cause.getRedirectLocation()); + assertTrue(cause.isRedirectError()); + assertFalse(cause.hasRedirectLocation()); + assertNull(cause.getRedirectLocation()); } } @@ -48,11 +50,8 @@ public class HttpRedirectNoLocationTest extends BaseJettyTest { return new RouteBuilder() { @Override public void configure() { - from("jetty://http://localhost:{{port}}/test").process(new Processor() { - public void process(Exchange exchange) { - exchange.getMessage().setHeader(Exchange.HTTP_RESPONSE_CODE, 302); - } - }); + from("jetty://http://localhost:{{port}}/test") + .process(exchange -> exchange.getMessage().setHeader(Exchange.HTTP_RESPONSE_CODE, 302)); } }; } diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/RestJettyNoContentRestConfigTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/RestJettyNoContentRestConfigTest.java index 1110bf38455..5d499e1f3d7 100644 --- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/RestJettyNoContentRestConfigTest.java +++ b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/RestJettyNoContentRestConfigTest.java @@ -26,7 +26,7 @@ import org.apache.camel.support.MessageHelper; 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.assertNull; public class RestJettyNoContentRestConfigTest extends BaseJettyTest { @@ -40,7 +40,7 @@ public class RestJettyNoContentRestConfigTest extends BaseJettyTest { }); assertEquals(204, exchange.getMessage().getHeader(Exchange.HTTP_RESPONSE_CODE)); - assertTrue(exchange.getMessage().getBody() == null); + assertNull(exchange.getMessage().getBody()); } @Test @@ -53,7 +53,7 @@ public class RestJettyNoContentRestConfigTest extends BaseJettyTest { }); assertEquals(204, exchange.getMessage().getHeader(Exchange.HTTP_RESPONSE_CODE)); - assertTrue(exchange.getMessage().getBody() == null); + assertNull(exchange.getMessage().getBody()); } @Test @@ -66,7 +66,7 @@ public class RestJettyNoContentRestConfigTest extends BaseJettyTest { }); assertEquals(200, exchange.getMessage().getHeader(Exchange.HTTP_RESPONSE_CODE)); - assertTrue(MessageHelper.extractBodyAsString(exchange.getMessage()).equals("[]")); + assertEquals("[]", MessageHelper.extractBodyAsString(exchange.getMessage())); } @Test @@ -94,7 +94,7 @@ public class RestJettyNoContentRestConfigTest extends BaseJettyTest { }); assertEquals(200, exchange.getMessage().getHeader(Exchange.HTTP_RESPONSE_CODE)); - assertTrue(MessageHelper.extractBodyAsString(exchange.getMessage()).equals("[]")); + assertEquals("[]", MessageHelper.extractBodyAsString(exchange.getMessage())); } @Test diff --git a/components/camel-jira/src/test/java/org/apache/camel/component/jira/JiraComponentConfigurationTest.java b/components/camel-jira/src/test/java/org/apache/camel/component/jira/JiraComponentConfigurationTest.java index ab1c4674232..05ceaf2f7bf 100644 --- a/components/camel-jira/src/test/java/org/apache/camel/component/jira/JiraComponentConfigurationTest.java +++ b/components/camel-jira/src/test/java/org/apache/camel/component/jira/JiraComponentConfigurationTest.java @@ -21,6 +21,7 @@ import org.apache.camel.test.junit5.CamelTestSupport; import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNull; public class JiraComponentConfigurationTest extends CamelTestSupport { @@ -90,10 +91,10 @@ public class JiraComponentConfigurationTest extends CamelTestSupport { assertEquals("updateissue", endpoint.getType().name().toLowerCase()); assertEquals(JIRA_URL_VALUE, endpoint.getConfiguration().getJiraUrl()); - assertEquals(null, endpoint.getConfiguration().getVerificationCode()); + assertNull(endpoint.getConfiguration().getVerificationCode()); assertEquals(ACCESS_TOKEN_VALUE, endpoint.getConfiguration().getAccessToken()); - assertEquals(null, endpoint.getConfiguration().getConsumerKey()); - assertEquals(null, endpoint.getConfiguration().getPrivateKey()); + assertNull(endpoint.getConfiguration().getConsumerKey()); + assertNull(endpoint.getConfiguration().getPrivateKey()); } @Test diff --git a/components/camel-jolt/src/test/java/org/apache/camel/component/jolt/JoltRemovrTest.java b/components/camel-jolt/src/test/java/org/apache/camel/component/jolt/JoltRemovrTest.java index f8169e44887..91cb3cc3587 100644 --- a/components/camel-jolt/src/test/java/org/apache/camel/component/jolt/JoltRemovrTest.java +++ b/components/camel-jolt/src/test/java/org/apache/camel/component/jolt/JoltRemovrTest.java @@ -25,6 +25,7 @@ import org.apache.camel.test.junit5.CamelTestSupport; import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNull; /** * Unit test testing the Removr. @@ -42,7 +43,7 @@ public class JoltRemovrTest extends CamelTestSupport { }); assertEquals(2, exchange.getMessage().getBody(Map.class).size()); - assertEquals(null, exchange.getMessage().getBody(Map.class).get("removeMe")); + assertNull(exchange.getMessage().getBody(Map.class).get("removeMe")); assertEquals("World", exchange.getMessage().getBody(Map.class).get("Hello")); } diff --git a/components/camel-leveldb/src/test/java/org/apache/camel/component/leveldb/LevelDBAggregationRepositoryLoadExistingTest.java b/components/camel-leveldb/src/test/java/org/apache/camel/component/leveldb/LevelDBAggregationRepositoryLoadExistingTest.java index 0ec46a9840d..d03f72457cf 100644 --- a/components/camel-leveldb/src/test/java/org/apache/camel/component/leveldb/LevelDBAggregationRepositoryLoadExistingTest.java +++ b/components/camel-leveldb/src/test/java/org/apache/camel/component/leveldb/LevelDBAggregationRepositoryLoadExistingTest.java @@ -28,6 +28,7 @@ import org.junit.jupiter.api.condition.OS; import static org.apache.camel.test.junit5.TestSupport.deleteDirectory; import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNull; @DisabledOnOs({ OS.AIX, OS.OTHER }) public class LevelDBAggregationRepositoryLoadExistingTest extends LevelDBTestSupport { @@ -63,7 +64,7 @@ public class LevelDBAggregationRepositoryLoadExistingTest extends LevelDBTestSup Exchange exchange1 = new DefaultExchange(context); exchange1.getIn().setBody("counter:1"); Exchange actual = repo.add(context, "foo", exchange1); - assertEquals(null, actual); + assertNull(actual); // stop the repo levelDBFile.stop(); diff --git a/components/camel-leveldb/src/test/java/org/apache/camel/component/leveldb/LevelDBAggregationRepositoryMultipleRepoTest.java b/components/camel-leveldb/src/test/java/org/apache/camel/component/leveldb/LevelDBAggregationRepositoryMultipleRepoTest.java index cd76762f779..00763c492eb 100644 --- a/components/camel-leveldb/src/test/java/org/apache/camel/component/leveldb/LevelDBAggregationRepositoryMultipleRepoTest.java +++ b/components/camel-leveldb/src/test/java/org/apache/camel/component/leveldb/LevelDBAggregationRepositoryMultipleRepoTest.java @@ -28,6 +28,7 @@ import org.junit.jupiter.api.condition.OS; import static org.apache.camel.test.junit5.TestSupport.deleteDirectory; import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNull; @DisabledOnOs({ OS.AIX, OS.OTHER }) public class LevelDBAggregationRepositoryMultipleRepoTest extends LevelDBTestSupport { @@ -66,21 +67,21 @@ public class LevelDBAggregationRepositoryMultipleRepoTest extends LevelDBTestSup // Can't get something we have not put in... Exchange actual = repo1.get(context, "missing"); - assertEquals(null, actual); + assertNull(actual); actual = repo2.get(context, "missing"); - assertEquals(null, actual); + assertNull(actual); // Store it.. Exchange exchange1 = new DefaultExchange(context); exchange1.getIn().setBody("counter:1"); actual = repo1.add(context, "foo", exchange1); - assertEquals(null, actual); + assertNull(actual); // Get it back.. actual = repo1.get(context, "foo"); assertEquals("counter:1", actual.getIn().getBody()); - assertEquals(null, repo2.get(context, "foo")); + assertNull(repo2.get(context, "foo")); // Change it.. Exchange exchange2 = new DefaultExchange(context); @@ -93,17 +94,17 @@ public class LevelDBAggregationRepositoryMultipleRepoTest extends LevelDBTestSup Exchange exchange3 = new DefaultExchange(context); exchange3.getIn().setBody("Hello World"); actual = repo2.add(context, "bar", exchange3); - assertEquals(null, actual); - assertEquals(null, repo1.get(context, "bar")); + assertNull(actual); + assertNull(repo1.get(context, "bar")); // Get it back.. actual = repo1.get(context, "foo"); assertEquals("counter:2", actual.getIn().getBody()); - assertEquals(null, repo2.get(context, "foo")); + assertNull(repo2.get(context, "foo")); actual = repo2.get(context, "bar"); assertEquals("Hello World", actual.getIn().getBody()); - assertEquals(null, repo1.get(context, "bar")); + assertNull(repo1.get(context, "bar")); } @Test diff --git a/components/camel-leveldb/src/test/java/org/apache/camel/component/leveldb/LevelDBAggregationRepositoryRecoverExistingTest.java b/components/camel-leveldb/src/test/java/org/apache/camel/component/leveldb/LevelDBAggregationRepositoryRecoverExistingTest.java index bd85ed4ccf7..0dd99e87efc 100644 --- a/components/camel-leveldb/src/test/java/org/apache/camel/component/leveldb/LevelDBAggregationRepositoryRecoverExistingTest.java +++ b/components/camel-leveldb/src/test/java/org/apache/camel/component/leveldb/LevelDBAggregationRepositoryRecoverExistingTest.java @@ -58,7 +58,7 @@ public class LevelDBAggregationRepositoryRecoverExistingTest extends LevelDBTest Exchange exchange1 = new DefaultExchange(context); exchange1.getIn().setBody("counter:1"); Exchange actual = repo.add(context, "foo", exchange1); - assertEquals(null, actual); + assertNull(actual); // Remove it, which makes it in the pre confirm stage repo.remove(context, "foo", exchange1); diff --git a/components/camel-leveldb/src/test/java/org/apache/camel/component/leveldb/LevelDBAggregationRepositoryTest.java b/components/camel-leveldb/src/test/java/org/apache/camel/component/leveldb/LevelDBAggregationRepositoryTest.java index 735effd174f..618a7ff858b 100644 --- a/components/camel-leveldb/src/test/java/org/apache/camel/component/leveldb/LevelDBAggregationRepositoryTest.java +++ b/components/camel-leveldb/src/test/java/org/apache/camel/component/leveldb/LevelDBAggregationRepositoryTest.java @@ -28,6 +28,7 @@ import org.junit.jupiter.api.condition.OS; import static org.apache.camel.test.junit5.TestSupport.deleteDirectory; import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNull; @DisabledOnOs({ OS.AIX, OS.OTHER }) public class LevelDBAggregationRepositoryTest extends LevelDBTestSupport { @@ -61,13 +62,13 @@ public class LevelDBAggregationRepositoryTest extends LevelDBTestSupport { // Can't get something we have not put in... Exchange actual = repo.get(context, "missing"); - assertEquals(null, actual); + assertNull(actual); // Store it.. Exchange exchange1 = new DefaultExchange(context); exchange1.getIn().setBody("counter:1"); actual = repo.add(context, "foo", exchange1); - assertEquals(null, actual); + assertNull(actual); // Get it back.. actual = repo.get(context, "foo"); @@ -87,13 +88,13 @@ public class LevelDBAggregationRepositoryTest extends LevelDBTestSupport { // now remove it repo.remove(context, "foo", actual); actual = repo.get(context, "foo"); - assertEquals(null, actual); + assertNull(actual); // add it again exchange1 = new DefaultExchange(context); exchange1.getIn().setBody("counter:3"); actual = repo.add(context, "foo", exchange1); - assertEquals(null, actual); + assertNull(actual); // Get it back.. actual = repo.get(context, "foo"); diff --git a/components/camel-mail/src/test/java/org/apache/camel/component/mail/MailComponentTest.java b/components/camel-mail/src/test/java/org/apache/camel/component/mail/MailComponentTest.java index 2f68b91b0fa..a3bdc5e7d18 100644 --- a/components/camel-mail/src/test/java/org/apache/camel/component/mail/MailComponentTest.java +++ b/components/camel-mail/src/test/java/org/apache/camel/component/mail/MailComponentTest.java @@ -249,7 +249,7 @@ public class MailComponentTest extends CamelTestSupport { assertEquals("smtp", config.getProtocol(), "getProtocol()"); assertEquals("myhost", config.getHost(), "getHost()"); assertEquals(25, config.getPort(), "getPort()"); - assertEquals(null, config.getUsername(), "getUsername()"); + assertNull(config.getUsername(), "getUsername()"); assertNotNull(config.getPasswordAuthentication(), "getPasswordAuthentication()"); assertEquals("u1", config.getPasswordAuthentication().getUserName(), "getPasswordAuthentication().getUserName()"); assertEquals("p1", config.getPasswordAuthentication().getPassword(), "getPasswordAuthentication().getUserName()"); @@ -257,7 +257,7 @@ public class MailComponentTest extends CamelTestSupport { "getRecipients().get(Message.RecipientType.TO)"); assertEquals("INBOX", config.getFolderName(), "folder"); assertEquals("camel@localhost", config.getFrom(), "from"); - assertEquals(null, config.getPassword(), "password"); + assertNull(config.getPassword(), "password"); assertFalse(config.isDelete()); assertFalse(config.isIgnoreUriScheme()); assertEquals(-1, config.getFetchSize(), "fetchSize"); diff --git a/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/processor/idempotent/integration/MongoDbIdempotentRepositoryIT.java b/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/processor/idempotent/integration/MongoDbIdempotentRepositoryIT.java index 4580fda13fd..f10be3621e4 100644 --- a/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/processor/idempotent/integration/MongoDbIdempotentRepositoryIT.java +++ b/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/processor/idempotent/integration/MongoDbIdempotentRepositoryIT.java @@ -26,6 +26,7 @@ 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.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; public class MongoDbIdempotentRepositoryIT extends AbstractMongoDbITSupport { @@ -83,7 +84,7 @@ public class MongoDbIdempotentRepositoryIT extends AbstractMongoDbITSupport { assertEquals(1, testCollection.countDocuments()); boolean added = repo.add(randomUUIDString); - assertTrue(!added, "Duplicated entry was not added"); + assertFalse(added, "Duplicated entry was not added"); assertEquals(1, testCollection.countDocuments()); } @@ -92,14 +93,14 @@ public class MongoDbIdempotentRepositoryIT extends AbstractMongoDbITSupport { String randomUUIDString = UUID.randomUUID().toString(); assertEquals(0, testCollection.countDocuments()); boolean removed = repo.remove(randomUUIDString); - assertTrue(!removed, "Non exisint uid returns false"); + assertFalse(removed, "Non exisint uid returns false"); } @Test public void containsMissingReturnsFalse() { String randomUUIDString = UUID.randomUUID().toString(); boolean found = repo.contains(randomUUIDString); - assertTrue(!found, "Non existing item is not found"); + assertFalse(found, "Non existing item is not found"); } @Test diff --git a/components/camel-netty-http/src/test/java/org/apache/camel/component/netty/http/NettyHttpHeaderCaseTest.java b/components/camel-netty-http/src/test/java/org/apache/camel/component/netty/http/NettyHttpHeaderCaseTest.java index 28d72ac7dcc..6e66991e05c 100644 --- a/components/camel-netty-http/src/test/java/org/apache/camel/component/netty/http/NettyHttpHeaderCaseTest.java +++ b/components/camel-netty-http/src/test/java/org/apache/camel/component/netty/http/NettyHttpHeaderCaseTest.java @@ -28,6 +28,7 @@ import org.apache.hc.core5.http.io.entity.EntityUtils; import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNull; public class NettyHttpHeaderCaseTest extends BaseNettyTest { @@ -58,9 +59,9 @@ public class NettyHttpHeaderCaseTest extends BaseNettyTest { Map<String, Object> map = new LinkedHashMap<>(exchange.getIn().getHeaders()); assertEquals("123", map.get("OTHER")); - assertEquals(null, map.get("other")); + assertNull(map.get("other")); assertEquals("Carlsberg", map.get("beer")); - assertEquals(null, map.get("Beer")); + assertNull(map.get("Beer")); exchange.getMessage().setBody("Bye World"); exchange.getMessage().setHeader("MyCaseHeader", "aBc123"); diff --git a/components/camel-smpp/src/test/java/org/apache/camel/component/smpp/SmppComponentTest.java b/components/camel-smpp/src/test/java/org/apache/camel/component/smpp/SmppComponentTest.java index 7da536ce15e..ba366dc6cd9 100644 --- a/components/camel-smpp/src/test/java/org/apache/camel/component/smpp/SmppComponentTest.java +++ b/components/camel-smpp/src/test/java/org/apache/camel/component/smpp/SmppComponentTest.java @@ -27,9 +27,10 @@ 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.assertInstanceOf; import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNull; import static org.junit.jupiter.api.Assertions.assertSame; -import static org.junit.jupiter.api.Assertions.assertTrue; /** * JUnit test class for <code>org.apache.camel.component.smpp.SmppComponent</code> @@ -37,11 +38,10 @@ import static org.junit.jupiter.api.Assertions.assertTrue; public class SmppComponentTest { private SmppComponent component; - private DefaultCamelContext context; @BeforeEach public void setUp() { - context = new DefaultCamelContext(); + DefaultCamelContext context = new DefaultCamelContext(); context.start(); component = new SmppComponent(context); component.start(); @@ -82,7 +82,7 @@ public class SmppComponentTest { assertEquals("secret", smppEndpoint.getConfiguration().getPassword()); assertEquals("smpp://smppclient@localhost:2775", smppEndpoint.getConnectionString()); assertEquals(ExchangePattern.InOnly, smppEndpoint.getExchangePattern()); - assertTrue(smppEndpoint.getBinding() instanceof SmppBinding); + assertInstanceOf(SmppBinding.class, smppEndpoint.getBinding()); assertNotNull(smppEndpoint.getCamelContext()); } @@ -100,7 +100,7 @@ public class SmppComponentTest { assertEquals("secret", smppEndpoint.getConfiguration().getPassword()); assertEquals("smpps://smppclient@localhost:2775", smppEndpoint.getConnectionString()); assertEquals(ExchangePattern.InOnly, smppEndpoint.getExchangePattern()); - assertTrue(smppEndpoint.getBinding() instanceof SmppBinding); + assertInstanceOf(SmppBinding.class, smppEndpoint.getBinding()); assertNotNull(smppEndpoint.getCamelContext()); } @@ -118,7 +118,7 @@ public class SmppComponentTest { assertEquals("secret", smppEndpoint.getConfiguration().getPassword()); assertEquals("smpp://smppclient@localhost:2775", smppEndpoint.getConnectionString()); assertEquals(ExchangePattern.InOnly, smppEndpoint.getExchangePattern()); - assertTrue(smppEndpoint.getBinding() instanceof SmppBinding); + assertInstanceOf(SmppBinding.class, smppEndpoint.getBinding()); assertNotNull(smppEndpoint.getCamelContext()); } @@ -131,8 +131,8 @@ public class SmppComponentTest { = component.createEndpoint("smpp://smppclient@localhost:2775", "?systemType=&serviceType=", parameters); SmppEndpoint smppEndpoint = (SmppEndpoint) endpoint; - assertEquals(null, smppEndpoint.getConfiguration().getSystemType()); - assertEquals(null, smppEndpoint.getConfiguration().getServiceType()); + assertNull(smppEndpoint.getConfiguration().getSystemType()); + assertNull(smppEndpoint.getConfiguration().getServiceType()); } @Test @@ -147,7 +147,7 @@ public class SmppComponentTest { assertSame(configuration, smppEndpoint.getConfiguration()); assertEquals("smpp://smppclient@localhost:2775", smppEndpoint.getConnectionString()); assertEquals(ExchangePattern.InOnly, smppEndpoint.getExchangePattern()); - assertTrue(smppEndpoint.getBinding() instanceof SmppBinding); + assertInstanceOf(SmppBinding.class, smppEndpoint.getBinding()); assertNotNull(smppEndpoint.getCamelContext()); } @@ -163,7 +163,7 @@ public class SmppComponentTest { assertSame(configuration, smppEndpoint.getConfiguration()); assertEquals("smpp://smppclient@localhost:2775", smppEndpoint.getConnectionString()); assertEquals(ExchangePattern.InOnly, smppEndpoint.getExchangePattern()); - assertTrue(smppEndpoint.getBinding() instanceof SmppBinding); + assertInstanceOf(SmppBinding.class, smppEndpoint.getBinding()); assertNotNull(smppEndpoint.getCamelContext()); } diff --git a/components/camel-smpp/src/test/java/org/apache/camel/component/smpp/SmppConfigurationTest.java b/components/camel-smpp/src/test/java/org/apache/camel/component/smpp/SmppConfigurationTest.java index 44a346c06b4..9aedb4a0364 100644 --- a/components/camel-smpp/src/test/java/org/apache/camel/component/smpp/SmppConfigurationTest.java +++ b/components/camel-smpp/src/test/java/org/apache/camel/component/smpp/SmppConfigurationTest.java @@ -55,7 +55,7 @@ public class SmppConfigurationTest { assertEquals("", configuration.getAddressRange()); assertEquals(Integer.valueOf(60000), configuration.getEnquireLinkTimer()); assertEquals("localhost", configuration.getHost()); - assertEquals(null, configuration.getPassword()); + assertNull(configuration.getPassword()); assertEquals(Integer.valueOf(2775), configuration.getPort()); assertEquals(0x01, configuration.getPriorityFlag()); assertEquals(0x00, configuration.getProtocolId()); @@ -74,11 +74,11 @@ public class SmppConfigurationTest { assertEquals(false, configuration.isUsingSSL()); assertEquals(5000, configuration.getInitialReconnectDelay()); assertEquals(5000, configuration.getReconnectDelay()); - assertEquals(null, configuration.getHttpProxyHost()); + assertNull(configuration.getHttpProxyHost()); assertEquals(Integer.valueOf(3128), configuration.getHttpProxyPort()); - assertEquals(null, configuration.getHttpProxyUsername()); - assertEquals(null, configuration.getHttpProxyPassword()); - assertEquals(null, configuration.getSessionStateListener()); + assertNull(configuration.getHttpProxyUsername()); + assertNull(configuration.getHttpProxyPassword()); + assertNull(configuration.getSessionStateListener()); assertEquals(3, configuration.getPduProcessorDegree()); assertEquals(100, configuration.getPduProcessorQueueCapacity()); assertEquals(false, configuration.isSingleDLR()); diff --git a/components/camel-splunk-hec/src/test/java/org/apache/camel/component/splunkhec/SplunkHECConfigurationTest.java b/components/camel-splunk-hec/src/test/java/org/apache/camel/component/splunkhec/SplunkHECConfigurationTest.java index fa8306e94e6..a83dcdc9e59 100644 --- a/components/camel-splunk-hec/src/test/java/org/apache/camel/component/splunkhec/SplunkHECConfigurationTest.java +++ b/components/camel-splunk-hec/src/test/java/org/apache/camel/component/splunkhec/SplunkHECConfigurationTest.java @@ -19,7 +19,10 @@ package org.apache.camel.component.splunkhec; 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.assertNull; +import static org.junit.jupiter.api.Assertions.assertTrue; public class SplunkHECConfigurationTest { @@ -63,30 +66,30 @@ public class SplunkHECConfigurationTest { @Test public void testDefaultSkipTlsVerifyIsFalse() { SplunkHECConfiguration config = new SplunkHECConfiguration(); - assertEquals(false, config.isSkipTlsVerify()); + assertFalse(config.isSkipTlsVerify()); } @Test public void testDefaultHttps() { SplunkHECConfiguration config = new SplunkHECConfiguration(); - assertEquals(true, config.isHttps()); + assertTrue(config.isHttps()); } @Test public void testDefaultBodyOnly() { SplunkHECConfiguration config = new SplunkHECConfiguration(); - assertEquals(false, config.isBodyOnly()); + assertFalse(config.isBodyOnly()); } @Test public void testDefaultHeadersOnly() { SplunkHECConfiguration config = new SplunkHECConfiguration(); - assertEquals(false, config.isHeadersOnly()); + assertFalse(config.isHeadersOnly()); } @Test public void testDefaultTime() { SplunkHECConfiguration config = new SplunkHECConfiguration(); - assertEquals(null, config.getTime()); + assertNull(config.getTime()); } } diff --git a/components/camel-spring-redis/src/test/java/org/apache/camel/component/redis/RedisSetTest.java b/components/camel-spring-redis/src/test/java/org/apache/camel/component/redis/RedisSetTest.java index c2e3ec3ebd1..7bc5d8c319c 100644 --- a/components/camel-spring-redis/src/test/java/org/apache/camel/component/redis/RedisSetTest.java +++ b/components/camel-spring-redis/src/test/java/org/apache/camel/component/redis/RedisSetTest.java @@ -28,6 +28,7 @@ import org.springframework.data.redis.core.RedisTemplate; import org.springframework.data.redis.core.SetOperations; import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNull; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anySet; import static org.mockito.ArgumentMatchers.anyString; @@ -60,7 +61,7 @@ public class RedisSetTest extends RedisTestSupport { RedisConstants.VALUE, "value"); verify(setOperations).add("key", "value"); - assertEquals(null, result); + assertNull(result); } diff --git a/components/camel-spring-redis/src/test/java/org/apache/camel/component/redis/RedisSortedSetTest.java b/components/camel-spring-redis/src/test/java/org/apache/camel/component/redis/RedisSortedSetTest.java index 32a422c9bd0..2d76bf7c9f0 100644 --- a/components/camel-spring-redis/src/test/java/org/apache/camel/component/redis/RedisSortedSetTest.java +++ b/components/camel-spring-redis/src/test/java/org/apache/camel/component/redis/RedisSortedSetTest.java @@ -28,6 +28,7 @@ import org.springframework.data.redis.core.RedisTemplate; import org.springframework.data.redis.core.ZSetOperations; import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNull; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyDouble; import static org.mockito.ArgumentMatchers.anyLong; @@ -150,7 +151,7 @@ public class RedisSortedSetTest extends RedisTestSupport { RedisConstants.END, 3); verify(zSetOperations).rangeWithScores("key", 1, 3); - assertEquals(null, result); + assertNull(result); } @Test @@ -247,7 +248,7 @@ public class RedisSortedSetTest extends RedisTestSupport { RedisConstants.END, 3); verify(zSetOperations).reverseRangeWithScores("key", 1, 3); - assertEquals(null, result); + assertNull(result); } @Test diff --git a/components/camel-spring-xml/src/test/java/org/apache/camel/spring/config/SpringCamelContextThreadPoolProfilesTest.java b/components/camel-spring-xml/src/test/java/org/apache/camel/spring/config/SpringCamelContextThreadPoolProfilesTest.java index d81f4138f8c..d2d983d83e9 100644 --- a/components/camel-spring-xml/src/test/java/org/apache/camel/spring/config/SpringCamelContextThreadPoolProfilesTest.java +++ b/components/camel-spring-xml/src/test/java/org/apache/camel/spring/config/SpringCamelContextThreadPoolProfilesTest.java @@ -29,6 +29,7 @@ import org.springframework.context.support.AbstractXmlApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNull; public class SpringCamelContextThreadPoolProfilesTest extends SpringTestSupport { @@ -45,9 +46,9 @@ public class SpringCamelContextThreadPoolProfilesTest extends SpringTestSupport ThreadPoolProfile profile = context.getExecutorServiceManager().getThreadPoolProfile("low"); assertEquals(1, profile.getPoolSize().intValue()); assertEquals(5, profile.getMaxPoolSize().intValue()); - assertEquals(null, profile.getKeepAliveTime()); - assertEquals(null, profile.getMaxQueueSize()); - assertEquals(null, profile.getRejectedPolicy()); + assertNull(profile.getKeepAliveTime()); + assertNull(profile.getMaxQueueSize()); + assertNull(profile.getRejectedPolicy()); // create a thread pool from low ExecutorService executor = context.getExecutorServiceManager().newThreadPool(this, "MyLow", "low"); @@ -67,8 +68,8 @@ public class SpringCamelContextThreadPoolProfilesTest extends SpringTestSupport assertEquals(50, profile.getPoolSize().intValue()); assertEquals(100, profile.getMaxPoolSize().intValue()); assertEquals(ThreadPoolRejectedPolicy.Abort, profile.getRejectedPolicy()); - assertEquals(null, profile.getKeepAliveTime()); - assertEquals(null, profile.getMaxQueueSize()); + assertNull(profile.getKeepAliveTime()); + assertNull(profile.getMaxQueueSize()); // create a thread pool from big ExecutorService executor = context.getExecutorServiceManager().newThreadPool(this, "MyBig", "big"); diff --git a/components/camel-spring-xml/src/test/java/org/apache/camel/spring/processor/DualSpringManagedThreadsThreadPoolTest.java b/components/camel-spring-xml/src/test/java/org/apache/camel/spring/processor/DualSpringManagedThreadsThreadPoolTest.java index 0b5d967455c..fd575e086cb 100644 --- a/components/camel-spring-xml/src/test/java/org/apache/camel/spring/processor/DualSpringManagedThreadsThreadPoolTest.java +++ b/components/camel-spring-xml/src/test/java/org/apache/camel/spring/processor/DualSpringManagedThreadsThreadPoolTest.java @@ -26,6 +26,7 @@ import org.springframework.context.support.ClassPathXmlApplicationContext; import static org.apache.camel.management.DefaultManagementObjectNameStrategy.TYPE_THREAD_POOL; import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNull; public class DualSpringManagedThreadsThreadPoolTest extends SpringTestSupport { @@ -64,10 +65,10 @@ public class DualSpringManagedThreadsThreadPoolTest extends SpringTestSupport { // no source or route as its a shared thread pool String source = (String) mbeanServer.getAttribute(on, "SourceId"); - assertEquals(null, source); + assertNull(source); String routeId = (String) mbeanServer.getAttribute(on, "RouteId"); - assertEquals(null, routeId); + assertNull(routeId); on = getCamelObjectName(TYPE_THREAD_POOL, "myOtherPool"); @@ -82,10 +83,10 @@ public class DualSpringManagedThreadsThreadPoolTest extends SpringTestSupport { // no source or route as its a shared thread pool source = (String) mbeanServer.getAttribute(on, "SourceId"); - assertEquals(null, source); + assertNull(source); routeId = (String) mbeanServer.getAttribute(on, "RouteId"); - assertEquals(null, routeId); + assertNull(routeId); } } diff --git a/components/camel-spring-xml/src/test/java/org/apache/camel/spring/processor/SpringManagedThreadsThreadPoolTest.java b/components/camel-spring-xml/src/test/java/org/apache/camel/spring/processor/SpringManagedThreadsThreadPoolTest.java index 834006f5b5d..a656bc35cae 100644 --- a/components/camel-spring-xml/src/test/java/org/apache/camel/spring/processor/SpringManagedThreadsThreadPoolTest.java +++ b/components/camel-spring-xml/src/test/java/org/apache/camel/spring/processor/SpringManagedThreadsThreadPoolTest.java @@ -26,6 +26,7 @@ import org.springframework.context.support.AbstractXmlApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNull; @Disabled public class SpringManagedThreadsThreadPoolTest extends SpringTestSupport { @@ -57,10 +58,10 @@ public class SpringManagedThreadsThreadPoolTest extends SpringTestSupport { // no source or route as its a shared thread pool String source = (String) mbeanServer.getAttribute(on, "SourceId"); - assertEquals(null, source); + assertNull(source); String routeId = (String) mbeanServer.getAttribute(on, "RouteId"); - assertEquals(null, routeId); + assertNull(routeId); } } diff --git a/components/camel-spring-xml/src/test/java/org/apache/camel/spring/util/EndpointHelperTest.java b/components/camel-spring-xml/src/test/java/org/apache/camel/spring/util/EndpointHelperTest.java index c5b37162056..6d02b7d1f5e 100644 --- a/components/camel-spring-xml/src/test/java/org/apache/camel/spring/util/EndpointHelperTest.java +++ b/components/camel-spring-xml/src/test/java/org/apache/camel/spring/util/EndpointHelperTest.java @@ -24,6 +24,7 @@ import org.springframework.context.support.AbstractXmlApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNull; public class EndpointHelperTest extends SpringTestSupport { @@ -39,7 +40,7 @@ public class EndpointHelperTest extends SpringTestSupport { assertEquals("foo", EndpointHelper.lookupEndpointRegistryId(foo)); assertEquals("coolbar", EndpointHelper.lookupEndpointRegistryId(bar)); - assertEquals(null, EndpointHelper.lookupEndpointRegistryId(context.getEndpoint("mock:cheese"))); + assertNull(EndpointHelper.lookupEndpointRegistryId(context.getEndpoint("mock:cheese"))); } } diff --git a/components/camel-sql/src/test/java/org/apache/camel/component/sql/SqlProducerInsertNullTest.java b/components/camel-sql/src/test/java/org/apache/camel/component/sql/SqlProducerInsertNullTest.java index 9f5c6a25889..ceeef347410 100644 --- a/components/camel-sql/src/test/java/org/apache/camel/component/sql/SqlProducerInsertNullTest.java +++ b/components/camel-sql/src/test/java/org/apache/camel/component/sql/SqlProducerInsertNullTest.java @@ -32,6 +32,7 @@ import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseType; import static org.apache.camel.test.junit5.TestSupport.assertIsInstanceOf; import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNull; public class SqlProducerInsertNullTest extends CamelTestSupport { @@ -80,7 +81,7 @@ public class SqlProducerInsertNullTest extends CamelTestSupport { Map<?, ?> row = assertIsInstanceOf(Map.class, received.get(0)); assertEquals("Foo", row.get("project")); assertEquals("ASF", row.get("license")); - assertEquals(null, row.get("description")); + assertNull(row.get("description")); } @Override diff --git a/components/camel-sql/src/test/java/org/apache/camel/component/sql/SqlProducerUseMessageBodyForSqlTest.java b/components/camel-sql/src/test/java/org/apache/camel/component/sql/SqlProducerUseMessageBodyForSqlTest.java index 3961cb7909c..ee12e9bc60e 100644 --- a/components/camel-sql/src/test/java/org/apache/camel/component/sql/SqlProducerUseMessageBodyForSqlTest.java +++ b/components/camel-sql/src/test/java/org/apache/camel/component/sql/SqlProducerUseMessageBodyForSqlTest.java @@ -33,6 +33,7 @@ import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseType; import static org.apache.camel.test.junit5.TestSupport.assertIsInstanceOf; import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNull; public class SqlProducerUseMessageBodyForSqlTest extends CamelTestSupport { @@ -149,7 +150,7 @@ public class SqlProducerUseMessageBodyForSqlTest extends CamelTestSupport { String origSql = assertIsInstanceOf(String.class, mock.getReceivedExchanges().get(0).getIn().getBody()); assertEquals("insert into projects(id, project, license) values(:?id,:?project,:?lic)", origSql); - assertEquals(null, mock.getReceivedExchanges().get(0).getOut().getBody()); + assertNull(mock.getReceivedExchanges().get(0).getOut().getBody()); // Clear and then use route2 to verify result of above insert select context.removeRoute(context.getRoutes().get(0).getId()); diff --git a/components/camel-sql/src/test/java/org/apache/camel/processor/aggregate/jdbc/JdbcAggregateStoreAsText2Test.java b/components/camel-sql/src/test/java/org/apache/camel/processor/aggregate/jdbc/JdbcAggregateStoreAsText2Test.java index 2e188eec5ba..9d8c4ecdd8e 100644 --- a/components/camel-sql/src/test/java/org/apache/camel/processor/aggregate/jdbc/JdbcAggregateStoreAsText2Test.java +++ b/components/camel-sql/src/test/java/org/apache/camel/processor/aggregate/jdbc/JdbcAggregateStoreAsText2Test.java @@ -29,6 +29,7 @@ import org.springframework.context.support.AbstractXmlApplicationContext; import org.springframework.jdbc.core.JdbcTemplate; import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNull; /** * Tests to ensure that arbitrary headers can be stored as raw text within a dataSource Tests to ensure the body can be @@ -72,23 +73,23 @@ public class JdbcAggregateStoreAsText2Test extends CamelSpringTestSupport { headers.put("accountName", "Alan"); template.sendBodyAndHeaders("direct:start", "A", headers); - assertEquals(null, getAggregationRepositoryBody(123)); - assertEquals(null, getAggregationRepositoryCompanyName(123)); + assertNull(getAggregationRepositoryBody(123)); + assertNull(getAggregationRepositoryCompanyName(123)); assertEquals("Alan", getAggregationRepositoryAccountName(123)); template.sendBodyAndHeaders("direct:start", "B", headers); - assertEquals(null, getAggregationRepositoryBody(123)); - assertEquals(null, getAggregationRepositoryCompanyName(123)); + assertNull(getAggregationRepositoryBody(123)); + assertNull(getAggregationRepositoryCompanyName(123)); assertEquals("Alan", getAggregationRepositoryAccountName(123)); template.sendBodyAndHeaders("direct:start", "C", headers); - assertEquals(null, getAggregationRepositoryBody(123)); - assertEquals(null, getAggregationRepositoryCompanyName(123)); + assertNull(getAggregationRepositoryBody(123)); + assertNull(getAggregationRepositoryCompanyName(123)); assertEquals("Alan", getAggregationRepositoryAccountName(123)); template.sendBodyAndHeaders("direct:start", "D", headers); - assertEquals(null, getAggregationRepositoryBody(123)); - assertEquals(null, getAggregationRepositoryCompanyName(123)); + assertNull(getAggregationRepositoryBody(123)); + assertNull(getAggregationRepositoryCompanyName(123)); assertEquals("Alan", getAggregationRepositoryAccountName(123)); template.sendBodyAndHeaders("direct:start", "E", headers); diff --git a/components/camel-sql/src/test/java/org/apache/camel/processor/aggregate/jdbc/JdbcAggregateStoreAsTextTest.java b/components/camel-sql/src/test/java/org/apache/camel/processor/aggregate/jdbc/JdbcAggregateStoreAsTextTest.java index 01af4c354a1..3d12b9571c1 100644 --- a/components/camel-sql/src/test/java/org/apache/camel/processor/aggregate/jdbc/JdbcAggregateStoreAsTextTest.java +++ b/components/camel-sql/src/test/java/org/apache/camel/processor/aggregate/jdbc/JdbcAggregateStoreAsTextTest.java @@ -29,6 +29,7 @@ import org.springframework.context.support.AbstractXmlApplicationContext; import org.springframework.jdbc.core.JdbcTemplate; import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNull; /** * Tests to ensure that arbitrary headers can be stored as raw text within a dataSource Tests to ensure the body can be @@ -111,23 +112,23 @@ public class JdbcAggregateStoreAsTextTest extends CamelSpringTestSupport { template.sendBodyAndHeaders("direct:start", "A", headers); assertEquals("A", getAggregationRepositoryBody(123)); - assertEquals(null, getAggregationRepositoryCompanyName(123)); - assertEquals(null, getAggregationRepositoryAccountName(123)); + assertNull(getAggregationRepositoryCompanyName(123)); + assertNull(getAggregationRepositoryAccountName(123)); template.sendBodyAndHeaders("direct:start", "B", headers); assertEquals("AB", getAggregationRepositoryBody(123)); - assertEquals(null, getAggregationRepositoryCompanyName(123)); - assertEquals(null, getAggregationRepositoryAccountName(123)); + assertNull(getAggregationRepositoryCompanyName(123)); + assertNull(getAggregationRepositoryAccountName(123)); template.sendBodyAndHeaders("direct:start", "C", headers); assertEquals("ABC", getAggregationRepositoryBody(123)); - assertEquals(null, getAggregationRepositoryCompanyName(123)); - assertEquals(null, getAggregationRepositoryAccountName(123)); + assertNull(getAggregationRepositoryCompanyName(123)); + assertNull(getAggregationRepositoryAccountName(123)); template.sendBodyAndHeaders("direct:start", "D", headers); assertEquals("ABCD", getAggregationRepositoryBody(123)); - assertEquals(null, getAggregationRepositoryCompanyName(123)); - assertEquals(null, getAggregationRepositoryAccountName(123)); + assertNull(getAggregationRepositoryCompanyName(123)); + assertNull(getAggregationRepositoryAccountName(123)); template.sendBodyAndHeaders("direct:start", "E", headers); diff --git a/components/camel-sql/src/test/java/org/apache/camel/processor/aggregate/jdbc/JdbcAggregationRepositoryMultipleRepoTest.java b/components/camel-sql/src/test/java/org/apache/camel/processor/aggregate/jdbc/JdbcAggregationRepositoryMultipleRepoTest.java index 8f6ba5c7e98..99b8a1e1a52 100644 --- a/components/camel-sql/src/test/java/org/apache/camel/processor/aggregate/jdbc/JdbcAggregationRepositoryMultipleRepoTest.java +++ b/components/camel-sql/src/test/java/org/apache/camel/processor/aggregate/jdbc/JdbcAggregationRepositoryMultipleRepoTest.java @@ -23,6 +23,7 @@ import org.junit.jupiter.api.Test; import org.springframework.context.support.AbstractApplicationContext; import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNull; public class JdbcAggregationRepositoryMultipleRepoTest extends CamelSpringTestSupport { @@ -38,21 +39,21 @@ public class JdbcAggregationRepositoryMultipleRepoTest extends CamelSpringTestSu // Can't get something we have not put in... Exchange actual = repo1.get(context, "missing"); - assertEquals(null, actual); + assertNull(actual); actual = repo2.get(context, "missing"); - assertEquals(null, actual); + assertNull(actual); // Store it.. Exchange exchange1 = new DefaultExchange(context); exchange1.getIn().setBody("counter:1"); actual = repo1.add(context, "foo", exchange1); - assertEquals(null, actual); + assertNull(actual); // Get it back.. actual = repo1.get(context, "foo"); assertEquals("counter:1", actual.getIn().getBody()); - assertEquals(null, repo2.get(context, "foo")); + assertNull(repo2.get(context, "foo")); // Change it after reading the current exchange with version Exchange exchange2 = new DefaultExchange(context); @@ -66,17 +67,17 @@ public class JdbcAggregationRepositoryMultipleRepoTest extends CamelSpringTestSu Exchange exchange3 = new DefaultExchange(context); exchange3.getIn().setBody("Hello World"); actual = repo2.add(context, "bar", exchange3); - assertEquals(null, actual); - assertEquals(null, repo1.get(context, "bar")); + assertNull(actual); + assertNull(repo1.get(context, "bar")); // Get it back.. actual = repo1.get(context, "foo"); assertEquals("counter:2", actual.getIn().getBody()); - assertEquals(null, repo2.get(context, "foo")); + assertNull(repo2.get(context, "foo")); actual = repo2.get(context, "bar"); assertEquals("Hello World", actual.getIn().getBody()); - assertEquals(null, repo1.get(context, "bar")); + assertNull(repo1.get(context, "bar")); } @Test diff --git a/components/camel-sql/src/test/java/org/apache/camel/processor/aggregate/jdbc/JdbcAggregationRepositoryRecoverExistingTest.java b/components/camel-sql/src/test/java/org/apache/camel/processor/aggregate/jdbc/JdbcAggregationRepositoryRecoverExistingTest.java index 7154c5d630c..cbac26ff40f 100644 --- a/components/camel-sql/src/test/java/org/apache/camel/processor/aggregate/jdbc/JdbcAggregationRepositoryRecoverExistingTest.java +++ b/components/camel-sql/src/test/java/org/apache/camel/processor/aggregate/jdbc/JdbcAggregationRepositoryRecoverExistingTest.java @@ -50,7 +50,7 @@ public class JdbcAggregationRepositoryRecoverExistingTest extends AbstractJdbcAg Exchange exchange1 = new DefaultExchange(context); exchange1.getIn().setBody("counter:1"); Exchange actual = repo.add(context, "foo", exchange1); - assertEquals(null, actual); + assertNull(actual); // Get and remove it, which makes it in the pre confirm stage exchange1 = repo.get(context, "foo"); diff --git a/components/camel-sql/src/test/java/org/apache/camel/processor/aggregate/jdbc/JdbcAggregationRepositoryTest.java b/components/camel-sql/src/test/java/org/apache/camel/processor/aggregate/jdbc/JdbcAggregationRepositoryTest.java index 427e4f10cbc..6291f522dc1 100644 --- a/components/camel-sql/src/test/java/org/apache/camel/processor/aggregate/jdbc/JdbcAggregationRepositoryTest.java +++ b/components/camel-sql/src/test/java/org/apache/camel/processor/aggregate/jdbc/JdbcAggregationRepositoryTest.java @@ -21,6 +21,7 @@ import org.apache.camel.support.DefaultExchange; import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNull; public class JdbcAggregationRepositoryTest extends AbstractJdbcAggregationTestSupport { @@ -33,13 +34,13 @@ public class JdbcAggregationRepositoryTest extends AbstractJdbcAggregationTestSu public void testOperations() { // Can't get something we have not put in... Exchange actual = repo.get(context, "missing"); - assertEquals(null, actual); + assertNull(actual); // Store it.. Exchange exchange1 = new DefaultExchange(context); exchange1.getIn().setBody("counter:1"); actual = repo.add(context, "foo", exchange1); - assertEquals(null, actual); + assertNull(actual); // Get it back.. actual = repo.get(context, "foo"); @@ -60,13 +61,13 @@ public class JdbcAggregationRepositoryTest extends AbstractJdbcAggregationTestSu // now remove it repo.remove(context, "foo", actual); actual = repo.get(context, "foo"); - assertEquals(null, actual); + assertNull(actual); // add it again exchange1 = new DefaultExchange(context); exchange1.getIn().setBody("counter:3"); actual = repo.add(context, "foo", exchange1); - assertEquals(null, actual); + assertNull(actual); // Get it back.. actual = repo.get(context, "foo"); diff --git a/components/camel-ssh/src/test/java/org/apache/camel/component/ssh/SshShellOutputStringHelperTest.java b/components/camel-ssh/src/test/java/org/apache/camel/component/ssh/SshShellOutputStringHelperTest.java index bdd6afe9edc..b91c241896a 100644 --- a/components/camel-ssh/src/test/java/org/apache/camel/component/ssh/SshShellOutputStringHelperTest.java +++ b/components/camel-ssh/src/test/java/org/apache/camel/component/ssh/SshShellOutputStringHelperTest.java @@ -20,6 +20,7 @@ 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.assertNull; import static org.junit.jupiter.api.Assertions.assertTrue; public class SshShellOutputStringHelperTest { @@ -29,7 +30,7 @@ public class SshShellOutputStringHelperTest { assertEquals("Hello ", SshShellOutputStringHelper.beforeLast("Hello World", "World")); assertEquals("Hello World ", SshShellOutputStringHelper.beforeLast("Hello World World", "World")); assertEquals("Hello ", SshShellOutputStringHelper.beforeLast("Hello World Again", "World")); - assertEquals(null, SshShellOutputStringHelper.beforeLast("Hello Again", "Foo")); + assertNull(SshShellOutputStringHelper.beforeLast("Hello Again", "Foo")); assertTrue(SshShellOutputStringHelper.beforeLast("mykey:ignore:hello", ":", "mykey:ignore"::equals).orElse(false)); assertFalse(SshShellOutputStringHelper.beforeLast("ignore:ignore:world", ":", "mykey"::equals).orElse(false)); @@ -40,7 +41,7 @@ public class SshShellOutputStringHelperTest { assertEquals("foo bar' how are", SshShellOutputStringHelper.betweenBeforeLast("Hello 'foo bar' how are' you", "'", "'")); assertEquals("foo bar", SshShellOutputStringHelper.betweenBeforeLast("Hello ${foo bar} how are you", "${", "}")); - assertEquals(null, SshShellOutputStringHelper.betweenBeforeLast("Hello ${foo bar} how are you", "'", "'")); + assertNull(SshShellOutputStringHelper.betweenBeforeLast("Hello ${foo bar} how are you", "'", "'")); assertTrue(SshShellOutputStringHelper.betweenBeforeLast("begin:mykey:end:end", "begin:", ":end", "mykey:end"::equals) .orElse(false)); diff --git a/components/camel-tracing/src/test/java/org/apache/camel/tracing/propagation/CamelMessagingHeadersInjectAdapterTest.java b/components/camel-tracing/src/test/java/org/apache/camel/tracing/propagation/CamelMessagingHeadersInjectAdapterTest.java index 5236513f53d..48d02a66732 100644 --- a/components/camel-tracing/src/test/java/org/apache/camel/tracing/propagation/CamelMessagingHeadersInjectAdapterTest.java +++ b/components/camel-tracing/src/test/java/org/apache/camel/tracing/propagation/CamelMessagingHeadersInjectAdapterTest.java @@ -24,6 +24,7 @@ import org.junit.jupiter.api.Test; import static org.apache.camel.tracing.propagation.CamelMessagingHeadersInjectAdapter.JMS_DASH; import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNull; public class CamelMessagingHeadersInjectAdapterTest { @@ -55,6 +56,6 @@ public class CamelMessagingHeadersInjectAdapterTest { public void propertyWithoutDashEncoding() { CamelMessagingHeadersInjectAdapter adapter = new CamelMessagingHeadersInjectAdapter(map, false); adapter.put("-key-1-", "value1"); - assertEquals(null, map.get(JMS_DASH + "key" + JMS_DASH + "1" + JMS_DASH)); + assertNull(map.get(JMS_DASH + "key" + JMS_DASH + "1" + JMS_DASH)); } } diff --git a/components/camel-xmlsecurity/src/test/java/org/apache/camel/component/xmlsecurity/XAdESSignaturePropertiesTest.java b/components/camel-xmlsecurity/src/test/java/org/apache/camel/component/xmlsecurity/XAdESSignaturePropertiesTest.java index 8a6aae01ebe..d74abe097b4 100644 --- a/components/camel-xmlsecurity/src/test/java/org/apache/camel/component/xmlsecurity/XAdESSignaturePropertiesTest.java +++ b/components/camel-xmlsecurity/src/test/java/org/apache/camel/component/xmlsecurity/XAdESSignaturePropertiesTest.java @@ -71,6 +71,7 @@ import org.junit.jupiter.api.Test; import static org.apache.camel.component.xmlsecurity.XmlSignatureTest.checkThrownException; 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.assertNull; import static org.junit.jupiter.api.Assertions.assertThrows; @@ -967,7 +968,7 @@ public class XAdESSignaturePropertiesTest extends CamelTestSupport { if (startsWith) { assertTrue(result.startsWith(expectedResult)); } else if (NOT_EMPTY.equals(expectedResult)) { - assertTrue(!result.isEmpty(), "Not empty result for xpath " + xpathString + " expected"); + assertFalse(result.isEmpty(), "Not empty result for xpath " + xpathString + " expected"); } else { assertEquals(expectedResult, result); } @@ -991,9 +992,8 @@ public class XAdESSignaturePropertiesTest extends CamelTestSupport { XPath xpath = xpathFactory.newXPath(); NamespaceContext nc = new NamespaceContext() { - @SuppressWarnings("rawtypes") @Override - public Iterator getPrefixes(String namespaceURI) { + public Iterator<String> getPrefixes(String namespaceURI) { return null; } diff --git a/components/camel-zipfile/src/test/java/org/apache/camel/dataformat/zipfile/ZipFileDataFormatTest.java b/components/camel-zipfile/src/test/java/org/apache/camel/dataformat/zipfile/ZipFileDataFormatTest.java index 051704550cd..c0e482411e5 100644 --- a/components/camel-zipfile/src/test/java/org/apache/camel/dataformat/zipfile/ZipFileDataFormatTest.java +++ b/components/camel-zipfile/src/test/java/org/apache/camel/dataformat/zipfile/ZipFileDataFormatTest.java @@ -160,7 +160,7 @@ public class ZipFileDataFormatTest extends CamelTestSupport { zip.setUsingIterator(true); zip.setAllowEmptyDirectory(false); template.sendBody("direct:unzipWithEmptyDirectory", new File("src/test/resources/hello.odt")); - assertTrue(!Files.exists(Paths.get("hello_out/Configurations2"))); + assertFalse(Files.exists(Paths.get("hello_out/Configurations2"))); deleteDirectory(new File("hello_out")); } diff --git a/components/camel-zookeeper/src/test/java/org/apache/camel/component/zookeeper/operations/integration/ChildrenChangedOperationIT.java b/components/camel-zookeeper/src/test/java/org/apache/camel/component/zookeeper/operations/integration/ChildrenChangedOperationIT.java index d0b5dd853ad..854c2755019 100644 --- a/components/camel-zookeeper/src/test/java/org/apache/camel/component/zookeeper/operations/integration/ChildrenChangedOperationIT.java +++ b/components/camel-zookeeper/src/test/java/org/apache/camel/component/zookeeper/operations/integration/ChildrenChangedOperationIT.java @@ -22,6 +22,7 @@ import org.apache.zookeeper.ZooKeeper; import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNull; public class ChildrenChangedOperationIT extends ZooKeeperITSupport { @@ -62,6 +63,6 @@ public class ChildrenChangedOperationIT extends ZooKeeperITSupport { connection.getChildren(path, future, null); client.createPersistent(path + "/child3", null); - assertEquals(null, future.get()); + assertNull(future.get()); } } diff --git a/components/camel-zookeeper/src/test/java/org/apache/camel/component/zookeeper/operations/integration/SetDataOperationIT.java b/components/camel-zookeeper/src/test/java/org/apache/camel/component/zookeeper/operations/integration/SetDataOperationIT.java index d1fb95841dd..004cb0d094c 100644 --- a/components/camel-zookeeper/src/test/java/org/apache/camel/component/zookeeper/operations/integration/SetDataOperationIT.java +++ b/components/camel-zookeeper/src/test/java/org/apache/camel/component/zookeeper/operations/integration/SetDataOperationIT.java @@ -24,6 +24,7 @@ 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.assertNull; public class SetDataOperationIT extends ZooKeeperITSupport { @@ -63,7 +64,7 @@ public class SetDataOperationIT extends ZooKeeperITSupport { SetDataOperation operation = new SetDataOperation(connection, node, payload); operation.setVersion(version); OperationResult<byte[]> result = operation.get(); - assertEquals(null, result.getException()); + assertNull(result.getException()); verifyNodeContainsData(node, payload); assertEquals(expectedVersion, result.getStatistics().getVersion()); } diff --git a/core/camel-management/src/test/java/org/apache/camel/management/BacklogTracerFilterTest.java b/core/camel-management/src/test/java/org/apache/camel/management/BacklogTracerFilterTest.java index 120ccf41829..e8bad6b167a 100644 --- a/core/camel-management/src/test/java/org/apache/camel/management/BacklogTracerFilterTest.java +++ b/core/camel-management/src/test/java/org/apache/camel/management/BacklogTracerFilterTest.java @@ -31,6 +31,7 @@ import org.junit.jupiter.api.condition.OS; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNull; @DisabledOnOs(OS.AIX) public class BacklogTracerFilterTest extends ManagementTestSupport { @@ -73,7 +74,7 @@ public class BacklogTracerFilterTest extends ManagementTestSupport { assertEquals(4, events.size()); BacklogTracerEventMessage event = events.get(0); - assertEquals(null, event.getToNode()); + assertNull(event.getToNode()); assertEquals(" <message exchangeId=\"" + exchanges.get(1).getExchangeId() + "\" exchangePattern=\"InOnly\" exchangeType=\"org.apache.camel.support.DefaultExchange\" messageType=\"org.apache.camel.support.DefaultMessage\">\n" + " <headers>\n" diff --git a/core/camel-management/src/test/java/org/apache/camel/management/BacklogTracerTest.java b/core/camel-management/src/test/java/org/apache/camel/management/BacklogTracerTest.java index 130aa997704..217a1f201c3 100644 --- a/core/camel-management/src/test/java/org/apache/camel/management/BacklogTracerTest.java +++ b/core/camel-management/src/test/java/org/apache/camel/management/BacklogTracerTest.java @@ -34,6 +34,7 @@ import org.junit.jupiter.api.condition.OS; 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; @DisabledOnOs(OS.AIX) @@ -161,7 +162,7 @@ public class BacklogTracerTest extends ManagementTestSupport { BacklogTracerEventMessage event0 = events.get(0); assertEquals("route1", event0.getRouteId()); - assertEquals(null, event0.getToNode()); + assertNull(event0.getToNode()); assertEquals(" <message exchangeId=\"" + fooExchanges.get(0).getExchangeId() + "\" exchangePattern=\"InOnly\" exchangeType=\"org.apache.camel.support.DefaultExchange\" messageType=\"org.apache.camel.support.DefaultMessage\">\n" + " <body type=\"java.lang.String\">Hello World</body>\n" @@ -188,7 +189,7 @@ public class BacklogTracerTest extends ManagementTestSupport { BacklogTracerEventMessage event3 = events.get(4); assertEquals("route1", event3.getRouteId()); - assertEquals(null, event3.getToNode()); + assertNull(event3.getToNode()); assertEquals(" <message exchangeId=\"" + fooExchanges.get(1).getExchangeId() + "\" exchangePattern=\"InOnly\" exchangeType=\"org.apache.camel.support.DefaultExchange\" messageType=\"org.apache.camel.support.DefaultMessage\">\n" + " <body type=\"java.lang.String\">Bye World</body>\n" diff --git a/core/camel-management/src/test/java/org/apache/camel/management/ManagedTransformerRegistryTest.java b/core/camel-management/src/test/java/org/apache/camel/management/ManagedTransformerRegistryTest.java index 6d5f01dee05..744b1691afb 100644 --- a/core/camel-management/src/test/java/org/apache/camel/management/ManagedTransformerRegistryTest.java +++ b/core/camel-management/src/test/java/org/apache/camel/management/ManagedTransformerRegistryTest.java @@ -37,6 +37,7 @@ import org.slf4j.LoggerFactory; 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.fail; @@ -93,11 +94,11 @@ public class ManagedTransformerRegistryTest extends ManagementTestSupport { boolean isDynamic = (boolean) composite.get("dynamic"); LOG.info("[{}][{}][{}][{}][{}][{}]", name, from, to, isStatic, isDynamic, description); if (description.startsWith("ProcessorTransformer")) { - assertEquals(null, name); + assertNull(name); assertEquals("xml:foo", from); assertEquals("json:bar", to); } else if (description.startsWith("DataFormatTransformer")) { - assertEquals(null, name); + assertNull(name); assertEquals("java:" + ManagedTransformerRegistryTest.class.getName(), from); assertEquals("xml:test", to); } else if (description.startsWith("MyTransformer")) { diff --git a/core/camel-util/src/test/java/org/apache/camel/util/CamelURIParserTest.java b/core/camel-util/src/test/java/org/apache/camel/util/CamelURIParserTest.java index 5e5bc92578e..db99df190b6 100644 --- a/core/camel-util/src/test/java/org/apache/camel/util/CamelURIParserTest.java +++ b/core/camel-util/src/test/java/org/apache/camel/util/CamelURIParserTest.java @@ -36,7 +36,7 @@ public class CamelURIParserTest { String[] out1 = CamelURIParser.parseUri("direct:start"); assertEquals("direct", out1[0]); assertEquals("start", out1[1]); - assertEquals(null, out1[2]); + assertNull(out1[2]); } @Test @@ -67,22 +67,22 @@ public class CamelURIParserTest { String[] out1 = CamelURIParser.parseUri("file:/absolute"); assertEquals("file", out1[0]); assertEquals("/absolute", out1[1]); - assertEquals(null, out1[2]); + assertNull(out1[2]); String[] out2 = CamelURIParser.parseUri("file:///absolute"); assertEquals("file", out2[0]); assertEquals("/absolute", out2[1]); - assertEquals(null, out2[2]); + assertNull(out2[2]); String[] out3 = CamelURIParser.parseUri("file://relative"); assertEquals("file", out3[0]); assertEquals("relative", out3[1]); - assertEquals(null, out3[2]); + assertNull(out3[2]); String[] out4 = CamelURIParser.parseUri("file:relative"); assertEquals("file", out4[0]); assertEquals("relative", out4[1]); - assertEquals(null, out4[2]); + assertNull(out4[2]); } @Test @@ -98,12 +98,12 @@ public class CamelURIParserTest { String[] out1 = CamelURIParser.parseUri("file:/"); assertEquals("file", out1[0]); assertEquals("/", out1[1]); - assertEquals(null, out1[2]); + assertNull(out1[2]); String[] out2 = CamelURIParser.parseUri("file:///"); assertEquals("file", out2[0]); assertEquals("/", out2[1]); - assertEquals(null, out2[2]); + assertNull(out2[2]); } @Test @@ -111,12 +111,12 @@ public class CamelURIParserTest { String[] out1 = CamelURIParser.parseUri("file:relative"); assertEquals("file", out1[0]); assertEquals("relative", out1[1]); - assertEquals(null, out1[2]); + assertNull(out1[2]); String[] out2 = CamelURIParser.parseUri("file:relative?"); assertEquals("file", out2[0]); assertEquals("relative", out2[1]); - assertEquals(null, out2[2]); + assertNull(out2[2]); } @Test @@ -124,7 +124,7 @@ public class CamelURIParserTest { String[] out1 = CamelURIParser.fastParseUri("file:relative"); assertEquals("file", out1[0]); assertEquals("relative", out1[1]); - assertEquals(null, out1[2]); + assertNull(out1[2]); String[] out2 = CamelURIParser.fastParseUri("file://relative"); assertEquals(CamelURIParser.URI_ALREADY_NORMALIZED, out2); diff --git a/core/camel-util/src/test/java/org/apache/camel/util/StringHelperTest.java b/core/camel-util/src/test/java/org/apache/camel/util/StringHelperTest.java index 47ab9dc2daa..2bd46a0e533 100644 --- a/core/camel-util/src/test/java/org/apache/camel/util/StringHelperTest.java +++ b/core/camel-util/src/test/java/org/apache/camel/util/StringHelperTest.java @@ -31,7 +31,7 @@ public class StringHelperTest { @Test public void testCamelCashToDash() { - assertEquals(null, camelCaseToDash(null)); + assertNull(camelCaseToDash(null)); assertEquals("", camelCaseToDash("")); assertEquals("hello-world", camelCaseToDash("HelloWorld")); diff --git a/core/camel-util/src/test/java/org/apache/camel/util/URISupportTest.java b/core/camel-util/src/test/java/org/apache/camel/util/URISupportTest.java index 14a4cdb5856..d354b771a5b 100644 --- a/core/camel-util/src/test/java/org/apache/camel/util/URISupportTest.java +++ b/core/camel-util/src/test/java/org/apache/camel/util/URISupportTest.java @@ -33,6 +33,7 @@ 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.assertNotSame; +import static org.junit.jupiter.api.Assertions.assertNull; import static org.junit.jupiter.api.Assertions.assertThrows; import static org.junit.jupiter.api.Assertions.assertTrue; @@ -581,9 +582,9 @@ public class URISupportTest { @Test public void testExtractQuery() throws Exception { - assertEquals(null, URISupport.extractQuery(null)); - assertEquals(null, URISupport.extractQuery("")); - assertEquals(null, URISupport.extractQuery("file:foo")); + assertNull(URISupport.extractQuery(null)); + assertNull(URISupport.extractQuery("")); + assertNull(URISupport.extractQuery("file:foo")); assertEquals("recursive=true", URISupport.extractQuery("file:foo?recursive=true")); assertEquals("recursive=true&delete=true", URISupport.extractQuery("file:foo?recursive=true&delete=true")); }