Brijesh-Thakkar commented on code in PR #26755:
URL: https://github.com/apache/camel/pull/26755#discussion_r4078822694


##########
components/camel-rest-openapi/src/test/java/org/apache/camel/component/rest/openapi/RestOpenApiEndpointV3Test.java:
##########
@@ -213,6 +213,32 @@ public void shouldDetermineBasePath() {
                 .isEqualTo("/endpoint");
     }
 
+    @Test
+    public void shouldDetermineEmptyBasePathFromOpenApiServer() {
+        final RestConfiguration restConfiguration = new RestConfiguration();
+
+        final CamelContext camelContext = mock(CamelContext.class);
+        
when(camelContext.getRestConfiguration()).thenReturn(restConfiguration);
+
+        final OpenAPI openapi = new OpenAPI();
+        openapi.addServersItem(new Server().url("http://localhost:8080";));
+
+        final RestOpenApiComponent component = new RestOpenApiComponent();
+        component.setCamelContext(camelContext);
+
+        final RestOpenApiEndpoint endpoint = new RestOpenApiEndpoint(
+                "rest-openapi:getPetById", "getPetById", component,
+                Collections.emptyMap());
+
+        assertThat(RestOpenApiHelper.getBasePathFromOpenApi(openapi))
+                .as("OpenAPI server without a path should produce an empty 
base path")
+                .isEmpty();
+
+        assertThat(endpoint.determineBasePath(openapi))
+                .as("When the OpenAPI server URL has no path, the base path 
should be empty")
+                .isEmpty();
+    }
+
     @Test
     public void shouldDetermineEndpointParameters() {
         final CamelContext camelContext = mock(CamelContext.class);

Review Comment:
   Added another assertion
   thanks for the review



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to