BorderImageSlice extends AbstractCssProperty<BorderImageSlice> { public static boolean isValid(final String cssValue) { final String trimmedCssValue = StringUtil.convertToSingleSpace( TagStringUtil.toLowerCase(StringUtil.strip(cssValue))); if (PREDEFINED_CONSTANTS.contains(trimmedCssValue)) { return true; } final String[] cssValueParts = StringUtil.splitBySpace(trimmedCssValue); if (cssValueParts.length > 5) { return false; } if ((cssValue.length() - cssValue.replace(FILL, "").length()) > FILL .length()) { return false; } for (final String cssValuePart : cssValueParts) { final Object[] lengthValueAndUnit = CssLengthUtil .getLengthValueAndUnit(cssValuePart); if (lengthValueAndUnit.length == 0 && !FILL.equals(cssValuePart)) { return false; } } return true; } BorderImageSlice();  BorderImageSlice(final String cssValue);  BorderImageSlice(final BorderImageSlice bottom);  BorderImageSlice(final float percent);  BorderImageSlice(final float value,
            final CssLengthUnit cssLengthUnit); void setPercent(final float percent); @Override String getCssName(); @Override String getCssValue(); @Override String toString(); @Override BorderImageSlice setCssValue(final String cssValue); void setAsInitial(); void setAsInherit(); void addFill(); void removeFill(); void setBorderImageTopRightBottomLeft(final Float top,
            final Float right, final Float bottom, final Float left,
            final CssLengthUnit unit); void setBorderImageTopRightBottomLeft(final Float top,
            final CssLengthUnit topUnit, final Float right,
            final CssLengthUnit rightUnit, final Float bottom,
            final CssLengthUnit bottomUnit, final Float left,
            final CssLengthUnit leftUnit); void setTop(final Float top, final CssLengthUnit topUnit); void setRight(final Float right, final CssLengthUnit rightUnit); void setBottom(final Float bottom, final CssLengthUnit bottomUnit); void setLeft(final Float left, final CssLengthUnit leftUnit); Float getTop(); CssLengthUnit getTopUnit(); Float getRight(); CssLengthUnit getRightUnit(); Float getBottom(); CssLengthUnit getBottomUnit(); Float getLeft(); CssLengthUnit getLeftUnit(); static boolean isValid(final String cssValue); boolean hasPredefinedConstantValue(); static final String FILL; static final String INITIAL; static final String INHERIT; }
@Test public void testIsValid() { { final boolean valid = BorderImageSlice.isValid("45px"); assertTrue(valid); assertTrue(BorderImageSlice.isValid("55")); } { final boolean valid = BorderImageSlice.isValid("45em 45px"); assertTrue(valid); final boolean invalid = BorderImageSlice.isValid("45em dfd 45px"); assertFalse(invalid); } { final boolean valid = BorderImageSlice.isValid("45%"); assertTrue(valid); final boolean invalid = BorderImageSlice.isValid("45 px"); assertFalse(invalid); } { final boolean valid = BorderImageSlice.isValid("45em"); assertTrue(valid); final boolean invalid = BorderImageSlice.isValid("45sem"); assertFalse(invalid); } { final boolean valid = BorderImageSlice.isValid("45rem"); assertTrue(valid); } { final boolean valid = BorderImageSlice .isValid("45px 25px 15px 45rem fill"); assertTrue(valid); } { final boolean valid = BorderImageSlice .isValid("45px 25px 15px 45rem fill"); assertTrue(valid); } { final boolean valid = BorderImageSlice.isValid("45rem fill"); assertTrue(valid); } { final boolean valid = BorderImageSlice.isValid("fill 45rem fill"); assertFalse(valid); } { final boolean valid = BorderImageSlice .isValid("45rem fill 45rem fill"); assertFalse(valid); } }