Skip to content

Commit cb5de93

Browse files
committed
chore: add better test coverage
Signed-off-by: Ruben Romero Montes <rromerom@redhat.com>
1 parent cfeff6e commit cb5de93

3 files changed

Lines changed: 648 additions & 187 deletions

File tree

src/main/java/com/redhat/exhort/cli/App.java

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,10 @@ private static CliArgs parseArgs(String[] args) {
8181

8282
Path path = validateFile(args[1]);
8383

84-
OutputFormat outputFormat = parseOutputFormat(command, args[2]);
84+
OutputFormat outputFormat = OutputFormat.JSON;
85+
if (args.length == 3) {
86+
outputFormat = parseOutputFormat(command, args[2]);
87+
}
8588

8689
return new CliArgs(command, path, outputFormat);
8790
}
@@ -99,10 +102,6 @@ private static Command parseCommand(String commandStr) {
99102
}
100103

101104
private static OutputFormat parseOutputFormat(Command command, String formatArg) {
102-
if (formatArg == null) {
103-
return OutputFormat.JSON;
104-
}
105-
106105
switch (formatArg) {
107106
case "--summary":
108107
return OutputFormat.SUMMARY;
@@ -125,9 +124,6 @@ private static Path validateFile(String filePath) {
125124
if (!Files.isRegularFile(path)) {
126125
throw new IllegalArgumentException("File is not a regular file: " + filePath);
127126
}
128-
if (!Files.isReadable(path)) {
129-
throw new IllegalArgumentException("File is not readable: " + filePath);
130-
}
131127
return path;
132128
}
133129

src/main/java/com/redhat/exhort/cli/AppUtils.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,6 @@ public static void exitWithError() {
2020
System.exit(1);
2121
}
2222

23-
public static void exitWithSuccess() {
24-
System.exit(0);
25-
}
26-
2723
public static void printLine(String message) {
2824
System.out.println(message);
2925
}

0 commit comments

Comments
 (0)