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