BorderImageRepeat extends AbstractCssProperty<BorderImageRepeat> { public static boolean isValid(final String cssValue) { final String trimmedCssValue = TagStringUtil .toLowerCase(StringUtil.strip(cssValue)); final String[] cssValueParts = StringUtil.splitBySpace(trimmedCssValue); if (cssValueParts.length > 2) { return false; } if (cssValueParts.length == 1) { return PREDEFINED_CONSTANTS.contains(trimmedCssValue); } boolean valid = false; for (final String each : cssValueParts) { if (!PREDEFINED_CONSTANTS.contains(each)) { return false; } if ((INITIAL.equals(each) || INHERIT.equals(each)) && cssValueParts.length == 2) { return false; } valid = true; } return valid; } BorderImageRepeat();  BorderImageRepeat(final String cssValue);  BorderImageRepeat(final BorderImageRepeat borderImageRepeat); @Override String getCssName(); @Override String getCssValue(); @Override String toString(); @Override BorderImageRepeat setCssValue(final String cssValue); void setVertical(final String vertical); void setHorizontal(final String horizontal); String getVertical(); String getHorizontal(); void setAsInitial(); void setAsInherit(); static boolean isValid(final String cssValue); static final String INITIAL; static final String INHERIT; static final String STRETCH; static final String REPEAT; static final String ROUND; }
@Test public void testIsValid() { assertTrue(BorderImageRepeat.isValid(BorderImageRepeat.INITIAL)); assertTrue(BorderImageRepeat.isValid(BorderImageRepeat.INHERIT)); assertTrue(BorderImageRepeat.isValid(BorderImageRepeat.REPEAT)); assertTrue(BorderImageRepeat.isValid(BorderImageRepeat.ROUND)); assertTrue(BorderImageRepeat.isValid(BorderImageRepeat.STRETCH)); assertTrue(BorderImageRepeat.isValid(BorderImageRepeat.ROUND + " " + BorderImageRepeat.STRETCH)); assertFalse(BorderImageRepeat.isValid(BorderImageRepeat.ROUND + " " + BorderImageRepeat.INHERIT)); assertFalse(BorderImageRepeat.isValid(BorderImageRepeat.ROUND + " " + BorderImageRepeat.INITIAL)); assertFalse(BorderImageRepeat.isValid(BorderImageRepeat.INHERIT + " " + BorderImageRepeat.STRETCH)); assertFalse(BorderImageRepeat.isValid(BorderImageRepeat.INITIAL + " " + BorderImageRepeat.STRETCH)); assertFalse(BorderImageRepeat.isValid(BorderImageRepeat.ROUND + " " + BorderImageRepeat.STRETCH + " " + BorderImageRepeat.REPEAT)); }