Search in sources :

Example 26 with TimeServiceEventBus

use of io.cucumber.core.runtime.TimeServiceEventBus in project cucumber-jvm by cucumber.

the class CommandlineOptionsParserTest method creates_no_formatter_by_default.

@Test
void creates_no_formatter_by_default() {
    RuntimeOptions options = parser.parse().build();
    Plugins plugins = new Plugins(new PluginFactory(), options);
    plugins.setEventBusOnEventListenerPlugins(new TimeServiceEventBus(Clock.systemUTC(), UUID::randomUUID));
    assertThat(plugins.getPlugins(), is(empty()));
}
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 27 with TimeServiceEventBus

use of io.cucumber.core.runtime.TimeServiceEventBus in project cucumber-jvm by cucumber.

the class CommandlineOptionsParserTest method creates_default_summary_printer_if_not_disabled.

@Test
void creates_default_summary_printer_if_not_disabled() {
    RuntimeOptions options = parser.parse().addDefaultSummaryPrinterIfNotDisabled().build();
    Plugins plugins = new Plugins(new PluginFactory(), options);
    plugins.setEventBusOnEventListenerPlugins(new TimeServiceEventBus(Clock.systemUTC(), UUID::randomUUID));
    assertThat(plugins.getPlugins(), hasItem(plugin("io.cucumber.core.plugin.DefaultSummaryPrinter")));
}
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 28 with TimeServiceEventBus

use of io.cucumber.core.runtime.TimeServiceEventBus in project cucumber-jvm by cucumber.

the class CommandlineOptionsParserTest method replaces_incompatible_intellij_idea_plugin.

@Test
void replaces_incompatible_intellij_idea_plugin() {
    RuntimeOptions options = parser.parse("--plugin", "org.jetbrains.plugins.cucumber.java.run.CucumberJvm3SMFormatter").build();
    Plugins plugins = new Plugins(new PluginFactory(), options);
    plugins.setEventBusOnEventListenerPlugins(new TimeServiceEventBus(Clock.systemUTC(), UUID::randomUUID));
    assertThat(plugins.getPlugins(), not(hasItem(plugin("io.cucumber.core.plugin.PrettyPrinter"))));
}
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 29 with TimeServiceEventBus

use of io.cucumber.core.runtime.TimeServiceEventBus in project cucumber-jvm by cucumber.

the class CommandlineOptionsParserTest method disables_default_summary_printer.

@Test
void disables_default_summary_printer() {
    RuntimeOptions options = parser.parse("--no-summary", "--glue", "somewhere").addDefaultSummaryPrinterIfNotDisabled().build();
    Plugins plugins = new Plugins(new PluginFactory(), options);
    plugins.setEventBusOnEventListenerPlugins(new TimeServiceEventBus(Clock.systemUTC(), UUID::randomUUID));
    assertAll(() -> assertThat(plugins.getPlugins(), not(hasItem(plugin("io.cucumber.core.plugin.DefaultSummaryPrinter")))));
}
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 30 with TimeServiceEventBus

use of io.cucumber.core.runtime.TimeServiceEventBus in project cucumber-jvm by cucumber.

the class CommandlineOptionsParserTest method set_strict_on_strict_aware_formatters.

@Test
void set_strict_on_strict_aware_formatters() {
    RuntimeOptions options = parser.parse("--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.isStrict(), 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)

Aggregations

TimeServiceEventBus (io.cucumber.core.runtime.TimeServiceEventBus)80 Test (org.junit.jupiter.api.Test)77 UUID (java.util.UUID)63 ByteArrayOutputStream (java.io.ByteArrayOutputStream)59 Feature (io.cucumber.core.gherkin.Feature)55 StubBackendSupplier (io.cucumber.core.runtime.StubBackendSupplier)53 StubFeatureSupplier (io.cucumber.core.runtime.StubFeatureSupplier)52 StubStepDefinition (io.cucumber.core.backend.StubStepDefinition)46 StubHookDefinition (io.cucumber.core.backend.StubHookDefinition)19 StepDurationTimeService (io.cucumber.core.runner.StepDurationTimeService)19 DocString (io.cucumber.docstring.DocString)17 PluginFactory (io.cucumber.core.plugin.PluginFactory)13 Plugins (io.cucumber.core.plugin.Plugins)13 PrintStream (java.io.PrintStream)12 EventBus (io.cucumber.core.eventbus.EventBus)11 RuntimeOptionsBuilder (io.cucumber.core.options.RuntimeOptionsBuilder)6 StubPendingException (io.cucumber.core.backend.StubPendingException)4 TestCaseState (io.cucumber.core.backend.TestCaseState)4 TestFeatureParser (io.cucumber.core.feature.TestFeatureParser)4 DataTable (io.cucumber.datatable.DataTable)4