use of org.junit.jupiter.api.function.Executable in project cucumber-jvm by cucumber.
the class RuntimeTest method should_fail_on_event_listener_exception_when_running_in_parallel.
@Test
void should_fail_on_event_listener_exception_when_running_in_parallel() {
Feature feature1 = TestFeatureParser.parse("path/test.feature", "" + "Feature: feature name 1\n" + " Scenario: scenario_1 name\n" + " Given first step\n" + " Scenario: scenario_2 name\n" + " Given first step\n");
Feature feature2 = TestFeatureParser.parse("path/test2.feature", "" + "Feature: feature name 2\n" + " Scenario: scenario_2 name\n" + " Given first step\n");
ConcurrentEventListener brokenEventListener = publisher -> publisher.registerHandlerFor(TestStepFinished.class, (TestStepFinished event) -> {
throw new RuntimeException("This exception is expected");
});
Executable testMethod = () -> Runtime.builder().withFeatureSupplier(new StubFeatureSupplier(feature1, feature2)).withAdditionalPlugins(brokenEventListener).withRuntimeOptions(new RuntimeOptionsBuilder().setThreads(2).build()).build().run();
CompositeCucumberException actualThrown = assertThrows(CompositeCucumberException.class, testMethod);
assertThat(actualThrown.getMessage(), is(equalTo("There were 3 exceptions. The details are in the stacktrace below.")));
assertThat(actualThrown.getSuppressed(), is(arrayWithSize(3)));
}
use of org.junit.jupiter.api.function.Executable in project cucumber-jvm by cucumber.
the class PluginFactoryTest method fails_to_instantiate_plugin_that_wants_a_file_without_file_arg.
@Test
void fails_to_instantiate_plugin_that_wants_a_file_without_file_arg() {
PluginOption option = parse(WantsFile.class.getName());
Executable testMethod = () -> fc.create(option);
CucumberException exception = assertThrows(CucumberException.class, testMethod);
assertThat(exception.getMessage(), is(equalTo("You must supply an output argument to io.cucumber.core.plugin.PluginFactoryTest$WantsFile. Like so: io.cucumber.core.plugin.PluginFactoryTest$WantsFile:DIR|FILE|URL")));
}
use of org.junit.jupiter.api.function.Executable 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 org.junit.jupiter.api.function.Executable in project cucumber-jvm by cucumber.
the class GluePathTest method absolute_windows_path_form_is_not_valid.
@Test
@EnabledOnOs(OS.WINDOWS)
void absolute_windows_path_form_is_not_valid() {
Executable testMethod = () -> GluePath.parse("C:\\com\\example\\app");
IllegalArgumentException actualThrown = assertThrows(IllegalArgumentException.class, testMethod);
assertThat("Unexpected exception message", actualThrown.getMessage(), is(equalTo("The glue path must have a classpath scheme C:/com/example/app")));
}
use of org.junit.jupiter.api.function.Executable in project cucumber-jvm by cucumber.
the class GluePathTest method glue_path_must_have_class_path_scheme.
@Test
void glue_path_must_have_class_path_scheme() {
Executable testMethod = () -> GluePath.parse("file:com/example/app");
IllegalArgumentException actualThrown = assertThrows(IllegalArgumentException.class, testMethod);
assertThat("Unexpected exception message", actualThrown.getMessage(), is(equalTo("The glue path must have a classpath scheme file:com/example/app")));
}
Aggregations