ListStyleImage extends AbstractCssProperty<ListStyleImage> { @Override public ListStyleImage setCssValue(final String cssValue) { final String previousCssValue = this.cssValue; try { String trimmedCssValue = null; if (cssValue == null) { throw new NullValueException( "null is an invalid value. The value format should be as for example url(/images/Test.png). Or, initial/inherit."); } else if ((trimmedCssValue = StringUtil.strip(cssValue)) .equalsIgnoreCase(INITIAL) || trimmedCssValue.equalsIgnoreCase(INHERIT) || trimmedCssValue.equalsIgnoreCase(NONE)) { this.cssValue = StringUtil.strip(cssValue).toLowerCase(); url = null; } else if (trimmedCssValue.toLowerCase().startsWith("url(") && trimmedCssValue.endsWith(")")) { url = trimmedCssValue.substring( trimmedCssValue.toLowerCase().indexOf("url(") + 4, trimmedCssValue.indexOf(')')); if (url.length() > 0 && url.charAt(0) == '"' && url.charAt(url.length() - 1) == '"') { url = url.substring(url.indexOf('\"') + 1, url.lastIndexOf('\"')); } this.cssValue = "url(\"" + url + "\")"; } else { throw new InvalidValueException(cssValue + " is an invalid value. The value format should be as for example url(/images/Test.png). Or, initial/inherit."); } if (getStateChangeInformer() != null) { getStateChangeInformer().stateChanged(this); } } catch (final WffRuntimeException e) { this.cssValue = previousCssValue; throw new InvalidValueException(e.getMessage(), e); } catch (final NumberFormatException e) { this.cssValue = previousCssValue; throw new InvalidValueException(cssValue + " is an invalid value. The value format should be as for example url(/images/Test.png). Or, initial/inherit.", e); } return this; } ListStyleImage();  ListStyleImage(final String cssValue);  ListStyleImage(final String value, final boolean urlValue);  ListStyleImage(final ListStyleImage listStyleImage); @Override String getCssName(); @Override String getCssValue(); @Override String toString(); @Override ListStyleImage setCssValue(final String cssValue); ListStyleImage setUrl(final String url); String getUrl(); void setAsInitial(); void setAsInherit(); void setAsNone(); boolean hasInbuiltValue(); static boolean isValid(final String cssValue); static final String NONE; static final String INITIAL; static final String INHERIT; }
@Test public void testSetCssValue() { ListStyleImage listStyleImage = new ListStyleImage(); listStyleImage.setUrl("http: assertEquals( "list-style-image: url(\"http: listStyleImage.toString()); assertEquals("http: listStyleImage.getUrl()); listStyleImage .setCssValue("url(\"http: assertEquals("http: listStyleImage.getUrl()); System.out.println(listStyleImage); }