use of io.cucumber.core.options.PluginOption in project cucumber-jvm by cucumber.
the class PluginFactoryTest method instantiates_pretty_plugin_without_file_arg.
@Test
void instantiates_pretty_plugin_without_file_arg() {
PluginOption option = parse("pretty");
plugin = fc.create(option);
assertThat(plugin.getClass(), is(equalTo(PrettyFormatter.class)));
}
use of io.cucumber.core.options.PluginOption in project cucumber-jvm by cucumber.
the class PluginFactoryTest method instantiates_file_or_empty_arg_plugin_without_arg.
@Test
void instantiates_file_or_empty_arg_plugin_without_arg() {
PluginOption option = parse(WantsFileOrEmpty.class.getName());
WantsFileOrEmpty plugin = (WantsFileOrEmpty) fc.create(option);
assertThat(plugin.out, is(nullValue()));
}
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_argument_specified.
@Test
void fails_to_instantiate_plugin_that_declares_two_single_arg_constructors_when_argument_specified() {
PluginOption option = parse(WantsFileOrURL.class.getName() + ":some_arg");
Executable testMethod = () -> fc.create(option);
CucumberException exception = assertThrows(CucumberException.class, testMethod);
assertThat(exception.getMessage(), is(equalTo("class io.cucumber.core.plugin.PluginFactoryTest$WantsFileOrURL must have exactly one constructor that declares a single parameter of one of: [class java.lang.String, class java.io.File, class java.net.URI, class java.net.URL, class java.io.OutputStream, interface java.lang.Appendable]")));
}
use of io.cucumber.core.options.PluginOption in project cucumber-jvm by cucumber.
the class PluginFactoryTest method fails_to_instantiates_html_plugin_with_dir_arg.
@Test
void fails_to_instantiates_html_plugin_with_dir_arg() {
PluginOption option = parse("html:" + tmp.toAbsolutePath());
assertThrows(IllegalArgumentException.class, () -> fc.create(option));
}
use of io.cucumber.core.options.PluginOption in project cucumber-jvm by cucumber.
the class PluginFactoryTest method instantiates_single_custom_appendable_plugin_with_stdout.
@Test
void instantiates_single_custom_appendable_plugin_with_stdout() {
PluginOption option = parse(WantsOutputStream.class.getName());
WantsOutputStream plugin = (WantsOutputStream) fc.create(option);
assertThat(plugin.printStream, is(not(nullValue())));
CucumberException exception = assertThrows(CucumberException.class, () -> fc.create(option));
assertThat(exception.getMessage(), is(equalTo("Only one plugin can use STDOUT, now both io.cucumber.core.plugin.PluginFactoryTest$WantsOutputStream " + "and io.cucumber.core.plugin.PluginFactoryTest$WantsOutputStream use it. " + "If you use more than one plugin you must specify output path with io.cucumber.core.plugin.PluginFactoryTest$WantsOutputStream:DIR|FILE|URL")));
}
Aggregations