mirror of
https://codeberg.org/PGPainless/sop-java.git
synced 2025-09-14 12:49:44 +02:00
Reference exit codes directly in junit tests
This commit is contained in:
parent
0c24c2301d
commit
61ab35ad52
11 changed files with 72 additions and 63 deletions
|
@ -14,6 +14,7 @@ import java.util.List;
|
|||
import com.ginsberg.junit.exit.ExpectSystemExitWithStatus;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import sop.SOP;
|
||||
import sop.exception.SOPGPException;
|
||||
import sop.operation.Armor;
|
||||
import sop.operation.Dearmor;
|
||||
import sop.operation.Decrypt;
|
||||
|
@ -30,7 +31,7 @@ import sop.operation.Version;
|
|||
public class SOPTest {
|
||||
|
||||
@Test
|
||||
@ExpectSystemExitWithStatus(69)
|
||||
@ExpectSystemExitWithStatus(SOPGPException.UnsupportedSubcommand.EXIT_CODE)
|
||||
public void assertExitOnInvalidSubcommand() {
|
||||
SOP sop = mock(SOP.class);
|
||||
SopCLI.setSopInstance(sop);
|
||||
|
@ -125,7 +126,8 @@ public class SOPTest {
|
|||
|
||||
for (String[] command : commands) {
|
||||
int exit = SopCLI.execute(command);
|
||||
assertEquals(69, exit, "Unexpected exit code for non-implemented command " + Arrays.toString(command) + ": " + exit);
|
||||
assertEquals(SOPGPException.UnsupportedSubcommand.EXIT_CODE, exit,
|
||||
"Unexpected exit code for non-implemented command " + Arrays.toString(command) + ": " + exit);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue