Clarify in Javadoc that expressionHandler should not be null

Fixes: gh-2665
This commit is contained in:
Eleftheria Stein
2019-10-23 15:10:39 -04:00
parent b9f122230b
commit de7cbc82b5
2 changed files with 23 additions and 4 deletions

View File

@@ -253,6 +253,25 @@ public class WebSecurityConfigurationTests {
}
}
@Test
public void loadConfigWhenSecurityExpressionHandlerIsNullThenException() {
Throwable thrown = catchThrowable(() ->
this.spring.register(NullWebSecurityExpressionHandlerConfig.class).autowire()
);
assertThat(thrown).isInstanceOf(BeanCreationException.class);
assertThat(thrown).hasRootCauseExactlyInstanceOf(IllegalArgumentException.class);
}
@EnableWebSecurity
static class NullWebSecurityExpressionHandlerConfig extends WebSecurityConfigurerAdapter {
@Override
public void configure(WebSecurity web) {
web.expressionHandler(null);
}
}
@Test
public void loadConfigWhenDefaultSecurityExpressionHandlerThenDefaultIsRegistered() {
this.spring.register(WebSecurityExpressionHandlerDefaultsConfig.class).autowire();