From 88181c31f172dd7bb7d45fa2901572e4c5cba0d5 Mon Sep 17 00:00:00 2001 From: Johnny Lim Date: Sun, 26 Aug 2018 22:22:41 +0900 Subject: [PATCH] Polish ActiveDirectoryLdapAuthenticationProviderTests This commit polishes ActiveDirectoryLdapAuthenticationProviderTests.contextEnvironmentPropertiesUsed() by: - Adding fail() to prevent from going through an unexpected path. - Asserting that the root cause is an instance of ClassNotFoundException as the current code doesn't seem to right. --- .../ad/ActiveDirectoryLdapAuthenticationProviderTests.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ldap/src/test/java/org/springframework/security/ldap/authentication/ad/ActiveDirectoryLdapAuthenticationProviderTests.java b/ldap/src/test/java/org/springframework/security/ldap/authentication/ad/ActiveDirectoryLdapAuthenticationProviderTests.java index f2aad0bf23..54f105aa82 100644 --- a/ldap/src/test/java/org/springframework/security/ldap/authentication/ad/ActiveDirectoryLdapAuthenticationProviderTests.java +++ b/ldap/src/test/java/org/springframework/security/ldap/authentication/ad/ActiveDirectoryLdapAuthenticationProviderTests.java @@ -412,9 +412,10 @@ public class ActiveDirectoryLdapAuthenticationProviderTests { try { provider.authenticate(joe); + fail("CommunicationException was expected with a root cause of ClassNotFoundException"); } catch (org.springframework.ldap.CommunicationException expected) { - assertThat(expected.getCause()).isNotInstanceOf(ClassNotFoundException.class); + assertThat(expected.getRootCause()).isInstanceOf(ClassNotFoundException.class); } }