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.
This commit is contained in:
Johnny Lim 2018-08-26 22:22:41 +09:00 committed by Rob Winch
parent f5ad4ba0fa
commit 88181c31f1
1 changed files with 2 additions and 1 deletions

View File

@ -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);
}
}