ColumnWidth extends AbstractCssProperty<ColumnWidth> { public static boolean isValid(final String cssValue) { final String trimmedCssValue = TagStringUtil .toLowerCase(StringUtil.strip(cssValue)); if (StringUtil.containsSpace(trimmedCssValue)) { return false; } for (final CssLengthUnit cssLengthUnit : CssLengthUnit.values()) { final String unit = cssLengthUnit.getUnit(); if (trimmedCssValue.endsWith(unit)) { final String valueOnly = trimmedCssValue.replaceFirst(unit, ""); try { Float.parseFloat(valueOnly); } catch (final NumberFormatException e) { break; } return true; } } return PREDEFINED_CONSTANTS.contains(trimmedCssValue); } ColumnWidth();  ColumnWidth(final String cssValue);  ColumnWidth(final ColumnWidth columnWidth);  ColumnWidth(final float percent);  ColumnWidth(final float value, final CssLengthUnit cssLengthUnit); ColumnWidth setValue(final float value,
            final CssLengthUnit cssLengthUnit); void setPercent(final float percent); @Override String getCssName(); @Override String getCssValue(); @Override String toString(); Float getValue(); CssLengthUnit getUnit(); @Override ColumnWidth setCssValue(final String cssValue); void setAsInitial(); void setAsInherit(); void setAsAuto(); static boolean isValid(final String cssValue); static final String AUTO; static final String INITIAL; static final String INHERIT; }
@Test public void testIsValid() { { final boolean valid = ColumnWidth.isValid(ColumnWidth.AUTO); assertTrue(valid); } { final boolean valid = ColumnWidth.isValid("45px"); assertTrue(valid); final boolean invalid = ColumnWidth.isValid("55"); assertFalse(invalid); } { final boolean valid = ColumnWidth.isValid("45em"); assertTrue(valid); final boolean invalid = ColumnWidth.isValid("dfd"); assertFalse(invalid); } { final boolean valid = ColumnWidth.isValid("45%"); assertTrue(valid); final boolean invalid = ColumnWidth.isValid("45 px"); assertFalse(invalid); } { final boolean valid = ColumnWidth.isValid("45em"); assertTrue(valid); final boolean invalid = ColumnWidth.isValid("45sem"); assertFalse(invalid); } { final boolean valid = ColumnWidth.isValid("45rem"); assertTrue(valid); } }