@Test
public void toElementFinder() {
CssEndsWithAttributeCondition endsWithAttributeCondition = new CssEndsWithAttributeCondition(new AstCssEndsWithAttributeCondition("attribute", "stringToEnd"));
ElementFinder previous = ElementFinderUtilsTest.UNIVERSAL_SELECTOR_FINDER;
ElementFinder elementFinder = endsWithAttributeCondition.toElementFinder(previous);
assertThat(elementFinder.toCssString(), is("[attribute$='stringToEnd']"));
assertThat(elementFinder.canFetchThroughCssAlone(), is(true));
String attrName = "@*[translate(name(), 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz') = 'attribute']";
assertThat(elementFinder.getXPathExpression(), is(".//*[substring("+attrName+", string-length("+attrName+")-10) = 'stringToEnd']"));
assertThat(elementFinder.getElementFilterList().getElementFilters(), empty());
}