This is an automated email from the ASF dual-hosted git repository. orpiske pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel.git
commit 423be17f6dcc6741214c75ecc41fae8f9208e330 Author: Otavio Rodolfo Piske <angusyo...@gmail.com> AuthorDate: Sun May 12 09:19:40 2024 +0200 (chores) camel-http: code cleanup - simplify assertions --- .../java/org/apache/camel/component/http/HttpEndpointURLTest.java | 3 ++- .../org/apache/camel/component/http/HttpEndpointUriAssemblerTest.java | 4 ++-- .../camel/component/http/HttpProducerWithSpecialCharsBodyTest.java | 4 ++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/components/camel-http/src/test/java/org/apache/camel/component/http/HttpEndpointURLTest.java b/components/camel-http/src/test/java/org/apache/camel/component/http/HttpEndpointURLTest.java index 976bbf279ce..fd0b64ca1ea 100644 --- a/components/camel-http/src/test/java/org/apache/camel/component/http/HttpEndpointURLTest.java +++ b/components/camel-http/src/test/java/org/apache/camel/component/http/HttpEndpointURLTest.java @@ -23,6 +23,7 @@ import org.apache.hc.client5.http.io.HttpClientConnectionManager; 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.assertTrue; public class HttpEndpointURLTest extends CamelTestSupport { @@ -62,7 +63,7 @@ public class HttpEndpointURLTest extends CamelTestSupport { HttpEndpoint http1 = context.getEndpoint("http://www.google.com?maxTotalConnections=40&connectionsPerRoute=5", HttpEndpoint.class); HttpClientConnectionManager connectionManager = http1.getClientConnectionManager(); - assertTrue(connectionManager instanceof PoolingHttpClientConnectionManager, "Get a wrong type of connection manager"); + assertInstanceOf(PoolingHttpClientConnectionManager.class, connectionManager, "Get a wrong type of connection manager"); PoolingHttpClientConnectionManager poolManager = (PoolingHttpClientConnectionManager) connectionManager; assertEquals(40, poolManager.getMaxTotal(), "Get a wrong setting of maxTotalConnections"); assertEquals(5, poolManager.getDefaultMaxPerRoute(), "Get a wrong setting of connectionsPerRoute"); diff --git a/components/camel-http/src/test/java/org/apache/camel/component/http/HttpEndpointUriAssemblerTest.java b/components/camel-http/src/test/java/org/apache/camel/component/http/HttpEndpointUriAssemblerTest.java index 02ba33c95f5..17d381a670a 100644 --- a/components/camel-http/src/test/java/org/apache/camel/component/http/HttpEndpointUriAssemblerTest.java +++ b/components/camel-http/src/test/java/org/apache/camel/component/http/HttpEndpointUriAssemblerTest.java @@ -25,8 +25,8 @@ import org.apache.camel.spi.EndpointUriFactory; 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.assertTrue; public class HttpEndpointUriAssemblerTest { @@ -46,7 +46,7 @@ public class HttpEndpointUriAssemblerTest { EndpointUriFactory assembler = context.getCamelContextExtension().getEndpointUriFactory("https"); assertNotNull(assembler); - assertTrue(assembler instanceof HttpEndpointUriFactory); + assertInstanceOf(HttpEndpointUriFactory.class, assembler); String uri = assembler.buildUri("https", params); assertNotNull(uri); diff --git a/components/camel-http/src/test/java/org/apache/camel/component/http/HttpProducerWithSpecialCharsBodyTest.java b/components/camel-http/src/test/java/org/apache/camel/component/http/HttpProducerWithSpecialCharsBodyTest.java index 3a0cfb9ef2c..287fab17f5c 100644 --- a/components/camel-http/src/test/java/org/apache/camel/component/http/HttpProducerWithSpecialCharsBodyTest.java +++ b/components/camel-http/src/test/java/org/apache/camel/component/http/HttpProducerWithSpecialCharsBodyTest.java @@ -67,7 +67,7 @@ class HttpProducerWithSpecialCharsBodyTest { HttpEntity requestEntity = httpProducer.createRequestEntity(exchange); - assertTrue(requestEntity instanceof StringEntity); + assertInstanceOf(StringEntity.class, requestEntity); StringEntity entity = (StringEntity) requestEntity; assertEquals(APPLICATION_JSON_UTF8, entity.getContentType(), "Content type should be given content type and charset"); assertNull(entity.getContentEncoding(), "Content encoding should not be given"); @@ -91,7 +91,7 @@ class HttpProducerWithSpecialCharsBodyTest { HttpEntity requestEntity = httpProducer.createRequestEntity(exchange); - assertTrue(requestEntity instanceof StringEntity); + assertInstanceOf(StringEntity.class, requestEntity); StringEntity entity = (StringEntity) requestEntity; assertEquals(APPLICATION_JSON_UTF8, entity.getContentType(), "Content type should be given content type and charset"); assertNull(entity.getContentEncoding(), "Content encoding should not be given");