All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.serenitybdd.screenplay.EventBusInterface Maven / Gradle / Ivy

There is a newer version: 1.1.26-rc.1
Show newest version
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(); }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy