net.serenitybdd.screenplay.EventBusInterface Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of serenity-journey Show documentation
Show all versions of serenity-journey Show documentation
Support for the User Journey pattern in Serenity
package net.serenitybdd.screenplay;
import net.thucydides.core.steps.ExecutedStepDescription;
import net.thucydides.core.steps.StepEventBus;
import net.thucydides.core.steps.StepFailure;
public class EventBusInterface {
public void reportStepFailureFor(Performable todo, Throwable e) {
ExecutedStepDescription taskDescription = ExecutedStepDescription.of(todo.getClass(),"attemptsTo");
StepEventBus.getEventBus().stepFailed(new StepFailure(taskDescription, e));
}
public void reportStepFailureFor(Consequence consequence, Throwable e) {
ExecutedStepDescription consequenceDescription = ExecutedStepDescription.withTitle(consequence.toString());
StepEventBus.getEventBus().stepFailed(new StepFailure(consequenceDescription, e));
}
public int getStepCount() {
return StepEventBus.getEventBus().getBaseStepListener().getStepCount();
}
public void mergePreviousStep() {
StepEventBus.getEventBus().mergePreviousStep();
}
public void updateOverallResult() {
StepEventBus.getEventBus().updateOverallResults();
}
public void reportNewStepWithTitle(String title) {
StepEventBus.getEventBus().stepStarted(ExecutedStepDescription.withTitle(title));
}
public void reportStepFinished() {
StepEventBus.getEventBus().stepFinished();
}
public void reportStepIgnored() {
StepEventBus.getEventBus().stepIgnored();
}
public boolean aStepHasFailed() { return StepEventBus.getEventBus().getBaseStepListener().aStepHasFailed(); }
}