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: 1.1.26-rc.1
Show newest version
package net.serenitybdd.screenplay.formatting;

import com.google.common.collect.ImmutableList;

import java.util.List;

public class StripRedundantTerms {

    private final static List REDUNDANT_HAMCREST_PREFIXES = ImmutableList.of("is ","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