
net.serenitybdd.screenplay.formatting.StripRedundantTerms 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
package net.serenitybdd.screenplay.formatting;
import net.serenitybdd.model.collect.NewList;
import java.util.List;
public class StripRedundantTerms {
private final static List REDUNDANT_HAMCREST_PREFIXES = NewList.of("is ","be ","should be");
public static String from(String expression) {
for (String prefix : REDUNDANT_HAMCREST_PREFIXES) {
expression = removePrefix(prefix, expression);
}
return expression;
}
private static String removePrefix(String prefix, String expression) {
if (expression.startsWith(prefix)) {
expression = expression.substring(3);
}
return expression;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy