ijuma commented on a change in pull request #9874:
URL: https://github.com/apache/kafka/pull/9874#discussion_r556575480



##########
File path: 
clients/src/test/java/org/apache/kafka/common/security/authenticator/SaslAuthenticatorTest.java
##########
@@ -1682,16 +1671,15 @@ public void 
testCannotReauthenticateAgainFasterThanOneSecond() throws Exception
              * instead
              */
             time.sleep((long) (CONNECTIONS_MAX_REAUTH_MS_VALUE * 1.1));
-            AssertionError exception = assertThrows(AssertionError.class,
+            AssertionFailedError exception = 
assertThrows(AssertionFailedError.class,
                 () -> NetworkTestUtils.checkClientConnection(selector, node, 
1, 1));
             String expectedResponseTextRegex = "\\w-" + node;
             String receivedResponseTextRegex = ".*" + 
OAuthBearerLoginModule.OAUTHBEARER_MECHANISM;
-            assertTrue(
-                    "Should have received the SaslHandshakeRequest bytes back 
since we re-authenticated too quickly, " +
-                    "but instead we got our generated message echoed back, 
implying re-auth succeeded when it " +
-                    "should not have: " + exception,
-                    exception.getMessage().matches(
-                            ".*<\\[" + expectedResponseTextRegex + "]>.*<\\[" 
+ receivedResponseTextRegex + ".*?]>"));
+            assertTrue(exception.getMessage().matches(
+                ".*<" + expectedResponseTextRegex + ">.*<" + 
receivedResponseTextRegex + ".*?>"),

Review comment:
       The assertion error message formatting is slightly different in JUnit 5, 
so I had to remove `[` and `]` from the regex.




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

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to