Skip to content

Commit f85e101

Browse files
committed
Remove the Cucumber JUnit runners createRuntime method
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.
1 parent 7e3182e commit f85e101

File tree

1 file changed

+3
-22
lines changed

1 file changed

+3
-22
lines changed

junit/src/main/java/cucumber/api/junit/Cucumber.java

+3-22
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
* Additional hints can be given to Cucumber by annotating the class with {@link CucumberOptions}.
4848
* <p>
4949
* Cucumber also supports JUnits {@link ClassRule}, {@link BeforeClass} and {@link AfterClass} annotations.
50-
* These will executed before and after all scenarios. Using these is not recommended as it limits the portability
50+
* These will be executed before and after all scenarios. Using these is not recommended as it limits the portability
5151
* between different runners; they may not execute correctly when using the commandline, IntelliJ IDEA or
5252
* Cucumber-Eclipse. Instead it is recommended to use Cucumbers `Before` and `After` hooks.
5353
*
@@ -75,34 +75,15 @@ public Cucumber(Class clazz) throws InitializationError, IOException {
7575
RuntimeOptions runtimeOptions = runtimeOptionsFactory.create();
7676

7777
ResourceLoader resourceLoader = new MultiLoader(classLoader);
78-
runtime = createRuntime(resourceLoader, classLoader, runtimeOptions);
78+
ClassFinder classFinder = new ResourceLoaderClassFinder(resourceLoader, classLoader);
79+
runtime = new Runtime(resourceLoader, classFinder, classLoader, runtimeOptions);
7980
formatter = runtimeOptions.formatter(classLoader);
8081
final JUnitOptions junitOptions = new JUnitOptions(runtimeOptions.getJunitOptions());
8182
final List<CucumberFeature> cucumberFeatures = runtimeOptions.cucumberFeatures(resourceLoader, runtime.getEventBus());
8283
jUnitReporter = new JUnitReporter(runtime.getEventBus(), runtimeOptions.isStrict(), junitOptions);
8384
addChildren(cucumberFeatures);
8485
}
8586

86-
/**
87-
* Create the Runtime. Can be overridden to customize the runtime or backend.
88-
*
89-
* @param resourceLoader used to load resources
90-
* @param classLoader used to load classes
91-
* @param runtimeOptions configuration
92-
* @return a new runtime
93-
* @throws InitializationError if a JUnit error occurred
94-
* @throws IOException if a class or resource could not be loaded
95-
* @deprecated Neither the runtime nor the backend or any of the classes involved in their construction are part of
96-
* the public API. As such they should not be exposed. The recommended way to observe the cucumber process is to
97-
* listen to events by using a plugin. For example the JSONFormatter.
98-
*/
99-
@Deprecated
100-
protected Runtime createRuntime(ResourceLoader resourceLoader, ClassLoader classLoader,
101-
RuntimeOptions runtimeOptions) throws InitializationError, IOException {
102-
ClassFinder classFinder = new ResourceLoaderClassFinder(resourceLoader, classLoader);
103-
return new Runtime(resourceLoader, classFinder, classLoader, runtimeOptions);
104-
}
105-
10687
@Override
10788
public List<FeatureRunner> getChildren() {
10889
return children;

0 commit comments

Comments
 (0)