nastra commented on code in PR #8365:
URL: https://github.com/apache/iceberg/pull/8365#discussion_r1302667528


##########
aws/src/test/java/org/apache/iceberg/aws/s3/signer/S3SignerServlet.java:
##########
@@ -78,10 +81,42 @@ public class S3SignerServlet extends HttpServlet {
       ImmutableMap.of(HttpHeaders.CONTENT_TYPE, 
ContentType.APPLICATION_JSON.getMimeType());
   private final ObjectMapper mapper;
 
+  private List<SignRequestValidator> s3SignRequestValidators = 
Lists.newArrayList();
+
+  /**
+   * SignRequestValidator is a wrapper class used for validating the contents 
of the S3SignRequest
+   * and thus verifying the behavior of the client during testing.
+   */
+  public static class SignRequestValidator {
+    private final Predicate<S3SignRequest> verifyExpectation;
+    private final Predicate<S3SignRequest> signRequestExpectation;
+    private final String assertMessage;
+
+    public SignRequestValidator(
+        Predicate<S3SignRequest> signRequestExpectation,
+        Predicate<S3SignRequest> verifyExpectation,
+        String assertMessage) {
+      this.signRequestExpectation = signRequestExpectation;
+      this.verifyExpectation = verifyExpectation;
+      this.assertMessage = assertMessage;
+    }
+
+    void validateRequest(S3SignRequest request) {
+      if (verifyExpectation.test(request)) {
+        Assert.assertTrue(assertMessage, signRequestExpectation.test(request));

Review Comment:
   we try to not use Junit4-style assertions anymore, so it's better to switch 
this to an AssertJ-style assertion: 
`assertThat(requestExpectation.test(request)).as(assertMessage).isTrue()`



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