summaryPrinters = new ArrayList<>();
- /**
- * Create a new instance from a string of options, for example:
- *
- *
- *
- * @param argv the arguments
- */
- public RuntimeOptions(String argv) {
- this(Shellwords.parse(argv));
- }
+ private final ResourceLoader resourceLoader;
/**
* Create a new instance from a list of options, for example:
@@ -81,24 +80,25 @@ public RuntimeOptions(String argv) {
*
* @param argv the arguments
*/
- public RuntimeOptions(List argv) {
- this(Env.INSTANCE, argv);
+ public RuntimeOptions(ResourceLoader resourceLoader, List argv) {
+ this(resourceLoader, Env.INSTANCE, argv);
}
- public RuntimeOptions(Env env, List argv) {
+ public RuntimeOptions(ResourceLoader resourceLoader, Env env, List argv) {
+ this.resourceLoader = resourceLoader;
argv = new ArrayList(argv); // in case the one passed in is unmodifiable.
parse(argv);
String cucumberOptionsFromEnv = env.get("cucumber.options");
if (cucumberOptionsFromEnv != null) {
- parse(Shellwords.parse(cucumberOptionsFromEnv));
+ parse(ShellWords.parse(cucumberOptionsFromEnv));
}
- if (pluginFormatterNames.isEmpty()) {
- pluginFormatterNames.add("progress");
+ if (formatters.isEmpty()) {
+ formatters.add(PluginOption.parse("progress"));
}
- if (pluginSummaryPrinterNames.isEmpty()) {
- pluginSummaryPrinterNames.add("default_summary");
+ if (summaryPrinters.isEmpty()) {
+ summaryPrinters.add(PluginOption.parse("default_summary"));
}
}
@@ -107,20 +107,17 @@ public boolean isMultiThreaded() {
}
public RuntimeOptions noSummaryPrinter() {
- pluginSummaryPrinterNames.clear();
+ summaryPrinters.clear();
return this;
}
- public List getPluginFormatterNames() {
- return pluginFormatterNames;
- }
-
- public List getPluginSummaryPrinterNames() {
- return pluginSummaryPrinterNames;
- }
-
- public List getPluginStepDefinitionReporterNames() {
- return pluginStepDefinitionReporterNames;
+ @Override
+ public List plugins() {
+ List plugins = new ArrayList<>();
+ plugins.addAll(formatters);
+ plugins.addAll(stepDefinitionReporters);
+ plugins.addAll(summaryPrinters);
+ return plugins;
}
private void parse(List args) {
@@ -177,13 +174,10 @@ private void parse(List args) {
} else if (arg.startsWith("-")) {
printUsage();
throw new CucumberException("Unknown option: " + arg);
+ } else if (arg.startsWith("@")) {
+ processPathWitheLinesFromRerunFile(parsedLineFilters, parsedFeaturePaths, arg.substring(1));
} else {
- PathWithLines pathWithLines = new PathWithLines(arg);
- parsedFeaturePaths.add(pathWithLines.path);
- if (!pathWithLines.lines.isEmpty()) {
- String key = pathWithLines.path.replace("classpath:", "");
- addLineFilters(parsedLineFilters, key, pathWithLines.lines);
- }
+ processPathWithLines(parsedLineFilters, parsedFeaturePaths, new PathWithLines(arg));
}
}
if (!parsedTagFilters.isEmpty() || !parsedNameFilters.isEmpty() || !parsedLineFilters.isEmpty() || haveLineFilters(parsedFeaturePaths)) {
@@ -210,9 +204,9 @@ private void parse(List args) {
junitOptions.addAll(parsedJunitOptions);
}
- parsedPluginData.updatePluginFormatterNames(pluginFormatterNames);
- parsedPluginData.updatePluginStepDefinitionReporterNames(pluginStepDefinitionReporterNames);
- parsedPluginData.updatePluginSummaryPrinterNames(pluginSummaryPrinterNames);
+ parsedPluginData.updateFormatters(formatters);
+ parsedPluginData.updateStepDefinitionReporters(stepDefinitionReporters);
+ parsedPluginData.updateSummaryPrinters(summaryPrinters);
}
private void addLineFilters(Map> parsedLineFilters, String key, List lines) {
@@ -223,9 +217,46 @@ private void addLineFilters(Map> parsedLineFilters, String ke
}
}
+ private void processPathWithLines(Map> parsedLineFilters, List parsedFeaturePaths, PathWithLines pathWithLines) {
+ parsedFeaturePaths.add(pathWithLines.path);
+ if (!pathWithLines.lines.isEmpty()) {
+ String key = pathWithLines.path.replace("classpath:", "");
+ addLineFilters(parsedLineFilters, key, pathWithLines.lines);
+ }
+ }
+
+ private void processPathWitheLinesFromRerunFile(Map> parsedLineFilters, List parsedFeaturePaths, String rerunPath) {
+ for (PathWithLines pathWithLines : loadRerunFile(rerunPath)) {
+ processPathWithLines(parsedLineFilters, parsedFeaturePaths, pathWithLines);
+ }
+ }
+
+ private List loadRerunFile(String rerunPath) {
+ List featurePaths = new ArrayList<>();
+ Iterable resources = resourceLoader.resources(rerunPath, null);
+ for (Resource resource : resources) {
+ String source = read(resource);
+ if (!source.isEmpty()) {
+ Matcher matcher = RERUN_PATH_SPECIFICATION.matcher(source);
+ while (matcher.find()) {
+ featurePaths.add(new PathWithLines(matcher.group(1)));
+ }
+ }
+ }
+ return featurePaths;
+ }
+
+ private static String read(Resource resource) {
+ try {
+ return FixJava.readReader(new InputStreamReader(resource.getInputStream()));
+ } catch (IOException e) {
+ throw new CucumberException("Failed to read resource:" + resource.getPath(), e);
+ }
+ }
+
private boolean haveLineFilters(List parsedFeaturePaths) {
for (String pathName : parsedFeaturePaths) {
- if (pathName.startsWith("@") || PathWithLines.hasLineFilters(pathName)) {
+ if (PathWithLines.hasLineFilters(pathName)) {
return true;
}
}
@@ -348,55 +379,55 @@ public int getThreads() {
return threads;
}
- class ParsedPluginData {
- ParsedOptionNames formatterNames = new ParsedOptionNames();
- ParsedOptionNames stepDefinitionReporterNames = new ParsedOptionNames();
- ParsedOptionNames summaryPrinterNames = new ParsedOptionNames();
-
- public void addPluginName(String name, boolean isAddPlugin) {
- if (PluginFactory.isStepDefinitionReporterName(name)) {
- stepDefinitionReporterNames.addName(name, isAddPlugin);
- } else if (PluginFactory.isSummaryPrinterName(name)) {
- summaryPrinterNames.addName(name, isAddPlugin);
- } else if (PluginFactory.isFormatterName(name)) {
- formatterNames.addName(name, isAddPlugin);
+ static final class ParsedPluginData {
+ private ParsedPlugins formatters = new ParsedPlugins();
+ private ParsedPlugins stepDefinitionReporters = new ParsedPlugins();
+ private ParsedPlugins summaryPrinters = new ParsedPlugins();
+
+ void addPluginName(String name, boolean isAddPlugin) {
+ PluginOption pluginOption = PluginOption.parse(name);
+ if (pluginOption.isStepDefinitionReporter()) {
+ stepDefinitionReporters.addName(pluginOption, isAddPlugin);
+ } else if (pluginOption.isSummaryPrinter()) {
+ summaryPrinters.addName(pluginOption, isAddPlugin);
+ } else if (pluginOption.isFormatter()) {
+ formatters.addName(pluginOption, isAddPlugin);
} else {
throw new CucumberException("Unrecognized plugin: " + name);
}
}
- public void updatePluginFormatterNames(List pluginFormatterNames) {
- formatterNames.updateNameList(pluginFormatterNames);
+ void updateFormatters(List formatter) {
+ this.formatters.updateNameList(formatter);
}
- public void updatePluginStepDefinitionReporterNames(List pluginStepDefinitionReporterNames) {
- stepDefinitionReporterNames.updateNameList(pluginStepDefinitionReporterNames);
+ void updateStepDefinitionReporters(List stepDefintionReporter) {
+ stepDefinitionReporters.updateNameList(stepDefintionReporter);
}
- public void updatePluginSummaryPrinterNames(List pluginSummaryPrinterNames) {
- summaryPrinterNames.updateNameList(pluginSummaryPrinterNames);
+ void updateSummaryPrinters(List pluginSummaryPrinterNames) {
+ summaryPrinters.updateNameList(pluginSummaryPrinterNames);
}
- }
- class ParsedOptionNames {
- private List names = new ArrayList();
- private boolean clobber = false;
+ private static class ParsedPlugins {
+ private List names = new ArrayList<>();
+ private boolean clobber = false;
- public void addName(String name, boolean isAddOption) {
- names.add(name);
- if (!isAddOption) {
- clobber = true;
+ void addName(Plugin name, boolean isAddOption) {
+ names.add(name);
+ if (!isAddOption) {
+ clobber = true;
+ }
}
- }
- public void updateNameList(List nameList) {
- if (!names.isEmpty()) {
- if (clobber) {
- nameList.clear();
+ void updateNameList(List nameList) {
+ if (!names.isEmpty()) {
+ if (clobber) {
+ nameList.clear();
+ }
+ nameList.addAll(names);
}
- nameList.addAll(names);
}
}
}
-
}
diff --git a/core/src/main/java/cucumber/runtime/RuntimeOptionsFactory.java b/core/src/main/java/io/cucumber/core/options/RuntimeOptionsFactory.java
similarity index 90%
rename from core/src/main/java/cucumber/runtime/RuntimeOptionsFactory.java
rename to core/src/main/java/io/cucumber/core/options/RuntimeOptionsFactory.java
index d4e2ec1795..4241a7404d 100644
--- a/core/src/main/java/cucumber/runtime/RuntimeOptionsFactory.java
+++ b/core/src/main/java/io/cucumber/core/options/RuntimeOptionsFactory.java
@@ -1,7 +1,9 @@
-package cucumber.runtime;
+package io.cucumber.core.options;
-import cucumber.api.CucumberOptions;
-import cucumber.runtime.io.MultiLoader;
+import io.cucumber.core.api.options.CucumberOptions;
+import io.cucumber.core.exception.CucumberException;
+import io.cucumber.core.io.MultiLoader;
+import io.cucumber.core.io.ResourceLoader;
import java.util.ArrayList;
import java.util.Collections;
@@ -9,18 +11,24 @@
import static java.util.Arrays.asList;
-public class RuntimeOptionsFactory {
+public final class RuntimeOptionsFactory {
private final Class clazz;
+ private final ResourceLoader resoureceLoader;
private boolean featuresSpecified = false;
private boolean overridingGlueSpecified = false;
public RuntimeOptionsFactory(Class clazz) {
+ this(clazz, new MultiLoader(clazz.getClassLoader()));
+ }
+
+ public RuntimeOptionsFactory(Class clazz, ResourceLoader resourceLoader) {
this.clazz = clazz;
+ this.resoureceLoader = resourceLoader;
}
public RuntimeOptions create() {
List args = buildArgsFromOptions();
- return new RuntimeOptions(args);
+ return new RuntimeOptions(resoureceLoader, args);
}
private List buildArgsFromOptions() {
diff --git a/core/src/main/java/cucumber/runtime/Shellwords.java b/core/src/main/java/io/cucumber/core/options/ShellWords.java
similarity index 72%
rename from core/src/main/java/cucumber/runtime/Shellwords.java
rename to core/src/main/java/io/cucumber/core/options/ShellWords.java
index 5835b9078b..c6583e49c3 100644
--- a/core/src/main/java/cucumber/runtime/Shellwords.java
+++ b/core/src/main/java/io/cucumber/core/options/ShellWords.java
@@ -1,18 +1,18 @@
-package cucumber.runtime;
+package io.cucumber.core.options;
import java.util.ArrayList;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
-public class Shellwords {
+class ShellWords {
private static final Pattern SHELLWORDS_PATTERN = Pattern.compile("[^\\s'\"]+|[']([^']*)[']|[\"]([^\"]*)[\"]");
- private Shellwords() {
+ private ShellWords() {
}
- public static List parse(String cmdline) {
- List matchList = new ArrayList();
+ static List parse(String cmdline) {
+ List matchList = new ArrayList<>();
Matcher shellwordsMatcher = SHELLWORDS_PATTERN.matcher(cmdline);
while (shellwordsMatcher.find()) {
if (shellwordsMatcher.group(1) != null) {
@@ -20,8 +20,8 @@ public static List parse(String cmdline) {
} else {
String shellword = shellwordsMatcher.group();
if (shellword.startsWith("\"")
- && shellword.endsWith("\"")
- && shellword.length() > 2) {
+ && shellword.endsWith("\"")
+ && shellword.length() > 2) {
shellword = shellword.substring(1, shellword.length() - 1);
}
matchList.add(shellword);
diff --git a/core/src/main/java/cucumber/api/formatter/AnsiEscapes.java b/core/src/main/java/io/cucumber/core/plugin/AnsiEscapes.java
similarity index 95%
rename from core/src/main/java/cucumber/api/formatter/AnsiEscapes.java
rename to core/src/main/java/io/cucumber/core/plugin/AnsiEscapes.java
index 389488a4e3..b4db85d6b8 100644
--- a/core/src/main/java/cucumber/api/formatter/AnsiEscapes.java
+++ b/core/src/main/java/io/cucumber/core/plugin/AnsiEscapes.java
@@ -1,6 +1,6 @@
-package cucumber.api.formatter;
+package io.cucumber.core.plugin;
-public class AnsiEscapes {
+final class AnsiEscapes {
private static final char ESC = 27;
private static final char BRACKET = '[';
diff --git a/core/src/main/java/cucumber/runtime/formatter/AnsiFormats.java b/core/src/main/java/io/cucumber/core/plugin/AnsiFormats.java
similarity index 96%
rename from core/src/main/java/cucumber/runtime/formatter/AnsiFormats.java
rename to core/src/main/java/io/cucumber/core/plugin/AnsiFormats.java
index 132da9fd4d..167c1e6109 100644
--- a/core/src/main/java/cucumber/runtime/formatter/AnsiFormats.java
+++ b/core/src/main/java/io/cucumber/core/plugin/AnsiFormats.java
@@ -1,6 +1,4 @@
-package cucumber.runtime.formatter;
-
-import cucumber.api.formatter.AnsiEscapes;
+package io.cucumber.core.plugin;
import java.util.HashMap;
import java.util.Map;
@@ -8,7 +6,7 @@
final class AnsiFormats implements Formats {
private static final Map formats = new HashMap() {{
put("undefined", new ColorFormat(AnsiEscapes.YELLOW));
- put("undefined_arg", new ColorFormat(AnsiEscapes.YELLOW, AnsiEscapes.INTENSITY_BOLD)); // Never used, but avoids NPE in formatters.
+ put("undefined_arg", new ColorFormat(AnsiEscapes.YELLOW, AnsiEscapes.INTENSITY_BOLD)); // Never used, but avoids NPE in plugin.
put("pending", new ColorFormat(AnsiEscapes.YELLOW));
put("pending_arg", new ColorFormat(AnsiEscapes.YELLOW, AnsiEscapes.INTENSITY_BOLD));
put("executing", new ColorFormat(AnsiEscapes.GREY));
diff --git a/core/src/main/java/cucumber/runner/CanonicalOrderEventPublisher.java b/core/src/main/java/io/cucumber/core/plugin/CanonicalOrderEventPublisher.java
similarity index 61%
rename from core/src/main/java/cucumber/runner/CanonicalOrderEventPublisher.java
rename to core/src/main/java/io/cucumber/core/plugin/CanonicalOrderEventPublisher.java
index 712df8077c..659b5d73d0 100644
--- a/core/src/main/java/cucumber/runner/CanonicalOrderEventPublisher.java
+++ b/core/src/main/java/io/cucumber/core/plugin/CanonicalOrderEventPublisher.java
@@ -1,13 +1,14 @@
-package cucumber.runner;
+package io.cucumber.core.plugin;
-import cucumber.api.event.Event;
-import cucumber.api.event.TestRunFinished;
+import io.cucumber.core.api.event.Event;
+import io.cucumber.core.api.event.TestRunFinished;
+import io.cucumber.core.event.AbstractEventPublisher;
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
-public class CanonicalOrderEventPublisher extends AbstractEventPublisher {
+final class CanonicalOrderEventPublisher extends AbstractEventPublisher {
private final List queue = new LinkedList<>();
diff --git a/core/src/main/java/cucumber/runtime/formatter/DefaultSummaryPrinter.java b/core/src/main/java/io/cucumber/core/plugin/DefaultSummaryPrinter.java
similarity index 77%
rename from core/src/main/java/cucumber/runtime/formatter/DefaultSummaryPrinter.java
rename to core/src/main/java/io/cucumber/core/plugin/DefaultSummaryPrinter.java
index e8457edc7e..c766a5b1cb 100644
--- a/core/src/main/java/cucumber/runtime/formatter/DefaultSummaryPrinter.java
+++ b/core/src/main/java/io/cucumber/core/plugin/DefaultSummaryPrinter.java
@@ -1,18 +1,17 @@
-package cucumber.runtime.formatter;
+package io.cucumber.core.plugin;
-import cucumber.api.SummaryPrinter;
-import cucumber.api.event.EventHandler;
-import cucumber.api.event.EventListener;
-import cucumber.api.event.EventPublisher;
-import cucumber.api.event.TestRunFinished;
-import cucumber.api.formatter.ColorAware;
-import cucumber.api.formatter.StrictAware;
-import cucumber.runtime.UndefinedStepsTracker;
+import io.cucumber.core.api.plugin.SummaryPrinter;
+import io.cucumber.core.api.event.EventHandler;
+import io.cucumber.core.api.event.EventListener;
+import io.cucumber.core.api.event.EventPublisher;
+import io.cucumber.core.api.event.TestRunFinished;
+import io.cucumber.core.api.plugin.ColorAware;
+import io.cucumber.core.api.plugin.StrictAware;
import java.io.PrintStream;
import java.util.List;
-class DefaultSummaryPrinter implements SummaryPrinter, ColorAware, StrictAware, EventListener {
+public final class DefaultSummaryPrinter implements SummaryPrinter, ColorAware, StrictAware, EventListener {
private final Stats stats = new Stats();
private final UndefinedStepsTracker undefinedStepsTracker = new UndefinedStepsTracker();
diff --git a/core/src/main/java/cucumber/runtime/formatter/Format.java b/core/src/main/java/io/cucumber/core/plugin/Format.java
similarity index 62%
rename from core/src/main/java/cucumber/runtime/formatter/Format.java
rename to core/src/main/java/io/cucumber/core/plugin/Format.java
index 4b60cf4392..73a9c52b13 100644
--- a/core/src/main/java/cucumber/runtime/formatter/Format.java
+++ b/core/src/main/java/io/cucumber/core/plugin/Format.java
@@ -1,4 +1,4 @@
-package cucumber.runtime.formatter;
+package io.cucumber.core.plugin;
public interface Format {
String text(String text);
diff --git a/core/src/main/java/cucumber/runtime/formatter/Formats.java b/core/src/main/java/io/cucumber/core/plugin/Formats.java
similarity index 69%
rename from core/src/main/java/cucumber/runtime/formatter/Formats.java
rename to core/src/main/java/io/cucumber/core/plugin/Formats.java
index c803eab5a9..ad777901fe 100644
--- a/core/src/main/java/cucumber/runtime/formatter/Formats.java
+++ b/core/src/main/java/io/cucumber/core/plugin/Formats.java
@@ -1,4 +1,4 @@
-package cucumber.runtime.formatter;
+package io.cucumber.core.plugin;
public interface Formats {
Format get(String key);
diff --git a/core/src/main/java/cucumber/runtime/formatter/HTMLFormatter.java b/core/src/main/java/io/cucumber/core/plugin/HTMLFormatter.java
similarity index 94%
rename from core/src/main/java/cucumber/runtime/formatter/HTMLFormatter.java
rename to core/src/main/java/io/cucumber/core/plugin/HTMLFormatter.java
index bc9b3d899e..a3ef5a8eff 100644
--- a/core/src/main/java/cucumber/runtime/formatter/HTMLFormatter.java
+++ b/core/src/main/java/io/cucumber/core/plugin/HTMLFormatter.java
@@ -1,22 +1,20 @@
-package cucumber.runtime.formatter;
-
-import cucumber.api.HookTestStep;
-import cucumber.api.PickleStepTestStep;
-import cucumber.api.Result;
-import cucumber.api.TestCase;
-import cucumber.api.event.EmbedEvent;
-import cucumber.api.event.EventHandler;
-import cucumber.api.event.EventListener;
-import cucumber.api.event.EventPublisher;
-import cucumber.api.event.TestCaseStarted;
-import cucumber.api.event.TestRunFinished;
-import cucumber.api.event.TestSourceRead;
-import cucumber.api.event.TestStepFinished;
-import cucumber.api.event.TestStepStarted;
-import cucumber.api.event.WriteEvent;
-import cucumber.api.formatter.NiceAppendable;
-import cucumber.runtime.CucumberException;
-import cucumber.runtime.io.URLOutputStream;
+package io.cucumber.core.plugin;
+
+import io.cucumber.core.api.event.HookTestStep;
+import io.cucumber.core.api.event.PickleStepTestStep;
+import io.cucumber.core.api.event.Result;
+import io.cucumber.core.api.event.TestCase;
+import io.cucumber.core.api.event.EmbedEvent;
+import io.cucumber.core.api.event.EventHandler;
+import io.cucumber.core.api.event.EventListener;
+import io.cucumber.core.api.event.EventPublisher;
+import io.cucumber.core.api.event.TestCaseStarted;
+import io.cucumber.core.api.event.TestRunFinished;
+import io.cucumber.core.api.event.TestSourceRead;
+import io.cucumber.core.api.event.TestStepFinished;
+import io.cucumber.core.api.event.TestStepStarted;
+import io.cucumber.core.api.event.WriteEvent;
+import io.cucumber.core.exception.CucumberException;
import gherkin.ast.Background;
import gherkin.ast.DataTable;
import gherkin.ast.DocString;
@@ -50,7 +48,7 @@
import java.util.List;
import java.util.Map;
-final class HTMLFormatter implements EventListener {
+public final class HTMLFormatter implements EventListener {
private static final Gson gson = new GsonBuilder().setPrettyPrinting().create();
private static final String JS_FORMATTER_VAR = "formatter";
private static final String JS_REPORT_FILENAME = "report.js";
@@ -120,6 +118,7 @@ public void receive(TestRunFinished event) {
}
};
+ @SuppressWarnings("WeakerAccess") // Used by PluginFactory
public HTMLFormatter(URL htmlReportDir) {
this(htmlReportDir, createJsOut(htmlReportDir));
}
@@ -147,7 +146,7 @@ private void handleTestSourceRead(TestSourceRead event) {
private void handleTestCaseStarted(TestCaseStarted event) {
if (firstFeature) {
jsOut.append("$(document).ready(function() {").append("var ")
- .append(JS_FORMATTER_VAR).append(" = new CucumberHTML.DOMFormatter($('.cucumber-report'));");
+ .append(JS_FORMATTER_VAR).append(" = new CucumberHTML.DOMFormatter($('.cucumber-report'));");
firstFeature = false;
}
handleStartOfFeature(event.testCase);
@@ -187,7 +186,7 @@ private void handleTestStepFinished(TestStepFinished event) {
private void handleEmbed(EmbedEvent event) {
String mimeType = event.mimeType;
if(mimeType.startsWith("text/")) {
- // just pass straight to the formatter to output in the html
+ // just pass straight to the plugin to output in the html
jsFunctionCall("embedding", mimeType, new String(event.data));
} else {
// Creating a file instead of using data urls to not clutter the js file
@@ -479,7 +478,7 @@ private URL toUrl(String fileName) {
try {
return new URL(htmlReportDir, fileName);
} catch (IOException e) {
- throw new CucumberException(e);
+ throw new CucumberException(e);
}
}
diff --git a/core/src/main/java/cucumber/runtime/formatter/JSONFormatter.java b/core/src/main/java/io/cucumber/core/plugin/JSONFormatter.java
similarity index 93%
rename from core/src/main/java/cucumber/runtime/formatter/JSONFormatter.java
rename to core/src/main/java/io/cucumber/core/plugin/JSONFormatter.java
index 5bd8e9d5f3..6fe0d0b4e6 100644
--- a/core/src/main/java/cucumber/runtime/formatter/JSONFormatter.java
+++ b/core/src/main/java/io/cucumber/core/plugin/JSONFormatter.java
@@ -1,22 +1,21 @@
-package cucumber.runtime.formatter;
-
-import cucumber.api.HookTestStep;
-import cucumber.api.HookType;
-import cucumber.api.PickleStepTestStep;
-import cucumber.api.Result;
-import cucumber.api.TestCase;
-import cucumber.api.TestStep;
-import cucumber.api.event.EmbedEvent;
-import cucumber.api.event.EventHandler;
-import cucumber.api.event.EventListener;
-import cucumber.api.event.EventPublisher;
-import cucumber.api.event.TestCaseStarted;
-import cucumber.api.event.TestRunFinished;
-import cucumber.api.event.TestSourceRead;
-import cucumber.api.event.TestStepFinished;
-import cucumber.api.event.TestStepStarted;
-import cucumber.api.event.WriteEvent;
-import cucumber.api.formatter.NiceAppendable;
+package io.cucumber.core.plugin;
+
+import io.cucumber.core.api.event.HookTestStep;
+import io.cucumber.core.api.event.HookType;
+import io.cucumber.core.api.event.PickleStepTestStep;
+import io.cucumber.core.api.event.Result;
+import io.cucumber.core.api.event.TestCase;
+import io.cucumber.core.api.event.TestStep;
+import io.cucumber.core.api.event.EmbedEvent;
+import io.cucumber.core.api.event.EventHandler;
+import io.cucumber.core.api.event.EventListener;
+import io.cucumber.core.api.event.EventPublisher;
+import io.cucumber.core.api.event.TestCaseStarted;
+import io.cucumber.core.api.event.TestRunFinished;
+import io.cucumber.core.api.event.TestSourceRead;
+import io.cucumber.core.api.event.TestStepFinished;
+import io.cucumber.core.api.event.TestStepStarted;
+import io.cucumber.core.api.event.WriteEvent;
import gherkin.ast.Background;
import gherkin.ast.DocString;
import gherkin.ast.Feature;
@@ -37,7 +36,7 @@
import java.util.List;
import java.util.Map;
-final class JSONFormatter implements EventListener {
+public final class JSONFormatter implements EventListener {
private String currentFeatureFile;
private List