use of org.junit.platform.console.options.CommandLineOptionsParser in project junit5 by junit-team.
the class ConsoleLauncher method execute.
@API(status = INTERNAL, since = "1.0")
public static ConsoleLauncherExecutionResult execute(PrintStream out, PrintStream err, String... args) {
CommandLineOptionsParser parser = new JOptSimpleCommandLineOptionsParser();
ConsoleLauncher consoleLauncher = new ConsoleLauncher(parser, out, err);
return consoleLauncher.execute(args);
}
use of org.junit.platform.console.options.CommandLineOptionsParser in project junit5 by junit-team.
the class ConsoleLauncherTests method executeWithUnknownCommandLineOption.
@Test
void executeWithUnknownCommandLineOption() {
CommandLineOptionsParser commandLineOptionsParser = mock(CommandLineOptionsParser.class);
when(commandLineOptionsParser.parse(any())).thenReturn(new CommandLineOptions());
ConsoleLauncher consoleLauncher = new ConsoleLauncher(commandLineOptionsParser, printSink, printSink);
int exitCode = consoleLauncher.execute("--all").getExitCode();
assertEquals(-1, exitCode);
verify(commandLineOptionsParser).parse("--all");
}
use of org.junit.platform.console.options.CommandLineOptionsParser in project junit5 by junit-team.
the class ConsoleLauncherTests method executeWithSupportedCommandLineOption.
@Test
void executeWithSupportedCommandLineOption() {
CommandLineOptionsParser commandLineOptionsParser = mock(CommandLineOptionsParser.class);
when(commandLineOptionsParser.parse(any())).thenReturn(new CommandLineOptions());
ConsoleLauncher consoleLauncher = new ConsoleLauncher(commandLineOptionsParser, printSink, printSink);
int exitCode = consoleLauncher.execute("--scan-classpath").getExitCode();
assertEquals(-1, exitCode);
verify(commandLineOptionsParser).parse("--scan-classpath");
}
use of org.junit.platform.console.options.CommandLineOptionsParser in project junit5 by junit-team.
the class ConsoleLauncherTests method displayHelp.
@Test
void displayHelp() {
CommandLineOptions options = new CommandLineOptions();
options.setDisplayHelp(true);
CommandLineOptionsParser commandLineOptionsParser = mock(CommandLineOptionsParser.class);
when(commandLineOptionsParser.parse(any())).thenReturn(options);
ConsoleLauncher consoleLauncher = new ConsoleLauncher(commandLineOptionsParser, printSink, printSink);
int exitCode = consoleLauncher.execute("--help").getExitCode();
assertEquals(0, exitCode);
verify(commandLineOptionsParser).parse("--help");
}
Aggregations