MozColumnCount extends AbstractCssProperty<MozColumnCount> { public static boolean isValid(final String cssValue) { final String trimmedCssValue = TagStringUtil .toLowerCase(StringUtil.strip(cssValue)); if (StringUtil.containsSpace(trimmedCssValue)) { return false; } try { final int parsedValue = Integer.parseInt(trimmedCssValue); return !(parsedValue == 0 && (StringUtil.containsMinus(trimmedCssValue) || StringUtil.containsPlus(trimmedCssValue))); } catch (final NumberFormatException e) { } return PREDEFINED_CONSTANTS.contains(trimmedCssValue); } MozColumnCount();  MozColumnCount(final String cssValue);  MozColumnCount(final MozColumnCount mozColumnCount);  MozColumnCount(final int value); @Override String getCssName(); @Override String getCssValue(); @Override String toString(); Integer getValue(); void setValue(final int value); @Override MozColumnCount setCssValue(final String cssValue); void setAsInitial(); void setAsInherit(); void setAsAuto(); static boolean isValid(final String cssValue); static final String INITIAL; static final String INHERIT; static final String AUTO; }
@Test public void testIsValid() { assertTrue(MozColumnCount.isValid("1")); assertTrue(MozColumnCount.isValid("0")); assertTrue(MozColumnCount.isValid(MozColumnCount.INITIAL)); assertTrue(MozColumnCount.isValid(MozColumnCount.INHERIT)); assertTrue(MozColumnCount.isValid(MozColumnCount.AUTO)); assertFalse(MozColumnCount.isValid(".5")); assertFalse(MozColumnCount.isValid("0.5")); assertFalse(MozColumnCount.isValid("0.1")); assertFalse(MozColumnCount.isValid("dfd")); assertFalse(MozColumnCount.isValid("1px")); assertFalse(MozColumnCount.isValid("")); assertFalse(MozColumnCount.isValid("1 1")); assertFalse(MozColumnCount.isValid("1.1")); assertFalse(MozColumnCount.isValid("-0.5")); assertFalse(MozColumnCount.isValid("-0")); assertFalse(MozColumnCount.isValid("-0.0")); assertFalse(MozColumnCount.isValid("+0.0")); }