Search in sources :

Example 11 with PluginFactory

use of io.cucumber.core.plugin.PluginFactory in project cucumber-jvm by cucumber.

the class CommandlineOptionsParserTest method set_monochrome_on_color_aware_formatters.

@Test
void set_monochrome_on_color_aware_formatters() {
    RuntimeOptions options = parser.parse("--monochrome", "--plugin", AwareFormatter.class.getName()).build();
    Plugins plugins = new Plugins(new PluginFactory(), options);
    plugins.setEventBusOnEventListenerPlugins(new TimeServiceEventBus(Clock.systemUTC(), UUID::randomUUID));
    AwareFormatter formatter = (AwareFormatter) plugins.getPlugins().get(0);
    assertThat(formatter.isMonochrome(), is(true));
}
Also used : TimeServiceEventBus(io.cucumber.core.runtime.TimeServiceEventBus) PluginFactory(io.cucumber.core.plugin.PluginFactory) Plugins(io.cucumber.core.plugin.Plugins) Test(org.junit.jupiter.api.Test)

Example 12 with PluginFactory

use of io.cucumber.core.plugin.PluginFactory in project cucumber-jvm by cucumber.

the class CommandlineOptionsParserTest method creates_html_formatter.

@Test
void creates_html_formatter() {
    RuntimeOptions options = parser.parse("--plugin", "html:target/deeply/nested.html", "--glue", "somewhere").build();
    Plugins plugins = new Plugins(new PluginFactory(), options);
    plugins.setEventBusOnEventListenerPlugins(new TimeServiceEventBus(Clock.systemUTC(), UUID::randomUUID));
    assertThat(plugins.getPlugins().get(0).getClass().getName(), is("io.cucumber.core.plugin.HtmlFormatter"));
}
Also used : TimeServiceEventBus(io.cucumber.core.runtime.TimeServiceEventBus) PluginFactory(io.cucumber.core.plugin.PluginFactory) Plugins(io.cucumber.core.plugin.Plugins) Test(org.junit.jupiter.api.Test)

Example 13 with PluginFactory

use of io.cucumber.core.plugin.PluginFactory in project cucumber-jvm by cucumber.

the class CucumberOptionsAnnotationParserTest method inherit_plugin_from_baseclass.

@Test
void inherit_plugin_from_baseclass() {
    RuntimeOptions runtimeOptions = parser().parse(SubClassWithFormatter.class).build();
    Plugins plugins = new Plugins(new PluginFactory(), runtimeOptions);
    plugins.setEventBusOnEventListenerPlugins(new TimeServiceEventBus(Clock.systemUTC(), UUID::randomUUID));
    List<Plugin> pluginList = plugins.getPlugins();
    assertAll(() -> assertPluginExists(pluginList, HtmlFormatter.class.getName()), () -> assertPluginExists(pluginList, PrettyFormatter.class.getName()));
}
Also used : TimeServiceEventBus(io.cucumber.core.runtime.TimeServiceEventBus) PluginFactory(io.cucumber.core.plugin.PluginFactory) Plugins(io.cucumber.core.plugin.Plugins) Plugin(io.cucumber.plugin.Plugin) Test(org.junit.jupiter.api.Test)

Aggregations

PluginFactory (io.cucumber.core.plugin.PluginFactory)13 Plugins (io.cucumber.core.plugin.Plugins)13 TimeServiceEventBus (io.cucumber.core.runtime.TimeServiceEventBus)13 Test (org.junit.jupiter.api.Test)12 EventBus (io.cucumber.core.eventbus.EventBus)1 BackendServiceLoader (io.cucumber.core.runtime.BackendServiceLoader)1 BackendSupplier (io.cucumber.core.runtime.BackendSupplier)1 CucumberExecutionContext (io.cucumber.core.runtime.CucumberExecutionContext)1 ExitStatus (io.cucumber.core.runtime.ExitStatus)1 ObjectFactoryServiceLoader (io.cucumber.core.runtime.ObjectFactoryServiceLoader)1 ObjectFactorySupplier (io.cucumber.core.runtime.ObjectFactorySupplier)1 RunnerSupplier (io.cucumber.core.runtime.RunnerSupplier)1 SingletonObjectFactorySupplier (io.cucumber.core.runtime.SingletonObjectFactorySupplier)1 SingletonRunnerSupplier (io.cucumber.core.runtime.SingletonRunnerSupplier)1 ThreadLocalObjectFactorySupplier (io.cucumber.core.runtime.ThreadLocalObjectFactorySupplier)1 ThreadLocalRunnerSupplier (io.cucumber.core.runtime.ThreadLocalRunnerSupplier)1 Plugin (io.cucumber.plugin.Plugin)1