Skip to content

Commit

Permalink
Added some simple tests for automatic mode selection
Browse files Browse the repository at this point in the history
  • Loading branch information
TwoOfTwelve committed Feb 18, 2025
1 parent 8ed5b54 commit 75a8575
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions cli/src/test/java/de/jplag/cli/ModeTest.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package de.jplag.cli;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertThrowsExactly;

import java.io.File;
Expand Down Expand Up @@ -53,6 +54,18 @@ void testViewWithMultipleFiles() {
});
}

@Test
void testImplicitView() throws IOException, ExitException {
CliInputHandler inputHandler = this.runCli(args -> args.with(CliArgument.RESULT_FILE, "result.zip")).inputHandler();
assertEquals(new File("result.zip"), inputHandler.getFileForViewMode());
}

@Test
void testImplicitReportViewer() throws IOException, ExitException {
CliInputHandler inputHandler = this.runCli().inputHandler();
assertNull(inputHandler.getFileForViewMode());
}

@Override
public void addDefaultParameters() {
// prevents the submission directory from being added to the parameters automatically
Expand Down

0 comments on commit 75a8575

Please sign in to comment.