BorderLeft extends AbstractCssProperty<BorderLeft> implements StateChangeInformer<CssProperty> { public BorderLeft setBorderLeftColor( final BorderLeftColor borderLeftColor) { final StringBuilder cssValueBuilder = new StringBuilder(); if (borderLeftWidth != null) { cssValueBuilder.append(borderLeftWidth.getCssValue()).append(' '); } if (borderLeftStyle != null) { cssValueBuilder.append(borderLeftStyle.getCssValue()).append(' '); } if (borderLeftColor != null) { final String borderLeftColorCssValue = borderLeftColor .getCssValue(); if (BorderLeftColor.INITIAL.equals(borderLeftColorCssValue) || BorderLeftColor.INHERIT .equals(borderLeftColorCssValue)) { throw new InvalidValueException( "borderLeftColor cannot have initial/inherit as its cssValue"); } cssValueBuilder.append(borderLeftColorCssValue); } final String trimmedCssValue = StringBuilderUtil .getTrimmedString(cssValueBuilder).toString(); cssValue = trimmedCssValue.isEmpty() ? INHERIT : trimmedCssValue; if (borderLeftColor != null && borderLeftColor.isAlreadyInUse() && this.borderLeftColor != borderLeftColor) { if (LOGGER.isLoggable(Level.WARNING)) { LOGGER.warning( "the given borderLeftColor is already used by another object so a new object or the previous object (if it exists) of BorderLeftColor will be used"); } return setCssValue(cssValue); } if (this.borderLeftColor != null) { this.borderLeftColor.setAlreadyInUse(false); } this.borderLeftColor = borderLeftColor; if (this.borderLeftColor != null) { this.borderLeftColor.setStateChangeInformer(this); this.borderLeftColor.setAlreadyInUse(true); } if (getStateChangeInformer() != null) { getStateChangeInformer().stateChanged(this); } return this; } BorderLeft();  BorderLeft(final String cssValue);  BorderLeft(final BorderLeft borderLeft); @Override String getCssName(); @Override String getCssValue(); @Override String toString(); @Override BorderLeft setCssValue(final String cssValue); static boolean isValid(final String cssValue); void setAsInitial(); void setAsInherit(); BorderLeftColor getBorderLeftColor(); BorderLeftStyle getBorderLeftStyle(); BorderLeftWidth getBorderLeftWidth(); BorderLeft setBorderLeftWidth(
            final BorderLeftWidth borderLeftWidth); BorderLeft setBorderLeftStyle(
            final BorderLeftStyle borderLeftStyle); BorderLeft setBorderLeftColor(
            final BorderLeftColor borderLeftColor); @Override void stateChanged(final CssProperty stateChangedObject); static final String INITIAL; static final String INHERIT; }
@Test public void testSetBorderLeftColor() { BorderLeft border = new BorderLeft(); border.setCssValue("thick solid green"); assertEquals("thick solid green", border.getCssValue()); final BorderLeftColor borderLeftColor = border.getBorderLeftColor(); assertTrue(borderLeftColor.isAlreadyInUse()); assertEquals("green", borderLeftColor.getCssValue()); border.setBorderLeftColor(new BorderLeftColor("blue")); assertEquals("thick solid blue", border.getCssValue()); border.setCssValue("thick solid"); assertNull(border.getBorderLeftColor()); assertFalse(borderLeftColor.isAlreadyInUse()); assertEquals("thick solid", border.getCssValue()); }
@Test(expected = InvalidValueException.class) public void testSetBorderLeftColorInvalidValue() { BorderLeft border = new BorderLeft(); border.setBorderLeftColor(new BorderLeftColor()); }