use of io.vertx.core.cli.CommandLine in project vert.x by eclipse.
the class DefaultCommandTest method testCWD.
@Test
public void testCWD() throws CLIException {
CLI cli = CLIConfigurator.define(command.getClass());
CommandLine evaluatedCLI = parse(cli, "--name=vert.x");
CLIConfigurator.inject(evaluatedCLI, command);
assertThat(command.getCwd()).isEqualTo(new File("."));
evaluatedCLI = parse(cli, "--cwd=target", "--name=vert.x");
CLIConfigurator.inject(evaluatedCLI, command);
assertThat(command.getCwd()).isEqualTo(new File("target"));
}
use of io.vertx.core.cli.CommandLine in project vert.x by eclipse.
the class DefaultCommandTest method testSystemProperties.
@Test
public void testSystemProperties() throws CLIException {
CLI cli = CLIConfigurator.define(command.getClass());
VertxCommandLauncher launcher = new VertxCommandLauncher();
CommandLine evaluatedCLI = parse(cli, "--name=vert.x", "-Dfoo=bar", "--systemProp=x=y");
CLIConfigurator.inject(evaluatedCLI, command);
command.setUp(new ExecutionContext(command, launcher, evaluatedCLI));
assertThat(System.getProperty("foo")).isEqualToIgnoringCase("bar");
assertThat(System.getProperty("x")).isEqualToIgnoringCase("y");
command.tearDown();
// System properties are not removed by the tearDown.
assertThat(System.getProperty("foo")).isEqualToIgnoringCase("bar");
assertThat(System.getProperty("x")).isEqualToIgnoringCase("y");
}
Aggregations