mirror of
https://github.com/shred/acme4j.git
synced 2025-12-13 11:14:02 +08:00
Optimize AssertJ exception checks
This commit is contained in:
@@ -14,8 +14,7 @@
|
||||
package org.shredzone.acme4j.smime.csr;
|
||||
|
||||
import static java.nio.charset.StandardCharsets.UTF_8;
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
|
||||
import static org.assertj.core.api.Assertions.*;
|
||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
@@ -155,16 +154,16 @@ public class SMIMECSRBuilderTest {
|
||||
|
||||
assertThat(builder.toString()).isEqualTo(",TYPE=SIGNING_AND_ENCRYPTION");
|
||||
|
||||
assertThatExceptionOfType(NullPointerException.class)
|
||||
assertThatNullPointerException()
|
||||
.as("addValue(String, String)")
|
||||
.isThrownBy(() -> new SMIMECSRBuilder().addValue((String) null, "value"));
|
||||
assertThatExceptionOfType(NullPointerException.class)
|
||||
assertThatNullPointerException()
|
||||
.as("addValue(ASN1ObjectIdentifier, String)")
|
||||
.isThrownBy(() -> new SMIMECSRBuilder().addValue((ASN1ObjectIdentifier) null, "value"));
|
||||
assertThatExceptionOfType(NullPointerException.class)
|
||||
assertThatNullPointerException()
|
||||
.as("addValue(String, null)")
|
||||
.isThrownBy(() -> new SMIMECSRBuilder().addValue("C", null));
|
||||
assertThatExceptionOfType(IllegalArgumentException.class)
|
||||
assertThatIllegalArgumentException()
|
||||
.as("addValue(String, null)")
|
||||
.isThrownBy(() -> new SMIMECSRBuilder().addValue("UNKNOWNATT", "val"))
|
||||
.withMessage(invAttNameExMessage);
|
||||
|
||||
@@ -234,7 +234,7 @@ public class EmailProcessorTest extends SMIMETests {
|
||||
|
||||
@Test
|
||||
public void textNoChallengeFails1() {
|
||||
assertThatExceptionOfType(IllegalStateException.class)
|
||||
assertThatIllegalStateException()
|
||||
.isThrownBy(() -> {
|
||||
var processor = EmailProcessor.plainMessage(message);
|
||||
processor.getToken();
|
||||
@@ -244,7 +244,7 @@ public class EmailProcessorTest extends SMIMETests {
|
||||
|
||||
@Test
|
||||
public void textNoChallengeFails2() {
|
||||
assertThatExceptionOfType(IllegalStateException.class)
|
||||
assertThatIllegalStateException()
|
||||
.isThrownBy(() -> {
|
||||
var processor = EmailProcessor.plainMessage(message);
|
||||
processor.getAuthorization();
|
||||
@@ -254,7 +254,7 @@ public class EmailProcessorTest extends SMIMETests {
|
||||
|
||||
@Test
|
||||
public void textNoChallengeFails3() {
|
||||
assertThatExceptionOfType(IllegalStateException.class)
|
||||
assertThatIllegalStateException()
|
||||
.isThrownBy(() -> {
|
||||
var processor = EmailProcessor.plainMessage(message);
|
||||
processor.respond();
|
||||
|
||||
Reference in New Issue
Block a user