1
0
Fork 0
mirror of https://github.com/pgpainless/pgpainless.git synced 2025-12-18 02:01:08 +01:00

Update SOP implementation to the latest spec version

See https://datatracker.ietf.org/doc/html/draft-dkg-openpgp-stateless-cli-03
This commit is contained in:
Paul Schaub 2022-01-07 14:28:36 +01:00
parent 09026f56b0
commit 8e6e5cfbb4
Signed by: vanitasvitae
GPG key ID: 62BEE9264BF17311
21 changed files with 348 additions and 112 deletions

View file

@ -19,7 +19,8 @@ import java.io.OutputStream;
import com.ginsberg.junit.exit.ExpectSystemExitWithStatus;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import sop.Ready;
import sop.MicAlg;
import sop.ReadyWithResult;
import sop.SOP;
import sop.cli.picocli.SopCLI;
import sop.exception.SOPGPException;
@ -33,10 +34,10 @@ public class SignCmdTest {
@BeforeEach
public void mockComponents() throws IOException, SOPGPException.ExpectedText {
sign = mock(Sign.class);
when(sign.data((InputStream) any())).thenReturn(new Ready() {
when(sign.data((InputStream) any())).thenReturn(new ReadyWithResult<MicAlg>() {
@Override
public void writeTo(OutputStream outputStream) {
public MicAlg writeTo(OutputStream outputStream) {
return MicAlg.fromHashAlgorithmId(10);
}
});
@ -109,9 +110,9 @@ public class SignCmdTest {
@Test
@ExpectSystemExitWithStatus(1)
public void data_ioExceptionCausesExit1() throws IOException, SOPGPException.ExpectedText {
when(sign.data((InputStream) any())).thenReturn(new Ready() {
when(sign.data((InputStream) any())).thenReturn(new ReadyWithResult<MicAlg>() {
@Override
public void writeTo(OutputStream outputStream) throws IOException {
public MicAlg writeTo(OutputStream outputStream) throws IOException {
throw new IOException();
}
});