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 a0d56187837b0dcf6d140b0f31b01b07567a014a Author: Otavio Rodolfo Piske <angusyo...@gmail.com> AuthorDate: Wed Mar 22 17:50:35 2023 +0100 (chores) camel-netty: cleaned up duplicated test code --- .../http/NettyHttpBindingUseAbsolutePathTest.java | 34 +++++++--------------- 1 file changed, 10 insertions(+), 24 deletions(-) diff --git a/components/camel-netty-http/src/test/java/org/apache/camel/component/netty/http/NettyHttpBindingUseAbsolutePathTest.java b/components/camel-netty-http/src/test/java/org/apache/camel/component/netty/http/NettyHttpBindingUseAbsolutePathTest.java index de5483310d2..61fcd816335 100644 --- a/components/camel-netty-http/src/test/java/org/apache/camel/component/netty/http/NettyHttpBindingUseAbsolutePathTest.java +++ b/components/camel-netty-http/src/test/java/org/apache/camel/component/netty/http/NettyHttpBindingUseAbsolutePathTest.java @@ -20,35 +20,21 @@ import io.netty.handler.codec.http.FullHttpRequest; import org.apache.camel.Exchange; import org.apache.camel.builder.RouteBuilder; import org.apache.camel.component.http.HttpMethods; -import org.junit.jupiter.api.Test; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.ValueSource; import static org.junit.jupiter.api.Assertions.assertEquals; public class NettyHttpBindingUseAbsolutePathTest extends BaseNettyTest { - @Test - public void testSendToNettyWithPath() { - Exchange exchange = template.request("netty-http:http://localhost:{{port}}/mypath?useRelativePath=false", - exchange1 -> exchange1.getIn().setHeader(Exchange.HTTP_METHOD, HttpMethods.POST)); - - // convert the response to a String - String body = exchange.getMessage().getBody(String.class); - assertEquals("Request message is OK", body); - } - - @Test - public void testSendToNettyWithoutPath() { - Exchange exchange = template.request("netty-http:http://localhost:{{port}}?useRelativePath=false", - exchange1 -> exchange1.getIn().setHeader(Exchange.HTTP_METHOD, HttpMethods.POST)); - - // convert the response to a String - String body = exchange.getMessage().getBody(String.class); - assertEquals("Request message is OK", body); - } - - @Test - public void testSendToNettyWithoutPath2() { - Exchange exchange = template.request("netty-http:http://localhost:{{port}}/?useRelativePath=false", + @ParameterizedTest + @ValueSource(strings = { + "/mypath?useRelativePath=false", + "?useRelativePath=false", + "/?useRelativePath=false" + }) + public void testSendToNettyPath(String pathPart) { + Exchange exchange = template.request("netty-http:http://localhost:{{port}}" + pathPart, exchange1 -> exchange1.getIn().setHeader(Exchange.HTTP_METHOD, HttpMethods.POST)); // convert the response to a String