Skip to content

[JUnit] Remove Cucumber.createRuntime method #1287

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 9, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 3 additions & 22 deletions junit/src/main/java/cucumber/api/junit/Cucumber.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
* Additional hints can be given to Cucumber by annotating the class with {@link CucumberOptions}.
* <p>
* Cucumber also supports JUnits {@link ClassRule}, {@link BeforeClass} and {@link AfterClass} annotations.
* These will executed before and after all scenarios. Using these is not recommended as it limits the portability
* These will be executed before and after all scenarios. Using these is not recommended as it limits the portability
* between different runners; they may not execute correctly when using the commandline, IntelliJ IDEA or
* Cucumber-Eclipse. Instead it is recommended to use Cucumbers `Before` and `After` hooks.
*
Expand Down Expand Up @@ -75,34 +75,15 @@ public Cucumber(Class clazz) throws InitializationError, IOException {
RuntimeOptions runtimeOptions = runtimeOptionsFactory.create();

ResourceLoader resourceLoader = new MultiLoader(classLoader);
runtime = createRuntime(resourceLoader, classLoader, runtimeOptions);
ClassFinder classFinder = new ResourceLoaderClassFinder(resourceLoader, classLoader);
runtime = new Runtime(resourceLoader, classFinder, classLoader, runtimeOptions);
formatter = runtimeOptions.formatter(classLoader);
final JUnitOptions junitOptions = new JUnitOptions(runtimeOptions.getJunitOptions());
final List<CucumberFeature> cucumberFeatures = runtimeOptions.cucumberFeatures(resourceLoader, runtime.getEventBus());
jUnitReporter = new JUnitReporter(runtime.getEventBus(), runtimeOptions.isStrict(), junitOptions);
addChildren(cucumberFeatures);
}

/**
* Create the Runtime. Can be overridden to customize the runtime or backend.
*
* @param resourceLoader used to load resources
* @param classLoader used to load classes
* @param runtimeOptions configuration
* @return a new runtime
* @throws InitializationError if a JUnit error occurred
* @throws IOException if a class or resource could not be loaded
* @deprecated Neither the runtime nor the backend or any of the classes involved in their construction are part of
* the public API. As such they should not be exposed. The recommended way to observe the cucumber process is to
* listen to events by using a plugin. For example the JSONFormatter.
*/
@Deprecated
protected Runtime createRuntime(ResourceLoader resourceLoader, ClassLoader classLoader,
RuntimeOptions runtimeOptions) throws InitializationError, IOException {
ClassFinder classFinder = new ResourceLoaderClassFinder(resourceLoader, classLoader);
return new Runtime(resourceLoader, classFinder, classLoader, runtimeOptions);
}

@Override
public List<FeatureRunner> getChildren() {
return children;
Expand Down