BorderRight extends AbstractCssProperty<BorderRight> implements StateChangeInformer<CssProperty> { public BorderRight setBorderRightColor( final BorderRightColor borderRightColor) { final StringBuilder cssValueBuilder = new StringBuilder(); if (borderRightWidth != null) { cssValueBuilder.append(borderRightWidth.getCssValue()).append(' '); } if (borderRightStyle != null) { cssValueBuilder.append(borderRightStyle.getCssValue()).append(' '); } if (borderRightColor != null) { final String borderRightColorCssValue = borderRightColor .getCssValue(); if (BorderRightColor.INITIAL.equals(borderRightColorCssValue) || BorderRightColor.INHERIT .equals(borderRightColorCssValue)) { throw new InvalidValueException( "borderRightColor cannot have initial/inherit as its cssValue"); } cssValueBuilder.append(borderRightColorCssValue); } final String trimmedCssValue = StringBuilderUtil .getTrimmedString(cssValueBuilder).toString(); cssValue = trimmedCssValue.isEmpty() ? INHERIT : trimmedCssValue; if (borderRightColor != null && borderRightColor.isAlreadyInUse() && this.borderRightColor != borderRightColor) { if (LOGGER.isLoggable(Level.WARNING)) { LOGGER.warning( "the given borderRightColor is already used by another object so a new object or the previous object (if it exists) of BorderRightColor will be used"); } return setCssValue(cssValue); } if (this.borderRightColor != null) { this.borderRightColor.setAlreadyInUse(false); } this.borderRightColor = borderRightColor; if (this.borderRightColor != null) { this.borderRightColor.setStateChangeInformer(this); this.borderRightColor.setAlreadyInUse(true); } if (getStateChangeInformer() != null) { getStateChangeInformer().stateChanged(this); } return this; } BorderRight();  BorderRight(final String cssValue);  BorderRight(final BorderRight borderRight); @Override String getCssName(); @Override String getCssValue(); @Override String toString(); @Override BorderRight setCssValue(final String cssValue); static boolean isValid(final String cssValue); void setAsInitial(); void setAsInherit(); BorderRightColor getBorderRightColor(); BorderRightStyle getBorderRightStyle(); BorderRightWidth getBorderRightWidth(); BorderRight setBorderRightWidth(
            final BorderRightWidth borderRightWidth); BorderRight setBorderRightStyle(
            final BorderRightStyle borderRightStyle); BorderRight setBorderRightColor(
            final BorderRightColor borderRightColor); @Override void stateChanged(final CssProperty stateChangedObject); static final String INITIAL; static final String INHERIT; }
@Test public void testSetBorderRightColor() { BorderRight border = new BorderRight(); border.setCssValue("thick solid green"); assertEquals("thick solid green", border.getCssValue()); final BorderRightColor borderRightColor = border.getBorderRightColor(); assertTrue(borderRightColor.isAlreadyInUse()); assertEquals("green", borderRightColor.getCssValue()); border.setBorderRightColor(new BorderRightColor("blue")); assertEquals("thick solid blue", border.getCssValue()); border.setCssValue("thick solid"); assertNull(border.getBorderRightColor()); assertFalse(borderRightColor.isAlreadyInUse()); assertEquals("thick solid", border.getCssValue()); }
@Test(expected = InvalidValueException.class) public void testSetBorderRightColorInvalidValue() { BorderRight border = new BorderRight(); border.setBorderRightColor(new BorderRightColor()); }