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.BeforeAll;
import org.junit.jupiter.api.DynamicTest; import org.junit.jupiter.api.DynamicTest;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestFactory; 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.WKDCLI;
import pgp.wkd.cli.command.Fetch; import pgp.wkd.cli.command.Fetch;
import pgp.wkd.test_suite.TestCase; import pgp.wkd.test_suite.TestCase;
@ -26,7 +23,6 @@ import static org.junit.jupiter.api.Assertions.assertNotEquals;
public class TestSuiteTestRunner { public class TestSuiteTestRunner {
private static final Logger LOGGER = LoggerFactory.getLogger(TestSuiteTestRunner.class);
private static TestSuite suite; private static TestSuite suite;
@BeforeAll @BeforeAll
@ -49,22 +45,23 @@ public class TestSuiteTestRunner {
public Iterable<DynamicTest> testsFromTestSuite() { public Iterable<DynamicTest> testsFromTestSuite() {
return suite.getTestCases() return suite.getTestCases()
.stream() .stream()
.map(testCase -> DynamicTest.dynamicTest( .map(TestSuiteTestRunner::toDynamicTest)
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());
}
}
))
.collect(Collectors.toList()); .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 Certificate certificate;
private final List<String> userIds; private final List<String> userIds;
public CertificateAndUserIds(Certificate certificate, List<String> userIds) { public CertificateAndUserIds(Certificate certificate, List<String> userIds) {
this.certificate = certificate; this.certificate = certificate;
this.userIds = userIds; 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;