1
0
mirror of synced 2026-05-22 13:23:17 +00:00

Replace try/catch with AssertJ

Replace manual try/catch/fail blocks with AssertJ calls.
This commit is contained in:
Phillip Webb
2020-09-10 12:06:07 -07:00
committed by Josh Cummings
parent d9276ed8f3
commit 910b81928f
98 changed files with 717 additions and 2122 deletions
@@ -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