Copilot commented on code in PR #26766:
URL: https://github.com/apache/camel/pull/26766#discussion_r4081212543
##########
components/camel-rest-openapi/src/test/java/org/apache/camel/component/rest/openapi/RestOpenApiEndpointV3Test.java:
##########
@@ -535,6 +535,17 @@ public void
shouldRaiseExceptionsForMissingSpecifications() {
() -> RestOpenApiEndpoint.loadSpecificationFrom(camelContext,
"non-existant.json"));
}
+ @Test
+ public void shouldLoadSpecificationWithoutServers() {
+ final CamelContext camelContext = new DefaultCamelContext();
+
+ OpenAPI openapi =
RestOpenApiEndpoint.loadSpecificationFrom(camelContext, "missing-servers.yaml");
Review Comment:
The PR description mentions validating `openapi.getServers()` is neither
null nor empty, but the added fixture only covers the 'missing' case (null).
Consider adding a second fixture where `servers: []` (present but empty) and a
corresponding test to cover the empty-list validation path (or to assert the
same failure behavior/message).
##########
components/camel-rest-openapi/src/test/java/org/apache/camel/component/rest/openapi/RestOpenApiEndpointV3Test.java:
##########
@@ -535,6 +535,17 @@ public void
shouldRaiseExceptionsForMissingSpecifications() {
() -> RestOpenApiEndpoint.loadSpecificationFrom(camelContext,
"non-existant.json"));
}
+ @Test
+ public void shouldLoadSpecificationWithoutServers() {
+ final CamelContext camelContext = new DefaultCamelContext();
+
+ OpenAPI openapi =
RestOpenApiEndpoint.loadSpecificationFrom(camelContext, "missing-servers.yaml");
+
+ assertThat(openapi).isNotNull();
+ assertThat(openapi.getServers()).isNotEmpty();
+ assertThat(openapi.getServers().get(0).getUrl()).isEqualTo("/");
+ }
Review Comment:
This test asserts that a spec *without* `servers` loads successfully and
that `getServers()` is auto-populated with `\"/\"`. However, the PR
title/description states the new behavior should raise an
`IllegalArgumentException` when `servers` is null/empty. Please align the test
with the intended behavior (e.g., assert the exception and message), or update
the PR description/title if the actual intent is to default-populate `servers`.
--
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]