Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Core] The SummaryPrinter should only depend on api classes (#1361)
* [Core] The SummaryPrinter should only depend on api classes A plugin interface like the SummaryPrinter should only depend on classes in cucumber.api packages.
- Loading branch information
1 parent
4d09d8c
commit afc2581
Showing
19 changed files
with
206 additions
and
254 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -1,12 +1,10 @@ | |||
package cucumber.api; | package cucumber.api; | ||
|
|
||
import cucumber.runtime.Runtime; | |||
|
|||
/** | /** | ||
* Interface for plugins that print a summary after test execution. | * Interface for plugins that print a summary after test execution. | ||
* | * | ||
* @see Plugin | * @see Plugin | ||
*/ | */ | ||
public interface SummaryPrinter extends Plugin { | public interface SummaryPrinter extends Plugin { | ||
void print(Runtime runtime); |
|
||
} | } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,39 @@ | |||
package cucumber.runtime; | |||
|
|||
import cucumber.api.Result; | |||
import cucumber.api.event.EventHandler; | |||
import cucumber.api.event.EventListener; | |||
import cucumber.api.event.EventPublisher; | |||
import cucumber.api.event.TestCaseFinished; | |||
|
|||
import java.util.ArrayList; | |||
import java.util.List; | |||
|
|||
import static cucumber.api.Result.SEVERITY; | |||
import static java.util.Collections.max; | |||
|
|||
class ExitStatus implements EventListener { | |||
private static final byte ERRORS = 0x1; | |||
|
|||
private final List<Result> results = new ArrayList<Result>(); | |||
|
|||
private final EventHandler<TestCaseFinished> testCaseFinishedHandler = new EventHandler<TestCaseFinished>() { | |||
@Override | |||
public void receive(TestCaseFinished event) { | |||
results.add(event.result); | |||
} | |||
}; | |||
|
|||
ExitStatus() { | |||
} | |||
|
|||
|
|||
@Override | |||
public void setEventPublisher(EventPublisher publisher) { | |||
publisher.registerHandlerFor(TestCaseFinished.class, testCaseFinishedHandler); | |||
} | |||
|
|||
public byte exitStatus(boolean isStrict) { | |||
return results.isEmpty() || max(results, SEVERITY).isOk(isStrict) ? 0x0 : ERRORS; | |||
} | |||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.