Copilot commented on code in PR #12791:
URL: https://github.com/apache/gravitino/pull/12791#discussion_r3906190899
##########
server/src/test/java/org/apache/gravitino/server/web/rest/TestJobOperations.java:
##########
@@ -240,6 +240,22 @@ public void testListJobTemplates() {
Assertions.assertEquals(RuntimeException.class.getSimpleName(),
errorResp3.getType());
}
+ @Test
+ public void testRegisterJobTemplateWithNullRequest() {
+ Response resp =
+ target(jobTemplatePath())
+ .request(APPLICATION_JSON_TYPE)
+ .accept("application/vnd.gravitino.v1+json")
+ .post(Entity.entity(new byte[0], APPLICATION_JSON_TYPE));
+
+ Assertions.assertEquals(Response.Status.BAD_REQUEST.getStatusCode(),
resp.getStatus());
+ ErrorResponse errorResponse = resp.readEntity(ErrorResponse.class);
+ Assertions.assertEquals(ErrorConstants.ILLEGAL_ARGUMENTS_CODE,
errorResponse.getCode());
+ Assertions.assertEquals(
+ IllegalArgumentException.class.getSimpleName(),
errorResponse.getType());
+ Assertions.assertTrue(errorResponse.getMessage().contains("Request body
cannot be null"));
+ }
Review Comment:
This test duplicates the standard null-request assertion logic already
centralized in `BaseOperationsTest.assertNullRequestBodyRejected(...)`.
Duplicating the assertions makes it easier for tests to drift if the error
contract changes (code/type/message). Consider calling the shared helper here
for consistency with the other `WithNullRequest` tests.
--
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]