FlexShrink extends AbstractCssProperty<FlexShrink> { @Override public FlexShrink setCssValue(final String cssValue) { final String previousCssValue = this.cssValue; try { if (cssValue == null) { throw new NullValueException( "null is an invalid value. The value format should be as for example 0.5, initial/inherit."); } else { final String trimmedCssValue = TagStringUtil .toLowerCase(StringUtil.strip(cssValue)); if (INITIAL.equals(trimmedCssValue) || INHERIT.equals(trimmedCssValue)) { this.cssValue = trimmedCssValue; value = null; } else { try { value = Float.valueOf(trimmedCssValue); this.cssValue = value.toString(); } catch (final NumberFormatException e) { throw new InvalidValueException(cssValue + " is an invalid value. The value format should be as for example 0.5, initial, inherit etc.."); } } } if (getStateChangeInformer() != null) { getStateChangeInformer().stateChanged(this); } } catch (final InvalidValueException e) { this.cssValue = previousCssValue; throw e; } return this; } FlexShrink();  FlexShrink(final String cssValue);  FlexShrink(final FlexShrink flexShrink);  FlexShrink(final float value); @Override String getCssName(); @Override String getCssValue(); @Override String toString(); Float getValue(); void setValue(final float value); @Override FlexShrink setCssValue(final String cssValue); void setAsInitial(); void setAsInherit(); static boolean isValid(final String cssValue); static final String INITIAL; static final String INHERIT; }
@Test(expected = InvalidValueException.class) public void testSetCssValueInvalidValue1() throws Exception { try { new FlexShrink().setCssValue("1px"); } catch (Exception e) { throw e; } }