Fix checkstyle issues

This commit is contained in:
Paul Schaub 2022-03-17 15:31:39 +01:00
parent 3af16baa20
commit 661c870d1a
Signed by: vanitasvitae
GPG Key ID: 62BEE9264BF17311
3 changed files with 28 additions and 21 deletions

View File

@ -6,10 +6,7 @@ package pgp.wkd.cli.test_suite;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.DynamicTest;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestFactory;
import org.junit.platform.commons.logging.Logger;
import org.junit.platform.commons.logging.LoggerFactory;
import pgp.wkd.cli.WKDCLI;
import pgp.wkd.cli.command.Fetch;
import pgp.wkd.test_suite.TestCase;
@ -26,7 +23,6 @@ import static org.junit.jupiter.api.Assertions.assertNotEquals;
public class TestSuiteTestRunner {
private static final Logger LOGGER = LoggerFactory.getLogger(TestSuiteTestRunner.class);
private static TestSuite suite;
@BeforeAll
@ -49,22 +45,23 @@ public class TestSuiteTestRunner {
public Iterable<DynamicTest> testsFromTestSuite() {
return suite.getTestCases()
.stream()
.map(testCase -> DynamicTest.dynamicTest(
testCase.getTestTitle(),
() -> {
String mail = testCase.getLookupMailAddress();
int exitCode = WKDCLI.execute(new String[] {
"fetch", "--armor", mail
});
if (testCase.isExpectSuccess()) {
assertEquals(0, exitCode, testCase.getTestDescription());
} else {
assertNotEquals(0, exitCode, testCase.getTestDescription());
}
}
))
.map(TestSuiteTestRunner::toDynamicTest)
.collect(Collectors.toList());
}
public static DynamicTest toDynamicTest(TestCase testCase) {
return DynamicTest.dynamicTest(testCase.getTestTitle(), () -> {
String mail = testCase.getLookupMailAddress();
int exitCode = WKDCLI.execute(new String[] {
"fetch", "--armor", mail
});
if (testCase.isExpectSuccess()) {
assertEquals(0, exitCode, testCase.getTestDescription());
} else {
assertNotEquals(0, exitCode, testCase.getTestDescription());
}
});
}
}

View File

@ -16,7 +16,7 @@ public class CertificateAndUserIds {
private final Certificate certificate;
private final List<String> userIds;
public CertificateAndUserIds(Certificate certificate, List<String> userIds) {
this.certificate = certificate;
this.userIds = userIds;

View File

@ -0,0 +1,10 @@
// SPDX-FileCopyrightText: 2022 Paul Schaub <vanitasvitae@fsfe.org>
//
// SPDX-License-Identifier: Apache-2.0
/**
* Classes related to the certificate discovery part of the WKD spec.
*
* @see <a href="https://datatracker.ietf.org/doc/draft-koch-openpgp-webkey-service/">OpenPGP Web Key Directory</a>
*/
package pgp.wkd.discovery;