BorderLeft extends AbstractCssProperty<BorderLeft> implements StateChangeInformer<CssProperty> { public BorderLeft setBorderLeftWidth( final BorderLeftWidth borderLeftWidth) { final StringBuilder cssValueBuilder = new StringBuilder(); if (borderLeftWidth != null) { final String borderLeftWidthCssValue = borderLeftWidth .getCssValue(); if (BorderLeftWidth.INITIAL.equals(borderLeftWidthCssValue) || BorderLeftWidth.INHERIT .equals(borderLeftWidthCssValue)) { throw new InvalidValueException( "borderLeftWidth cannot have initial/inherit as its cssValue"); } cssValueBuilder.append(borderLeftWidth.getCssValue()).append(' '); } if (borderLeftStyle != null) { cssValueBuilder.append(borderLeftStyle.getCssValue()).append(' '); } if (borderLeftColor != null) { cssValueBuilder.append(borderLeftColor.getCssValue()).append(' '); } final String trimmedCssValue = StringBuilderUtil .getTrimmedString(cssValueBuilder).toString(); cssValue = trimmedCssValue.isEmpty() ? INHERIT : trimmedCssValue; if (borderLeftWidth != null && borderLeftWidth.isAlreadyInUse() && this.borderLeftWidth != borderLeftWidth) { if (LOGGER.isLoggable(Level.WARNING)) { LOGGER.warning( "the given borderLeftWidth is already used by another object so a new object or the previous object (if it exists) of BorderLeftWidth will be used"); } return setCssValue(cssValue); } if (this.borderLeftWidth != null) { this.borderLeftWidth.setAlreadyInUse(false); } this.borderLeftWidth = borderLeftWidth; if (this.borderLeftWidth != null) { this.borderLeftWidth.setStateChangeInformer(this); this.borderLeftWidth.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 testSetBorderLeftWidth() { BorderLeft border = new BorderLeft(); border.setCssValue("thick solid green"); assertEquals("thick solid green", border.getCssValue()); final BorderLeftWidth borderLeftWidth = border.getBorderLeftWidth(); assertTrue(borderLeftWidth.isAlreadyInUse()); assertEquals("thick", borderLeftWidth.getCssValue()); border.setBorderLeftWidth(new BorderLeftWidth()); border.setCssValue("solid green"); assertNull(border.getBorderLeftWidth()); assertFalse(borderLeftWidth.isAlreadyInUse()); assertEquals("solid green", border.getCssValue()); }
@Test(expected = InvalidValueException.class) public void testSetBorderLeftWidthInvalidValue() { BorderLeft border = new BorderLeft(); border.setBorderLeftWidth(new BorderLeftWidth("initial")); }