mirror of
https://github.com/shred/acme4j.git
synced 2025-12-13 11:14:02 +08:00
Review all unit tests
- Replace deprecated org.junit.Assert.assertThat by org.hamcrest.MatcherAssert.assertThat - Other minor checkstyle fixes
This commit is contained in:
@@ -15,8 +15,9 @@ package org.shredzone.acme4j.it.boulder;
|
||||
|
||||
import static java.util.concurrent.TimeUnit.SECONDS;
|
||||
import static org.awaitility.Awaitility.await;
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.hamcrest.Matchers.*;
|
||||
import static org.junit.Assert.*;
|
||||
import static org.junit.Assert.fail;
|
||||
|
||||
import java.net.URI;
|
||||
import java.security.KeyPair;
|
||||
@@ -46,7 +47,7 @@ public class OrderHttpIT {
|
||||
|
||||
private final String bammbammUrl = System.getProperty("bammbammUrl", "http://localhost:14001");
|
||||
|
||||
private BammBammClient client = new BammBammClient(bammbammUrl);
|
||||
private final BammBammClient client = new BammBammClient(bammbammUrl);
|
||||
|
||||
/**
|
||||
* Test if a certificate can be ordered via http-01 challenge.
|
||||
|
||||
@@ -13,8 +13,10 @@
|
||||
*/
|
||||
package org.shredzone.acme4j.it.pebble;
|
||||
|
||||
import static org.hamcrest.Matchers.*;
|
||||
import static org.junit.Assert.*;
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.hamcrest.Matchers.contains;
|
||||
import static org.hamcrest.Matchers.is;
|
||||
import static org.junit.Assert.fail;
|
||||
|
||||
import java.net.URI;
|
||||
import java.net.URL;
|
||||
|
||||
@@ -15,8 +15,9 @@ package org.shredzone.acme4j.it.pebble;
|
||||
|
||||
import static java.util.concurrent.TimeUnit.SECONDS;
|
||||
import static org.awaitility.Awaitility.await;
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.hamcrest.Matchers.*;
|
||||
import static org.junit.Assert.*;
|
||||
import static org.junit.Assert.fail;
|
||||
|
||||
import java.net.URI;
|
||||
import java.security.KeyPair;
|
||||
@@ -154,7 +155,7 @@ public class OrderIT extends PebbleITBase {
|
||||
|
||||
KeyPair domainKeyPair = createKeyPair();
|
||||
|
||||
Instant notBefore = Instant.now().truncatedTo(ChronoUnit.MILLIS);
|
||||
Instant notBefore = Instant.now().truncatedTo(ChronoUnit.SECONDS);
|
||||
Instant notAfter = notBefore.plus(Duration.ofDays(20L));
|
||||
|
||||
Order order = account.newOrder()
|
||||
@@ -208,8 +209,8 @@ public class OrderIT extends PebbleITBase {
|
||||
Certificate certificate = order.getCertificate();
|
||||
X509Certificate cert = certificate.getCertificate();
|
||||
assertThat(cert, not(nullValue()));
|
||||
assertThat(cert.getNotAfter(), not(nullValue()));
|
||||
assertThat(cert.getNotBefore(), not(nullValue()));
|
||||
assertThat(cert.getNotBefore().toInstant(), is(notNullValue()));
|
||||
assertThat(cert.getNotAfter().toInstant(), is(notNullValue()));
|
||||
assertThat(cert.getSubjectX500Principal().getName(), containsString("CN=" + domain));
|
||||
|
||||
for (Authorization auth : order.getAuthorizations()) {
|
||||
@@ -260,12 +261,12 @@ public class OrderIT extends PebbleITBase {
|
||||
}
|
||||
|
||||
@FunctionalInterface
|
||||
private static interface Validator {
|
||||
private interface Validator {
|
||||
Challenge prepare(Authorization auth) throws Exception;
|
||||
}
|
||||
|
||||
@FunctionalInterface
|
||||
private static interface Revoker {
|
||||
private interface Revoker {
|
||||
void revoke(Session session, Certificate certificate, KeyPair keyPair,
|
||||
KeyPair domainKeyPair) throws Exception;
|
||||
}
|
||||
|
||||
@@ -16,8 +16,9 @@ package org.shredzone.acme4j.it.pebble;
|
||||
import static java.util.concurrent.TimeUnit.SECONDS;
|
||||
import static java.util.stream.Collectors.toList;
|
||||
import static org.awaitility.Awaitility.await;
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.hamcrest.Matchers.*;
|
||||
import static org.junit.Assert.*;
|
||||
import static org.junit.Assert.fail;
|
||||
|
||||
import java.security.KeyPair;
|
||||
import java.security.cert.X509Certificate;
|
||||
|
||||
@@ -13,8 +13,8 @@
|
||||
*/
|
||||
package org.shredzone.acme4j.it.pebble;
|
||||
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.hamcrest.Matchers.*;
|
||||
import static org.junit.Assert.assertThat;
|
||||
|
||||
import java.net.URI;
|
||||
import java.net.URL;
|
||||
@@ -133,7 +133,7 @@ public abstract class PebbleITBase {
|
||||
}
|
||||
|
||||
@FunctionalInterface
|
||||
public static interface CleanupCallback {
|
||||
public interface CleanupCallback {
|
||||
void cleanup() throws Exception;
|
||||
}
|
||||
|
||||
|
||||
@@ -13,8 +13,8 @@
|
||||
*/
|
||||
package org.shredzone.acme4j.it.pebble;
|
||||
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.hamcrest.Matchers.*;
|
||||
import static org.junit.Assert.assertThat;
|
||||
import static uk.co.datumedge.hamcrest.json.SameJSONAs.sameJSONAs;
|
||||
|
||||
import java.net.URI;
|
||||
|
||||
Reference in New Issue
Block a user