Border extends AbstractCssProperty<Border> implements StateChangeInformer<Bean> { public static boolean isValid(final String cssValue) { final String trimmedCssValue; if (cssValue == null || (trimmedCssValue = StringUtil.strip(cssValue)).isEmpty()) { return false; } if (INITIAL.equals(trimmedCssValue) || INHERIT.equals(trimmedCssValue)) { return true; } final List<String> cssValueParts = CssValueUtil.split(trimmedCssValue); if (cssValueParts.size() > 1 && (trimmedCssValue.contains(INITIAL) || trimmedCssValue.contains(INHERIT))) { return false; } BorderTopWidth width = null; BorderStyle borderStyle = null; BorderColorCssValues borderColorCssValues = null; for (final String eachPart : cssValueParts) { boolean invalid = true; if (width == null && BorderTopWidth.isValid(eachPart)) { width = new BorderTopWidth(eachPart); invalid = false; } else if (borderStyle == null && BorderStyle.isValid(eachPart)) { borderStyle = BorderStyle.getThis(eachPart); invalid = false; } else if (borderColorCssValues == null && BorderColorCssValues.isValid(eachPart)) { borderColorCssValues = new BorderColorCssValues(eachPart); invalid = false; } if (invalid) { return false; } } return true; } Border();  Border(final String cssValue);  Border(final Border border); @Override String getCssName(); @Override String getCssValue(); @Override String toString(); @Override Border setCssValue(final String cssValue); static boolean isValid(final String cssValue); void setAsInitial(); void setAsInherit(); BorderColorCssValues getBorderColorCssValues(); BorderStyle getBorderStyle(); Border setBorderWidthValue(final String borderWidthValue); Border setBorderStyle(final BorderStyle borderStyle); Border setBorderColorCssValues(
            final BorderColorCssValues borderColorCssValues); String getBorderWidthValue(); @Override void stateChanged(final Bean stateChangedObject); static final String INITIAL; static final String INHERIT; }
@Test public void testIsValid() { assertTrue(Border.isValid("55px solid green")); assertTrue(Border.isValid("55px")); assertTrue(Border.isValid("solid")); assertTrue(Border.isValid("green")); assertTrue(Border.isValid(BorderWidth.MEDIUM + " " + BorderStyle.DASHED.getCssValue() + " " + CssColorName.AZURE)); assertTrue(Border.isValid(BorderWidth.THICK + " " + BorderStyle.DOUBLE.getCssValue() + " " + CssColorName.AZURE)); assertFalse(Border.isValid("cir cle inside url(Test.png)")); assertFalse(Border.isValid("dmedium dfdf dfdfd")); assertFalse(Border.isValid("medium medium medium ")); assertFalse(Border.isValid("55 solid green")); assertFalse(Border.isValid("solid solid solid")); assertFalse(Border.isValid("55px solid green green")); }