BorderBottom extends AbstractCssProperty<BorderBottom> implements StateChangeInformer<CssProperty> { public BorderBottom setBorderBottomColor( final BorderBottomColor borderBottomColor) { final StringBuilder cssValueBuilder = new StringBuilder(); if (borderBottomWidth != null) { cssValueBuilder.append(borderBottomWidth.getCssValue()).append(' '); } if (borderBottomStyle != null) { cssValueBuilder.append(borderBottomStyle.getCssValue()).append(' '); } if (borderBottomColor != null) { final String borderBottomColorCssValue = borderBottomColor .getCssValue(); if (BorderBottomColor.INITIAL.equals(borderBottomColorCssValue) || BorderBottomColor.INHERIT .equals(borderBottomColorCssValue)) { throw new InvalidValueException( "borderBottomColor cannot have initial/inherit as its cssValue"); } cssValueBuilder.append(borderBottomColorCssValue); } final String trimmedCssValue = StringBuilderUtil .getTrimmedString(cssValueBuilder).toString(); cssValue = trimmedCssValue.isEmpty() ? INHERIT : trimmedCssValue; if (borderBottomColor != null && borderBottomColor.isAlreadyInUse() && !Objects.equals(this.borderBottomColor, borderBottomColor)) { if (LOGGER.isLoggable(Level.WARNING)) { LOGGER.warning( "the given borderBottomColor is already used by another object so a new object or the previous object (if it exists) of BorderBottomColor will be used"); } return setCssValue(cssValue); } if (this.borderBottomColor != null) { this.borderBottomColor.setAlreadyInUse(false); } this.borderBottomColor = borderBottomColor; if (this.borderBottomColor != null) { this.borderBottomColor.setStateChangeInformer(this); this.borderBottomColor.setAlreadyInUse(true); } if (getStateChangeInformer() != null) { getStateChangeInformer().stateChanged(this); } return this; } BorderBottom();  BorderBottom(final String cssValue);  BorderBottom(final BorderBottom borderBottom); @Override String getCssName(); @Override String getCssValue(); @Override String toString(); @Override BorderBottom setCssValue(final String cssValue); static boolean isValid(final String cssValue); void setAsInitial(); void setAsInherit(); BorderBottomColor getBorderBottomColor(); BorderBottomStyle getBorderBottomStyle(); BorderBottomWidth getBorderBottomWidth(); BorderBottom setBorderBottomWidth(
            final BorderBottomWidth borderBottomWidth); BorderBottom setBorderBottomStyle(
            final BorderBottomStyle borderBottomStyle); BorderBottom setBorderBottomColor(
            final BorderBottomColor borderBottomColor); @Override void stateChanged(final CssProperty stateChangedObject); static final String INITIAL; static final String INHERIT; }
@Test public void testSetBorderBottomColor() { BorderBottom border = new BorderBottom(); border.setCssValue("thick solid green"); assertEquals("thick solid green", border.getCssValue()); final BorderBottomColor borderBottomColor = border.getBorderBottomColor(); assertTrue(borderBottomColor.isAlreadyInUse()); assertEquals("green", borderBottomColor.getCssValue()); border.setBorderBottomColor(new BorderBottomColor("blue")); assertEquals("thick solid blue", border.getCssValue()); border.setCssValue("thick solid"); assertNull(border.getBorderBottomColor()); assertFalse(borderBottomColor.isAlreadyInUse()); assertEquals("thick solid", border.getCssValue()); }
@Test(expected = InvalidValueException.class) public void testSetBorderBottomColorInvalidValue() { BorderBottom border = new BorderBottom(); border.setBorderBottomColor(new BorderBottomColor()); }