
net.serenitybdd.screenplay.formatting.FormattedTitle Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of serenity-screenplay Show documentation
Show all versions of serenity-screenplay Show documentation
Support for the User Journey pattern in Serenity
The newest version!
package net.serenitybdd.screenplay.formatting;
import net.serenitybdd.core.di.SerenityInfrastructure;
import net.serenitybdd.screenplay.Actor;
import net.serenitybdd.screenplay.Consequence;
import net.thucydides.model.ThucydidesSystemProperty;
import net.thucydides.model.environment.SystemEnvironmentVariables;
import net.serenitybdd.core.di.SerenityInfrastructure;
import net.thucydides.core.reports.html.Formatter;
import net.thucydides.model.util.EnvironmentVariables;
public class FormattedTitle {
private final EnvironmentVariables environmentVariables;
private final Actor actor;
public FormattedTitle(EnvironmentVariables environmentVariables, Actor actor) {
this.environmentVariables = environmentVariables;
this.actor = actor;
}
public static String ofConsequence(Consequence consequence, Actor actor) {
return new FormattedTitle(SystemEnvironmentVariables.currentEnvironmentVariables(), actor).getFormattedTitleFor(consequence);
}
public String getFormattedTitleFor(Consequence consequence) {
Formatter formatter = SerenityInfrastructure.getFormatter();
String prefix = "";
if (ThucydidesSystemProperty.SERENITY_INCLUDE_ACTOR_NAME_IN_CONSEQUENCES.booleanFrom(environmentVariables, false)) {
prefix = "For " + actor.getName() + ": ";
}
return prefix + formatter.htmlAttributeCompatible(consequence.toString());
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy