Replace try/catch with AssertJ
Replace manual try/catch/fail blocks with AssertJ calls.
This commit is contained in:
committed by
Josh Cummings
parent
d9276ed8f3
commit
910b81928f
+3
-6
@@ -29,7 +29,7 @@ import org.springframework.security.core.context.SecurityContextHolder;
|
||||
import org.springframework.security.core.userdetails.User;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.assertj.core.api.Assertions.fail;
|
||||
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
|
||||
|
||||
/**
|
||||
* Tests {@link AuthenticationTag}.
|
||||
@@ -106,13 +106,10 @@ public class AuthenticationTagTests {
|
||||
public void testThrowsExceptionForUnrecognisedProperty() {
|
||||
SecurityContextHolder.getContext().setAuthentication(this.auth);
|
||||
this.authenticationTag.setProperty("qsq");
|
||||
try {
|
||||
assertThatExceptionOfType(JspException.class).isThrownBy(() -> {
|
||||
this.authenticationTag.doStartTag();
|
||||
this.authenticationTag.doEndTag();
|
||||
fail("Should have throwns JspException");
|
||||
}
|
||||
catch (JspException expected) {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user