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

net.serenitybdd.screenplay.formatting.StripRedundantTerms Maven / Gradle / Ivy

There is a newer version: 4.2.9
Show newest version
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 - 2024 Weber Informatics LLC | Privacy Policy