Search in sources :

Example 6 with PluginOption

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)));
}
Also used : PluginOption(io.cucumber.core.options.PluginOption) Test(org.junit.jupiter.api.Test)

Example 7 with PluginOption

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()));
}
Also used : PluginOption(io.cucumber.core.options.PluginOption) Test(org.junit.jupiter.api.Test)

Example 8 with PluginOption

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]")));
}
Also used : PluginOption(io.cucumber.core.options.PluginOption) CucumberException(io.cucumber.core.exception.CucumberException) Executable(org.junit.jupiter.api.function.Executable) Test(org.junit.jupiter.api.Test)

Example 9 with PluginOption

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));
}
Also used : PluginOption(io.cucumber.core.options.PluginOption) Test(org.junit.jupiter.api.Test)

Example 10 with PluginOption

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")));
}
Also used : PluginOption(io.cucumber.core.options.PluginOption) CucumberException(io.cucumber.core.exception.CucumberException) Test(org.junit.jupiter.api.Test)

Aggregations

PluginOption (io.cucumber.core.options.PluginOption)23 Test (org.junit.jupiter.api.Test)23 CucumberException (io.cucumber.core.exception.CucumberException)5 Path (java.nio.file.Path)4 Executable (org.junit.jupiter.api.function.Executable)4 EventBus (io.cucumber.core.eventbus.EventBus)1 ClockStub (io.cucumber.core.runner.ClockStub)1 TimeServiceEventBus (io.cucumber.core.runtime.TimeServiceEventBus)1 PickleStepTestStep (io.cucumber.plugin.event.PickleStepTestStep)1 Result (io.cucumber.plugin.event.Result)1 TestCase (io.cucumber.plugin.event.TestCase)1 TestStepFinished (io.cucumber.plugin.event.TestStepFinished)1 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1 File (java.io.File)1 OutputStream (java.io.OutputStream)1 PrintStream (java.io.PrintStream)1 UUID (java.util.UUID)1