BorderColor extends AbstractCssProperty<BorderColor> implements StateChangeInformer<CssProperty> { public static boolean isValid(final String cssValue) { final String trimmedCssValue; if (cssValue == null || (trimmedCssValue = TagStringUtil .toLowerCase(StringUtil.strip(cssValue))).isEmpty()) { return false; } if (INITIAL.equalsIgnoreCase(trimmedCssValue) || INHERIT.equalsIgnoreCase(trimmedCssValue)) { return true; } final List<String> cssValueParts = CssValueUtil.split(trimmedCssValue); for (final String eachPart : cssValueParts) { final boolean valid = BorderTopColor.isValid(eachPart); if ((valid && (INITIAL.equals(eachPart) || INHERIT.equals(eachPart))) || !valid) { return false; } } return true; } BorderColor();  BorderColor(final String cssValue);  BorderColor(final BorderColor borderBottomColor); BorderColor setValue(final String value); @Override String getCssName(); @Override String getCssValue(); @Override String toString(); String getValue(); @Override BorderColor setCssValue(final String cssValue); void setAsInitial(); void setAsInherit(); void setAsTransparent(); BorderTopColor getBorderTopColor(); void setBorderColor(final BorderTopColor borderTopColor,
            final BorderRightColor borderRightColor,
            final BorderBottomColor borderBottomColor,
            final BorderLeftColor borderLeftColor); BorderRightColor getBorderRightColor(); BorderBottomColor getBorderBottomColor(); BorderLeftColor getBorderLeftColor(); @Override void stateChanged(final CssProperty stateChangedObject); boolean hasPredefinedConstantValue(); static boolean isValid(final String cssValue); static final String INITIAL; static final String INHERIT; static final String TRANSPARENT; }
@Test public void testIsValid() { { final boolean valid = BorderColor.isValid("green"); assertTrue(valid); final boolean invalid = BorderColor.isValid("blu"); assertFalse(invalid); } { final boolean valid = BorderColor.isValid("GREEN"); assertTrue(valid); } { final boolean valid = BorderColor.isValid("WHITE"); assertTrue(valid); final boolean invalid = BorderColor.isValid("dfd"); assertFalse(invalid); } { final boolean valid = BorderColor.isValid("TRANSPARENT"); assertTrue(valid); } { final boolean valid = BorderColor.isValid("transparent"); assertTrue(valid); } { final boolean valid = BorderColor.isValid("red green blue transparent"); assertTrue(valid); } { final boolean valid = BorderColor.isValid("red green blue white"); assertTrue(valid); } { final boolean valid = BorderColor.isValid("red green blue dfdf"); assertFalse(valid); } { final boolean valid = BorderColor.isValid("dfdf red green blue"); assertFalse(valid); } { final boolean valid = BorderColor.isValid("red dfdf green blue"); assertFalse(valid); } { final boolean valid = BorderColor.isValid("red green -dfdf blue"); assertFalse(valid); } { final boolean valid = BorderColor.isValid("red green blue dfdf"); assertFalse(valid); } { final boolean valid = BorderColor.isValid("red green blue initial"); assertFalse(valid); } { final boolean valid = BorderColor.isValid("red green blue inherit"); assertFalse(valid); } { final boolean valid = BorderColor.isValid("red green blue INITIAL"); assertFalse(valid); } { final boolean valid = BorderColor.isValid("red green blue INHERIT"); assertFalse(valid); } }