From b855ba976a5e4eb112be5a8b8b1e50aff9e1307e Mon Sep 17 00:00:00 2001 From: "M.P. Korstanje" Date: Fri, 4 Sep 2020 16:57:02 +0200 Subject: [PATCH] [Core] Separate dry-run and skip execution strategies --- .../cucumber/core/runner/ExecutionMode.java | 34 ++++++++ .../core/runner/PickleStepTestStep.java | 17 ++-- .../io/cucumber/core/runner/TestCase.java | 20 +++-- .../io/cucumber/core/runner/TestStep.java | 17 ++-- .../core/plugin/TestNGFormatterTest.java | 12 +-- .../core/runner/HookTestStepTest.java | 23 +++-- .../core/runner/PickleStepTestStepTest.java | 83 ++++++++++++------- .../io/cucumber/core/runner/TestCaseTest.java | 6 +- .../cucumber/spring/TestContextAdaptor.java | 3 +- 9 files changed, 143 insertions(+), 72 deletions(-) create mode 100644 core/src/main/java/io/cucumber/core/runner/ExecutionMode.java diff --git a/core/src/main/java/io/cucumber/core/runner/ExecutionMode.java b/core/src/main/java/io/cucumber/core/runner/ExecutionMode.java new file mode 100644 index 0000000000..16b520eff8 --- /dev/null +++ b/core/src/main/java/io/cucumber/core/runner/ExecutionMode.java @@ -0,0 +1,34 @@ +package io.cucumber.core.runner; + +import io.cucumber.plugin.event.Status; + +enum ExecutionMode { + + RUN { + @Override + Status execute(StepDefinitionMatch stepDefinitionMatch, TestCaseState state) throws Throwable { + stepDefinitionMatch.runStep(state); + return Status.PASSED; + } + + }, + DRY_RUN { + @Override + Status execute(StepDefinitionMatch stepDefinitionMatch, TestCaseState state) throws Throwable { + stepDefinitionMatch.dryRunStep(state); + return Status.PASSED; + } + }, + SKIP { + @Override + Status execute(StepDefinitionMatch stepDefinitionMatch, TestCaseState state) { + return Status.SKIPPED; + } + }; + + abstract Status execute(StepDefinitionMatch stepDefinitionMatch, TestCaseState state) throws Throwable; + + ExecutionMode next(ExecutionMode current) { + return current == SKIP ? current : this; + } +} diff --git a/core/src/main/java/io/cucumber/core/runner/PickleStepTestStep.java b/core/src/main/java/io/cucumber/core/runner/PickleStepTestStep.java index fa54bfd47c..e6e2668e2d 100644 --- a/core/src/main/java/io/cucumber/core/runner/PickleStepTestStep.java +++ b/core/src/main/java/io/cucumber/core/runner/PickleStepTestStep.java @@ -39,20 +39,25 @@ final class PickleStepTestStep extends TestStep implements io.cucumber.plugin.ev } @Override - boolean run(TestCase testCase, EventBus bus, TestCaseState state, boolean skipSteps) { - boolean skipNextStep = skipSteps; + ExecutionMode run(TestCase testCase, EventBus bus, TestCaseState state, ExecutionMode executionMode) { + ExecutionMode nextExecutionMode = executionMode; for (HookTestStep before : beforeStepHookSteps) { - skipNextStep |= before.run(testCase, bus, state, skipSteps); + nextExecutionMode = before + .run(testCase, bus, state, executionMode) + .next(nextExecutionMode); } - skipNextStep |= super.run(testCase, bus, state, skipNextStep); + nextExecutionMode = super.run(testCase, bus, state, nextExecutionMode) + .next(nextExecutionMode); for (HookTestStep after : afterStepHookSteps) { - skipNextStep |= after.run(testCase, bus, state, skipSteps); + nextExecutionMode = after + .run(testCase, bus, state, executionMode) + .next(nextExecutionMode); } - return skipNextStep; + return nextExecutionMode; } List getBeforeStepHookSteps() { diff --git a/core/src/main/java/io/cucumber/core/runner/TestCase.java b/core/src/main/java/io/cucumber/core/runner/TestCase.java index 28b82ac52a..2f24992e40 100644 --- a/core/src/main/java/io/cucumber/core/runner/TestCase.java +++ b/core/src/main/java/io/cucumber/core/runner/TestCase.java @@ -22,6 +22,8 @@ import java.util.List; import java.util.UUID; +import static io.cucumber.core.runner.ExecutionMode.DRY_RUN; +import static io.cucumber.core.runner.ExecutionMode.RUN; import static io.cucumber.core.runner.TestStepResultStatus.from; import static io.cucumber.messages.TimeConversion.javaDurationToDuration; import static io.cucumber.messages.TimeConversion.javaInstantToTimestamp; @@ -32,7 +34,7 @@ final class TestCase implements io.cucumber.plugin.event.TestCase { private final Pickle pickle; private final List testSteps; - private final boolean dryRun; + private final ExecutionMode executionMode; private final List beforeHooks; private final List afterHooks; private final UUID id; @@ -49,7 +51,7 @@ final class TestCase implements io.cucumber.plugin.event.TestCase { this.beforeHooks = beforeHooks; this.afterHooks = afterHooks; this.pickle = pickle; - this.dryRun = dryRun; + this.executionMode = dryRun ? DRY_RUN : RUN; } private static StepMatchArgument.Group makeMessageGroup( @@ -82,7 +84,7 @@ private static String toString(Throwable error) { } void run(EventBus bus) { - boolean skipNextStep = this.dryRun; + ExecutionMode nextExecutionMode = this.executionMode; emitTestCaseMessage(bus); Instant start = bus.getInstant(); @@ -92,15 +94,21 @@ void run(EventBus bus) { TestCaseState state = new TestCaseState(bus, executionId, this); for (HookTestStep before : beforeHooks) { - skipNextStep |= before.run(this, bus, state, dryRun); + nextExecutionMode = before + .run(this, bus, state, executionMode) + .next(nextExecutionMode); } for (PickleStepTestStep step : testSteps) { - skipNextStep |= step.run(this, bus, state, skipNextStep); + nextExecutionMode = step + .run(this, bus, state, nextExecutionMode) + .next(nextExecutionMode); } for (HookTestStep after : afterHooks) { - after.run(this, bus, state, dryRun); + nextExecutionMode = after + .run(this, bus, state, executionMode) + .next(nextExecutionMode); } Instant stop = bus.getInstant(); diff --git a/core/src/main/java/io/cucumber/core/runner/TestStep.java b/core/src/main/java/io/cucumber/core/runner/TestStep.java index c92b3b4521..7eb0f78eae 100644 --- a/core/src/main/java/io/cucumber/core/runner/TestStep.java +++ b/core/src/main/java/io/cucumber/core/runner/TestStep.java @@ -17,6 +17,7 @@ import java.util.Arrays; import java.util.UUID; +import static io.cucumber.core.runner.ExecutionMode.SKIP; import static io.cucumber.core.runner.TestStepResultStatus.from; import static io.cucumber.messages.TimeConversion.javaDurationToDuration; import static io.cucumber.messages.TimeConversion.javaInstantToTimestamp; @@ -53,14 +54,14 @@ public UUID getId() { return id; } - boolean run(TestCase testCase, EventBus bus, TestCaseState state, boolean skipSteps) { + ExecutionMode run(TestCase testCase, EventBus bus, TestCaseState state, ExecutionMode executionMode) { Instant startTime = bus.getInstant(); emitTestStepStarted(testCase, bus, state.getTestExecutionId(), startTime); Status status; Throwable error = null; try { - status = executeStep(state, skipSteps); + status = executeStep(state, executionMode); } catch (Throwable t) { error = t; status = mapThrowableToStatus(t); @@ -72,7 +73,7 @@ boolean run(TestCase testCase, EventBus bus, TestCaseState state, boolean skipSt emitTestStepFinished(testCase, bus, state.getTestExecutionId(), stopTime, duration, result); - return !result.getStatus().is(Status.PASSED); + return result.getStatus().is(Status.PASSED) ? executionMode : SKIP; } private void emitTestStepStarted(TestCase testCase, EventBus bus, UUID textExecutionId, Instant startTime) { @@ -85,16 +86,10 @@ private void emitTestStepStarted(TestCase testCase, EventBus bus, UUID textExecu .build()); } - private Status executeStep(TestCaseState state, boolean skipSteps) throws Throwable { + private Status executeStep(TestCaseState state, ExecutionMode executionMode) throws Throwable { state.setCurrentTestStepId(id); try { - if (!skipSteps) { - stepDefinitionMatch.runStep(state); - return Status.PASSED; - } else { - stepDefinitionMatch.dryRunStep(state); - return Status.SKIPPED; - } + return executionMode.execute(stepDefinitionMatch, state); } finally { state.clearCurrentTestStepId(); } diff --git a/core/src/test/java/io/cucumber/core/plugin/TestNGFormatterTest.java b/core/src/test/java/io/cucumber/core/plugin/TestNGFormatterTest.java index e9e745487a..4b4d076b9d 100644 --- a/core/src/test/java/io/cucumber/core/plugin/TestNGFormatterTest.java +++ b/core/src/test/java/io/cucumber/core/plugin/TestNGFormatterTest.java @@ -62,7 +62,7 @@ void testScenarioWithUndefinedSteps() { " \n" + " \n" + " \n" + " \n" + @@ -231,9 +231,9 @@ void testScenarioWithBackground() { " \n" + " \n" + " \n" + " \n" + @@ -281,7 +281,7 @@ void testScenarioOutlineWithExamples() { " \n" + " \n" + " \n" + " \n" + @@ -295,7 +295,7 @@ void testScenarioOutlineWithExamples() { " \n" + " \n" + " \n" + " \n" + diff --git a/core/src/test/java/io/cucumber/core/runner/HookTestStepTest.java b/core/src/test/java/io/cucumber/core/runner/HookTestStepTest.java index 23255373fb..5c044f17c1 100644 --- a/core/src/test/java/io/cucumber/core/runner/HookTestStepTest.java +++ b/core/src/test/java/io/cucumber/core/runner/HookTestStepTest.java @@ -54,7 +54,7 @@ void init() { @Test void run_does_run() { - step.run(testCase, bus, state, false); + step.run(testCase, bus, state, ExecutionMode.RUN); InOrder order = inOrder(bus, hookDefintion); order.verify(bus).send(isA(TestStepStarted.class)); @@ -64,7 +64,7 @@ void run_does_run() { @Test void run_does_dry_run() { - step.run(testCase, bus, state, true); + step.run(testCase, bus, state, ExecutionMode.DRY_RUN); InOrder order = inOrder(bus, hookDefintion); order.verify(bus).send(isA(TestStepStarted.class)); @@ -73,17 +73,24 @@ void run_does_dry_run() { } @Test - void result_is_passed_when_step_definition_does_not_throw_exception() { - boolean skipNextStep = step.run(testCase, bus, state, false); - assertFalse(skipNextStep); + void next_execution_mode_is_run_when_step_passes() { + ExecutionMode nextExecutionMode = step.run(testCase, bus, state, ExecutionMode.RUN); + assertThat(nextExecutionMode, is(ExecutionMode.RUN)); assertThat(state.getStatus(), is(equalTo(PASSED))); } @Test - void result_is_skipped_when_skip_step_is_skip_all_skipable() { - boolean skipNextStep = step.run(testCase, bus, state, true); - assertTrue(skipNextStep); + void next_execution_mode_is_skip_when_step_is_skipped() { + ExecutionMode nextExecutionMode = step.run(testCase, bus, state, ExecutionMode.SKIP); + assertThat(nextExecutionMode, is(ExecutionMode.SKIP)); assertThat(state.getStatus(), is(equalTo(SKIPPED))); } + @Test + void next_execution_mode_is_dry_run_when_step_passes_dry_run() { + ExecutionMode nextExecutionMode = step.run(testCase, bus, state, ExecutionMode.DRY_RUN); + assertThat(nextExecutionMode, is(ExecutionMode.DRY_RUN)); + assertThat(state.getStatus(), is(equalTo(PASSED))); + } + } diff --git a/core/src/test/java/io/cucumber/core/runner/PickleStepTestStepTest.java b/core/src/test/java/io/cucumber/core/runner/PickleStepTestStepTest.java index 9ec24c98d3..7b2f4f8134 100644 --- a/core/src/test/java/io/cucumber/core/runner/PickleStepTestStepTest.java +++ b/core/src/test/java/io/cucumber/core/runner/PickleStepTestStepTest.java @@ -47,6 +47,7 @@ import static org.mockito.Mockito.doThrow; import static org.mockito.Mockito.inOrder; import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.never; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; @@ -85,7 +86,7 @@ void init() { @Test void run_wraps_run_step_in_test_step_started_and_finished_events() throws Throwable { - step.run(testCase, bus, state, false); + step.run(testCase, bus, state, ExecutionMode.RUN); InOrder order = inOrder(bus, definitionMatch); order.verify(bus).send(isA(TestStepStarted.class)); @@ -94,8 +95,8 @@ void run_wraps_run_step_in_test_step_started_and_finished_events() throws Throwa } @Test - void run_does_dry_run_step_when_skip_steps_is_true() throws Throwable { - step.run(testCase, bus, state, true); + void run_does_dry_run_step_when_dry_run_steps_is_true() throws Throwable { + step.run(testCase, bus, state, ExecutionMode.DRY_RUN); InOrder order = inOrder(bus, definitionMatch); order.verify(bus).send(isA(TestStepStarted.class)); @@ -104,33 +105,53 @@ void run_does_dry_run_step_when_skip_steps_is_true() throws Throwable { } @Test - void result_is_passed_when_step_definition_does_not_throw_exception() { - boolean skipNextStep = step.run(testCase, bus, state, false); - assertFalse(skipNextStep); + void run_skips_step_when_dry_run_and_skip_step_is_true() throws Throwable { + step.run(testCase, bus, state, ExecutionMode.SKIP); + + InOrder order = inOrder(bus, definitionMatch); + order.verify(bus).send(isA(TestStepStarted.class)); + order.verify(definitionMatch, never()).dryRunStep(state); + order.verify(bus).send(isA(TestStepFinished.class)); + } + + @Test + void run_skips_step_when_skip_step_is_true() throws Throwable { + step.run(testCase, bus, state, ExecutionMode.SKIP); + + InOrder order = inOrder(bus, definitionMatch); + order.verify(bus).send(isA(TestStepStarted.class)); + order.verify(definitionMatch, never()).dryRunStep(state); + order.verify(bus).send(isA(TestStepFinished.class)); + } + + @Test + void result_is_passed_run_when_step_definition_does_not_throw_exception() { + ExecutionMode nextExecutionMode = step.run(testCase, bus, state, ExecutionMode.RUN); + assertThat(nextExecutionMode, is(ExecutionMode.RUN)); assertThat(state.getStatus(), is(equalTo(PASSED))); } @Test void result_is_skipped_when_skip_step_is_not_run_all() { - boolean skipNextStep = step.run(testCase, bus, state, true); - - assertTrue(skipNextStep); + ExecutionMode nextExecutionMode = step.run(testCase, bus, state, ExecutionMode.SKIP); + assertThat(nextExecutionMode, is(ExecutionMode.SKIP)); assertThat(state.getStatus(), is(equalTo(SKIPPED))); } @Test void result_is_skipped_when_before_step_hook_does_not_pass() { doThrow(TestAbortedException.class).when(beforeHookDefinition).execute(any(TestCaseState.class)); - boolean skipNextStep = step.run(testCase, bus, state, false); - assertTrue(skipNextStep); + ExecutionMode nextExecutionMode = step.run(testCase, bus, state, ExecutionMode.RUN); + assertThat(nextExecutionMode, is(ExecutionMode.SKIP)); assertThat(state.getStatus(), is(equalTo(SKIPPED))); } @Test - void step_execution_is_dry_run_when_before_step_hook_does_not_pass() throws Throwable { + void step_execution_is_skipped_when_before_step_hook_does_not_pass() throws Throwable { doThrow(TestAbortedException.class).when(beforeHookDefinition).execute(any(TestCaseState.class)); - step.run(testCase, bus, state, false); - verify(definitionMatch).dryRunStep(any(TestCaseState.class)); + step.run(testCase, bus, state, ExecutionMode.RUN); + verify(definitionMatch, never()).runStep(any(TestCaseState.class)); + verify(definitionMatch, never()).dryRunStep(any(TestCaseState.class)); } @Test @@ -138,8 +159,8 @@ void result_is_result_from_hook_when_before_step_hook_does_not_pass() { Exception exception = new RuntimeException(); doThrow(exception).when(beforeHookDefinition).execute(any(TestCaseState.class)); Result failure = new Result(Status.FAILED, ZERO, exception); - boolean skipNextStep = step.run(testCase, bus, state, false); - assertTrue(skipNextStep); + ExecutionMode nextExecutionMode = step.run(testCase, bus, state, ExecutionMode.RUN); + assertThat(nextExecutionMode, is(ExecutionMode.SKIP)); assertThat(state.getStatus(), is(equalTo(FAILED))); ArgumentCaptor captor = forClass(TestCaseEvent.class); @@ -153,8 +174,8 @@ void result_is_result_from_step_when_step_hook_does_not_pass() throws Throwable RuntimeException runtimeException = new RuntimeException(); Result failure = new Result(Status.FAILED, ZERO, runtimeException); doThrow(runtimeException).when(definitionMatch).runStep(any(TestCaseState.class)); - boolean skipNextStep = step.run(testCase, bus, state, false); - assertTrue(skipNextStep); + ExecutionMode nextExecutionMode = step.run(testCase, bus, state, ExecutionMode.RUN); + assertThat(nextExecutionMode, is(ExecutionMode.SKIP)); assertThat(state.getStatus(), is(equalTo(FAILED))); ArgumentCaptor captor = forClass(TestCaseEvent.class); @@ -168,8 +189,8 @@ void result_is_result_from_hook_when_after_step_hook_does_not_pass() { Exception exception = new RuntimeException(); Result failure = new Result(Status.FAILED, ZERO, exception); doThrow(exception).when(afterHookDefinition).execute(any(TestCaseState.class)); - boolean skipNextStep = step.run(testCase, bus, state, false); - assertTrue(skipNextStep); + ExecutionMode nextExecutionMode = step.run(testCase, bus, state, ExecutionMode.RUN); + assertThat(nextExecutionMode, is(ExecutionMode.SKIP)); assertThat(state.getStatus(), is(equalTo(FAILED))); ArgumentCaptor captor = forClass(TestCaseEvent.class); @@ -181,14 +202,14 @@ void result_is_result_from_hook_when_after_step_hook_does_not_pass() { @Test void after_step_hook_is_run_when_before_step_hook_does_not_pass() { doThrow(RuntimeException.class).when(beforeHookDefinition).execute(any(TestCaseState.class)); - step.run(testCase, bus, state, false); + step.run(testCase, bus, state, ExecutionMode.RUN); verify(afterHookDefinition).execute(any(TestCaseState.class)); } @Test void after_step_hook_is_run_when_step_does_not_pass() throws Throwable { doThrow(Exception.class).when(definitionMatch).runStep(any(TestCaseState.class)); - step.run(testCase, bus, state, false); + step.run(testCase, bus, state, ExecutionMode.RUN); verify(afterHookDefinition).execute(any(TestCaseState.class)); } @@ -197,7 +218,7 @@ void after_step_hook_scenario_contains_step_failure_when_step_does_not_pass() th Throwable expectedError = new TestAbortedException("oops"); doThrow(expectedError).when(definitionMatch).runStep(any(TestCaseState.class)); doThrow(new RuntimeException()).when(afterHookDefinition).execute(argThat(scenarioDoesNotHave(expectedError))); - step.run(testCase, bus, state, false); + step.run(testCase, bus, state, ExecutionMode.RUN); assertThat(state.getError(), is(expectedError)); } @@ -210,7 +231,7 @@ void after_step_hook_scenario_contains_before_step_hook_failure_when_before_step Throwable expectedError = new TestAbortedException("oops"); doThrow(expectedError).when(beforeHookDefinition).execute(any(TestCaseState.class)); doThrow(new RuntimeException()).when(afterHookDefinition).execute(argThat(scenarioDoesNotHave(expectedError))); - step.run(testCase, bus, state, false); + step.run(testCase, bus, state, ExecutionMode.RUN); assertThat(state.getError(), is(expectedError)); } @@ -218,8 +239,8 @@ void after_step_hook_scenario_contains_before_step_hook_failure_when_before_step void result_is_skipped_when_step_definition_throws_assumption_violated_exception() throws Throwable { doThrow(TestAbortedException.class).when(definitionMatch).runStep(any()); - boolean skipNextStep = step.run(testCase, bus, state, false); - assertTrue(skipNextStep); + ExecutionMode nextExecutionMode = step.run(testCase, bus, state, ExecutionMode.RUN); + assertThat(nextExecutionMode, is(ExecutionMode.SKIP)); assertThat(state.getStatus(), is(equalTo(SKIPPED))); } @@ -228,8 +249,8 @@ void result_is_skipped_when_step_definition_throws_assumption_violated_exception void result_is_failed_when_step_definition_throws_exception() throws Throwable { doThrow(RuntimeException.class).when(definitionMatch).runStep(any(TestCaseState.class)); - boolean skipNextStep = step.run(testCase, bus, state, false); - assertTrue(skipNextStep); + ExecutionMode nextExecutionMode = step.run(testCase, bus, state, ExecutionMode.RUN); + assertThat(nextExecutionMode, is(ExecutionMode.SKIP)); assertThat(state.getStatus(), is(equalTo(FAILED))); } @@ -238,8 +259,8 @@ void result_is_failed_when_step_definition_throws_exception() throws Throwable { void result_is_pending_when_step_definition_throws_pending_exception() throws Throwable { doThrow(StubPendingException.class).when(definitionMatch).runStep(any(TestCaseState.class)); - boolean skipNextStep = step.run(testCase, bus, state, false); - assertTrue(skipNextStep); + ExecutionMode nextExecutionMode = step.run(testCase, bus, state, ExecutionMode.RUN); + assertThat(nextExecutionMode, is(ExecutionMode.SKIP)); assertThat(state.getStatus(), is(equalTo(PENDING))); } @@ -257,7 +278,7 @@ void step_execution_time_is_measured() { feature.getPickles().get(0).getSteps().get(0), definitionMatch); when(bus.getInstant()).thenReturn(ofEpochMilli(234L), ofEpochMilli(1234L)); - step.run(testCase, bus, state, false); + step.run(testCase, bus, state, ExecutionMode.RUN); ArgumentCaptor captor = forClass(TestCaseEvent.class); verify(bus, times(4)).send(captor.capture()); diff --git a/core/src/test/java/io/cucumber/core/runner/TestCaseTest.java b/core/src/test/java/io/cucumber/core/runner/TestCaseTest.java index 0696652bab..04fd4c5676 100644 --- a/core/src/test/java/io/cucumber/core/runner/TestCaseTest.java +++ b/core/src/test/java/io/cucumber/core/runner/TestCaseTest.java @@ -131,7 +131,8 @@ void skip_hooks_of_step_after_skipped_step() throws Throwable { InOrder order = inOrder(beforeStep1HookDefinition2, definitionMatch2, afterStep1HookDefinition2); order.verify(beforeStep1HookDefinition2, never()).execute(isA(TestCaseState.class)); - order.verify(definitionMatch2).dryRunStep(isA(TestCaseState.class)); + order.verify(definitionMatch2, never()).runStep(isA(TestCaseState.class)); + order.verify(definitionMatch2, never()).dryRunStep(isA(TestCaseState.class)); order.verify(afterStep1HookDefinition2, never()).execute(isA(TestCaseState.class)); } @@ -144,7 +145,8 @@ void skip_steps_at_first_gherkin_step_after_non_passed_result() throws Throwable InOrder order = inOrder(definitionMatch1, definitionMatch2); order.verify(definitionMatch1).runStep(isA(TestCaseState.class)); - order.verify(definitionMatch2).dryRunStep(isA(TestCaseState.class)); + order.verify(definitionMatch2, never()).dryRunStep(isA(TestCaseState.class)); + order.verify(definitionMatch2, never()).runStep(isA(TestCaseState.class)); } } diff --git a/spring/src/main/java/io/cucumber/spring/TestContextAdaptor.java b/spring/src/main/java/io/cucumber/spring/TestContextAdaptor.java index 95055e304d..1bdeb7ac1f 100644 --- a/spring/src/main/java/io/cucumber/spring/TestContextAdaptor.java +++ b/spring/src/main/java/io/cucumber/spring/TestContextAdaptor.java @@ -113,7 +113,6 @@ public final void stop() { } } - private void notifyTestContextManagerAboutAfterTestMethod() { try { CucumberTestContext.getInstance().start(); @@ -130,7 +129,7 @@ final T getInstance(Class type) { return applicationContext.getBean(type); } - public void cucumberDoesNotHaveASingleTestMethod(){ + public void cucumberDoesNotHaveASingleTestMethod() { } }