mirror of
https://github.com/shred/acme4j.git
synced 2025-12-13 11:14:02 +08:00
getCertificate() is not Optional
getCertificate() would only return Optional.empty() if it was invoked before the order was finalized. In order to keep the API simple, that state will now throw an IllegalStateException, and getCertificate() directly returns a non-null Certificate now.
This commit is contained in:
@@ -23,7 +23,6 @@ import java.security.KeyPair;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.shredzone.acme4j.AccountBuilder;
|
||||
import org.shredzone.acme4j.Authorization;
|
||||
import org.shredzone.acme4j.Certificate;
|
||||
import org.shredzone.acme4j.Order;
|
||||
import org.shredzone.acme4j.Session;
|
||||
import org.shredzone.acme4j.Status;
|
||||
@@ -93,9 +92,7 @@ public class OrderHttpIT {
|
||||
.conditionEvaluationListener(cond -> updateOrder(order))
|
||||
.untilAsserted(() -> assertThat(order.getStatus()).isNotIn(Status.PENDING, Status.PROCESSING));
|
||||
|
||||
var cert = order.getCertificate()
|
||||
.map(Certificate::getCertificate)
|
||||
.orElseThrow();
|
||||
var cert = order.getCertificate().getCertificate();
|
||||
assertThat(cert.getNotAfter()).isNotNull();
|
||||
assertThat(cert.getNotBefore()).isNotNull();
|
||||
assertThat(cert.getSubjectX500Principal().getName()).contains("CN=" + TEST_DOMAIN);
|
||||
|
||||
@@ -195,7 +195,7 @@ public class OrderIT extends PebbleITBase {
|
||||
|
||||
assertThat(order.getStatus()).isEqualTo(Status.VALID);
|
||||
|
||||
var certificate = order.getCertificate().orElseThrow();
|
||||
var certificate = order.getCertificate();
|
||||
var cert = certificate.getCertificate();
|
||||
assertThat(cert).isNotNull();
|
||||
assertThat(cert.getNotBefore().toInstant()).isEqualTo(notBefore);
|
||||
|
||||
@@ -25,7 +25,6 @@ import java.time.temporal.ChronoUnit;
|
||||
import org.bouncycastle.asn1.x509.GeneralName;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.shredzone.acme4j.AccountBuilder;
|
||||
import org.shredzone.acme4j.Certificate;
|
||||
import org.shredzone.acme4j.Session;
|
||||
import org.shredzone.acme4j.Status;
|
||||
import org.shredzone.acme4j.challenge.Dns01Challenge;
|
||||
@@ -112,9 +111,7 @@ public class OrderWildcardIT extends PebbleITBase {
|
||||
order.getStatus()).isNotIn(Status.PENDING, Status.PROCESSING));
|
||||
|
||||
|
||||
var cert = order.getCertificate()
|
||||
.map(Certificate::getCertificate)
|
||||
.orElseThrow();
|
||||
var cert = order.getCertificate().getCertificate();
|
||||
assertThat(cert).isNotNull();
|
||||
assertThat(cert.getNotAfter()).isNotEqualTo(notBefore);
|
||||
assertThat(cert.getNotBefore()).isNotEqualTo(notAfter);
|
||||
|
||||
Reference in New Issue
Block a user