From ef6b7709c09f24365e832f2bfddc941f1a8eea48 Mon Sep 17 00:00:00 2001 From: Terry Chow <32403408+tkyc@users.noreply.github.com> Date: Wed, 13 Nov 2024 09:34:13 -0800 Subject: [PATCH] Updated fedauth error tests (#2538) --- .../sqlserver/jdbc/fedauth/ErrorMessageTest.java | 9 ++++++--- .../microsoft/sqlserver/jdbc/fedauth/FedauthCommon.java | 1 + 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/test/java/com/microsoft/sqlserver/jdbc/fedauth/ErrorMessageTest.java b/src/test/java/com/microsoft/sqlserver/jdbc/fedauth/ErrorMessageTest.java index 936855573..dd4d95239 100644 --- a/src/test/java/com/microsoft/sqlserver/jdbc/fedauth/ErrorMessageTest.java +++ b/src/test/java/com/microsoft/sqlserver/jdbc/fedauth/ErrorMessageTest.java @@ -397,7 +397,8 @@ public void testADPasswordWrongPasswordWithConnectionStringUserName() throws SQL && e.getCause().getCause().getMessage().toLowerCase().contains("invalid username or password") || e.getCause().getCause().getMessage().contains(ERR_MSG_SIGNIN_TOO_MANY) || e.getCause().getCause().getMessage().contains(ERR_FAULT_ID3342) - || e.getMessage().contains(ERR_MSG_REQUEST_THROTTLED)); + || e.getMessage().contains(ERR_MSG_REQUEST_THROTTLED) + || e.getMessage().contains(ERR_FAULT_AUTH_FAIL)); } } @@ -424,7 +425,8 @@ public void testADPasswordWrongPasswordWithDatasource() throws SQLException { && e.getCause().getCause().getMessage().toLowerCase().contains("invalid username or password") || e.getCause().getCause().getMessage().contains(ERR_MSG_SIGNIN_TOO_MANY) || e.getCause().getCause().getMessage().contains(ERR_FAULT_ID3342) - || e.getMessage().contains(ERR_MSG_REQUEST_THROTTLED)); + || e.getMessage().contains(ERR_MSG_REQUEST_THROTTLED) + || e.getMessage().contains(ERR_FAULT_AUTH_FAIL)); } } @@ -445,7 +447,8 @@ public void testADPasswordWrongPasswordWithConnectionStringUser() throws SQLExce && e.getCause().getCause().getMessage().toLowerCase().contains("invalid username or password") || e.getCause().getCause().getMessage().contains(ERR_MSG_SIGNIN_TOO_MANY) || e.getCause().getCause().getMessage().contains(ERR_FAULT_ID3342) - || e.getMessage().contains(ERR_MSG_REQUEST_THROTTLED)); + || e.getMessage().contains(ERR_MSG_REQUEST_THROTTLED) + || e.getMessage().contains(ERR_FAULT_AUTH_FAIL)); } } diff --git a/src/test/java/com/microsoft/sqlserver/jdbc/fedauth/FedauthCommon.java b/src/test/java/com/microsoft/sqlserver/jdbc/fedauth/FedauthCommon.java index bbacf1ecc..1270b1c94 100644 --- a/src/test/java/com/microsoft/sqlserver/jdbc/fedauth/FedauthCommon.java +++ b/src/test/java/com/microsoft/sqlserver/jdbc/fedauth/FedauthCommon.java @@ -128,6 +128,7 @@ public class FedauthCommon extends AbstractTest { static final String ERR_MSG_HAS_BEEN_CLOSED = TestResource.getResource("R_hasBeenClosed"); static final String ERR_MSG_SIGNIN_TOO_MANY = TestResource.getResource("R_signinTooManyTimes"); static final String ERR_FAULT_ID3342 = "FaultMessage: ID3242"; + static final String ERR_FAULT_AUTH_FAIL = "FaultMessage: Authentication Failure"; static final String ERR_MSG_NOT_AUTH_AND_IS = TestUtils.R_BUNDLE .getString("R_SetAuthenticationWhenIntegratedSecurityTrue"); static final String ERR_MSG_NOT_AUTH_AND_USER_PASSWORD = TestUtils.R_BUNDLE