Replace ExpectedException @Rules with AssertJ
Replace JUnit ExpectedException @Rules with AssertJ calls.
This commit is contained in:
committed by
Josh Cummings
parent
910b81928f
commit
20baa7d409
+5
-9
@@ -17,21 +17,18 @@
|
||||
package org.springframework.security;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.rules.ExpectedException;
|
||||
|
||||
import org.springframework.beans.factory.BeanDefinitionStoreException;
|
||||
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
|
||||
|
||||
/**
|
||||
* @author Eddú Meléndez
|
||||
*/
|
||||
public class LdapServerBeanDefinitionParserTests {
|
||||
|
||||
@Rule
|
||||
public ExpectedException thrown = ExpectedException.none();
|
||||
|
||||
private ClassPathXmlApplicationContext context;
|
||||
|
||||
@After
|
||||
@@ -44,10 +41,9 @@ public class LdapServerBeanDefinitionParserTests {
|
||||
|
||||
@Test
|
||||
public void apacheDirectoryServerIsStartedByDefault() {
|
||||
this.thrown.expect(BeanDefinitionStoreException.class);
|
||||
this.thrown.expectMessage("Embedded LDAP server is not provided");
|
||||
|
||||
this.context = new ClassPathXmlApplicationContext("applicationContext-security.xml");
|
||||
assertThatExceptionOfType(BeanDefinitionStoreException.class)
|
||||
.isThrownBy(() -> this.context = new ClassPathXmlApplicationContext("applicationContext-security.xml"))
|
||||
.withMessageContaining("Embedded LDAP server is not provided");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user