rshdhere commented on code in PR #18473:
URL: https://github.com/apache/iceberg/pull/18473#discussion_r4260039201


##########
core/src/test/java/org/apache/iceberg/rest/TestErrorHandlers.java:
##########
@@ -71,6 +73,62 @@ public void errorHandlerWithCodeAndTypeOnly() {
         .hasMessage("Unable to process (code: 422, type: ValidationException): 
null");
   }
 
+  @Test
+  void badRequestWithValidationExceptionType() {
+    ErrorResponse error =
+        ErrorResponse.builder()
+            .responseCode(400)
+            .withType("ValidationException")
+            .withMessage("Table property commit.retry.num-retries must have 
integer value")
+            .build();
+
+    assertThatThrownBy(() -> ErrorHandlers.tableErrorHandler().accept(error))
+        .isInstanceOf(ValidationException.class)
+        .hasMessage("Table property commit.retry.num-retries must have integer 
value");
+  }
+
+  @Test
+  void commitBadRequestWithValidationExceptionType() {
+    ErrorResponse error =
+        ErrorResponse.builder()
+            .responseCode(400)
+            .withType("ValidationException")
+            .withMessage("Table property commit.retry.num-retries must have 
integer value")
+            .build();
+
+    assertThatThrownBy(() -> ErrorHandlers.tableCommitHandler().accept(error))
+        .isInstanceOf(ValidationException.class)
+        .hasMessage("Table property commit.retry.num-retries must have integer 
value");
+  }
+
+  @Test
+  void badRequestWithValidationExceptionTypeKeepsPercentInMessage() {

Review Comment:
   It was there to guard against passing the server message as the format 
string, since `ValidationException` formats its message. But Error Prone's 
`FormatStringAnnotation` check already rejects that at compile time, so the 
test isn't needed. I've removed it.



-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to