mirror of
https://codeberg.org/PGPainless/sop-java.git
synced 2024-11-22 07:12:04 +01:00
external-sop: Fix error code mapping of new exceptions
This commit is contained in:
parent
42bd8f06a4
commit
d53776dfc8
2 changed files with 17 additions and 0 deletions
|
@ -267,6 +267,14 @@ public class ExternalSOP implements SOP {
|
|||
throw new SOPGPException.KeyCannotSign("External SOP backend reported error KeyCannotSign (" +
|
||||
exitCode + "):\n" + errorMessage);
|
||||
|
||||
case SOPGPException.IncompatibleOptions.EXIT_CODE:
|
||||
throw new SOPGPException.IncompatibleOptions("External SOP backend reported error IncompatibleOptions (" +
|
||||
exitCode + "):\n" + errorMessage);
|
||||
|
||||
case SOPGPException.UnsupportedProfile.EXIT_CODE:
|
||||
throw new SOPGPException.UnsupportedProfile("External SOP backend reported error UnsupportedProfile (" +
|
||||
exitCode + "):\n" + errorMessage);
|
||||
|
||||
default:
|
||||
throw new RuntimeException("External SOP backend reported unknown exit code (" +
|
||||
exitCode + "):\n" + errorMessage);
|
||||
|
|
|
@ -9,12 +9,14 @@ import org.junit.jupiter.params.provider.Arguments;
|
|||
import org.junit.jupiter.params.provider.MethodSource;
|
||||
import sop.Profile;
|
||||
import sop.SOP;
|
||||
import sop.exception.SOPGPException;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||
|
||||
public class ListProfilesTest extends AbstractSOPTest {
|
||||
|
||||
|
@ -30,4 +32,11 @@ public class ListProfilesTest extends AbstractSOPTest {
|
|||
assertFalse(profiles.isEmpty());
|
||||
}
|
||||
|
||||
@ParameterizedTest
|
||||
@MethodSource("provideInstances")
|
||||
public void listUnsupportedProfiles(SOP sop) throws IOException {
|
||||
assertThrows(SOPGPException.UnsupportedProfile.class, () -> sop
|
||||
.listProfiles()
|
||||
.subcommand("invalid"));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue