use of io.cucumber.core.options.PluginOption in project cucumber-jvm by cucumber.
the class PluginFactoryTest method fails_to_instantiate_plugin_that_declares_two_single_arg_constructors_when_no_argument_specified.
@Test
void fails_to_instantiate_plugin_that_declares_two_single_arg_constructors_when_no_argument_specified() {
PluginOption option = parse(WantsFileOrURL.class.getName());
Executable testMethod = () -> fc.create(option);
CucumberException exception = assertThrows(CucumberException.class, testMethod);
assertThat(exception.getMessage(), is(equalTo("You must supply an output argument to io.cucumber.core.plugin.PluginFactoryTest$WantsFileOrURL. Like so: io.cucumber.core.plugin.PluginFactoryTest$WantsFileOrURL:DIR|FILE|URL")));
}
use of io.cucumber.core.options.PluginOption in project cucumber-jvm by cucumber.
the class PluginFactoryTest method instantiates_rerun_plugin_with_file_arg.
@Test
void instantiates_rerun_plugin_with_file_arg() {
PluginOption option = parse("rerun:" + tmp.resolve("rerun.txt"));
plugin = fc.create(option);
assertThat(plugin.getClass(), is(equalTo(RerunFormatter.class)));
}
use of io.cucumber.core.options.PluginOption in project cucumber-jvm by cucumber.
the class PluginFactoryTest method cant_create_plugin_when_file_is_a_directory.
@Test
void cant_create_plugin_when_file_is_a_directory() {
Path jsonReport = tmp.resolve("target/cucumber/reports/cucumber.json");
PluginOption jsonOption = parse("json:" + jsonReport);
plugin = fc.create(jsonOption);
Path htmlReport = tmp.resolve("target/cucumber/reports");
PluginOption htmlOption = parse("html:" + htmlReport);
IllegalArgumentException exception = assertThrows(IllegalArgumentException.class, () -> fc.create(htmlOption));
assertThat(exception.getMessage(), is(equalTo("Couldn't create a file output stream for '" + htmlReport + "'.\n" + "Make sure the the file isn't a directory.\n" + "\n" + "Note: This usually happens when plugins write to colliding paths.\n" + "For example: 'json:target/cucumber/report.json, html:target/cucumber'\n" + "You can fix this by making the paths do no collide.\n" + "For example: 'json:target/cucumber/report.json, html:target/cucumber/report.html'\n" + "The details are in the stack trace below:")));
}
use of io.cucumber.core.options.PluginOption in project cucumber-jvm by cucumber.
the class PluginFactoryTest method instantiates_custom_file_plugin.
@Test
void instantiates_custom_file_plugin() {
PluginOption option = parse(WantsFile.class.getName() + ":halp.txt");
WantsFile plugin = (WantsFile) fc.create(option);
assertThat(plugin.out, is(equalTo(new File("halp.txt"))));
}
use of io.cucumber.core.options.PluginOption in project cucumber-jvm by cucumber.
the class PluginFactoryTest method instantiates_file_or_empty_arg_plugin_with_arg.
@Test
void instantiates_file_or_empty_arg_plugin_with_arg() {
PluginOption option = parse(WantsFileOrEmpty.class.getName() + ":" + tmp.resolve("out.txt"));
WantsFileOrEmpty plugin = (WantsFileOrEmpty) fc.create(option);
assertThat(plugin.out, is(notNullValue()));
}
Aggregations