Search in sources :

Example 16 with PluginOption

use of io.cucumber.core.options.PluginOption in project cucumber-jvm by cucumber.

the class PluginFactoryTest method instantiates_pretty_plugin_with_file_arg.

@Test
void instantiates_pretty_plugin_with_file_arg() throws IOException {
    PluginOption option = parse("pretty:" + tmp.resolve("out.txt").toUri().toURL());
    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 17 with PluginOption

use of io.cucumber.core.options.PluginOption in project cucumber-jvm by cucumber.

the class PluginFactoryTest method instantiates_usage_plugin_without_file_arg.

@Test
void instantiates_usage_plugin_without_file_arg() {
    PluginOption option = parse("usage");
    plugin = fc.create(option);
    assertThat(plugin.getClass(), is(equalTo(UsageFormatter.class)));
}
Also used : PluginOption(io.cucumber.core.options.PluginOption) Test(org.junit.jupiter.api.Test)

Example 18 with PluginOption

use of io.cucumber.core.options.PluginOption in project cucumber-jvm by cucumber.

the class PluginFactoryTest method fails_to_instantiate_plugin_that_wants_too_much.

@Test
void fails_to_instantiate_plugin_that_wants_too_much() {
    PluginOption option = parse(WantsTooMuch.class.getName());
    Executable testMethod = () -> fc.create(option);
    CucumberException exception = assertThrows(CucumberException.class, testMethod);
    assertThat(exception.getMessage(), is(equalTo("class io.cucumber.core.plugin.PluginFactoryTest$WantsTooMuch must have at least one empty constructor or a 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 19 with PluginOption

use of io.cucumber.core.options.PluginOption in project cucumber-jvm by cucumber.

the class PluginFactoryTest method instantiates_wants_nothing_plugin.

@Test
void instantiates_wants_nothing_plugin() {
    PluginOption option = parse(WantsNothing.class.getName());
    WantsNothing plugin = (WantsNothing) fc.create(option);
    assertThat(plugin.getClass(), is(equalTo(WantsNothing.class)));
}
Also used : PluginOption(io.cucumber.core.options.PluginOption) Test(org.junit.jupiter.api.Test)

Example 20 with PluginOption

use of io.cucumber.core.options.PluginOption in project cucumber-jvm by cucumber.

the class PluginFactoryTest method creates_parent_directories.

@Test
void creates_parent_directories() {
    Path file = tmp.resolve("target/cucumber/reports/rerun.txt");
    PluginOption option = parse("rerun:" + file);
    assertAll(() -> assertThat(Files.exists(file), is(false)), () -> assertDoesNotThrow(() -> {
        Object plugin = fc.create(option);
        releaseResources(plugin);
    }), () -> assertThat(Files.exists(file), is(true)));
}
Also used : Path(java.nio.file.Path) PluginOption(io.cucumber.core.options.PluginOption) 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