Skip to content

Commit

Permalink
Add tests for getOutput
Browse files Browse the repository at this point in the history
  • Loading branch information
vanitasvitae committed Aug 1, 2022
1 parent fe729c4 commit c4cbf8f
Showing 1 changed file with 33 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -123,4 +123,37 @@ public void getInput_notAFile() throws IOException {

assertThrows(SOPGPException.MissingInput.class, () -> abstractCmd.getInput(directory.getAbsolutePath()));
}

@Test
public void getOutput_NullIllegalArg() {
assertThrows(IllegalArgumentException.class, () -> abstractCmd.getOutput(null));
}

@Test
public void getOutput_EmptyIllegalArg() {
assertThrows(IllegalArgumentException.class, () -> abstractCmd.getOutput(""));
}

@Test
public void getOutput_BlankIllegalArg() {
assertThrows(IllegalArgumentException.class, () -> abstractCmd.getOutput(" "));
}

@Test
public void getOutput_envUnsupportedSpecialPrefix() {
assertThrows(SOPGPException.UnsupportedSpecialPrefix.class, () -> abstractCmd.getOutput("@ENV:IS_ILLEGAL"));
}

@Test
public void getOutput_fdUnsupportedSpecialPrefix() {
assertThrows(SOPGPException.UnsupportedSpecialPrefix.class, () -> abstractCmd.getOutput("@FD:IS_ILLEGAL"));
}

@Test
public void getOutput_fileExists() throws IOException {
File testFile = TestFileUtil.createTempDir();
testFile.deleteOnExit();

assertThrows(SOPGPException.OutputExists.class, () -> abstractCmd.getOutput(testFile.getAbsolutePath()));
}
}

0 comments on commit c4cbf8f

Please sign in to comment.