ListStyle extends AbstractCssProperty<ListStyle> implements StateChangeInformer<CssProperty> { public ListStyle setListStyleImage(final ListStyleImage listStyleImage) { final StringBuilder cssValueBuilder = new StringBuilder(); if (listStyleType != null) { cssValueBuilder.append(listStyleType.getCssValue()).append(' '); } if (listStylePosition != null) { cssValueBuilder.append(listStylePosition.getCssValue()).append(' '); } if (listStyleImage != null) { final String listStyleImageCssValue = listStyleImage.getCssValue(); if (ListStyleImage.INITIAL.equals(listStyleImageCssValue) || ListStyleImage.INHERIT.equals(listStyleImageCssValue)) { throw new InvalidValueException( "listStyleImage cannot have initial/inherit as its cssValue"); } cssValueBuilder.append(listStyleImageCssValue); } final String trimmedCssValue = StringBuilderUtil .getTrimmedString(cssValueBuilder); cssValue = trimmedCssValue.isEmpty() ? INHERIT : trimmedCssValue; if (listStyleImage != null && listStyleImage.isAlreadyInUse() && this.listStyleImage != listStyleImage) { if (LOGGER.isLoggable(Level.WARNING)) { LOGGER.warning( "the given listStyleImage is already used by another object so a new object or the previous object (if it exists) of ListStyleImage will be used"); } return setCssValue(cssValue); } if (this.listStyleImage != null) { this.listStyleImage.setAlreadyInUse(false); } this.listStyleImage = listStyleImage; if (this.listStyleImage != null) { this.listStyleImage.setStateChangeInformer(this); this.listStyleImage.setAlreadyInUse(true); } if (getStateChangeInformer() != null) { getStateChangeInformer().stateChanged(this); } return this; } ListStyle();  ListStyle(final String cssValue);  ListStyle(final ListStyle listStyle); @Override String getCssName(); @Override String getCssValue(); @Override String toString(); @Override ListStyle setCssValue(final String cssValue); static boolean isValid(final String cssValue); void setAsInitial(); void setAsInherit(); ListStyleImage getListStyleImage(); ListStylePosition getListStylePosition(); ListStyleType getListStyleType(); ListStyle setListStyleType(final ListStyleType listStyleType); ListStyle setListStylePosition(
            final ListStylePosition listStylePosition); ListStyle setListStyleImage(final ListStyleImage listStyleImage); @Override void stateChanged(final CssProperty stateChangedObject); static final String INITIAL; static final String INHERIT; }
@Test public void testSetListStyleImage() { try { final ListStyle listStyle = new ListStyle(); listStyle.setCssValue("circle inside url(Test.png)"); listStyle.setListStyleImage( new ListStyleImage().setUrl("Another.jpg")); assertEquals("circle inside url(\"Another.jpg\")", listStyle.getCssValue()); assertNotNull(listStyle.getListStyleImage()); assertEquals("url(\"Another.jpg\")", listStyle.getListStyleImage().getCssValue()); } catch (final Exception e) { e.printStackTrace(); fail("testSetCssValueString failed"); } }