BorderBottomColor extends AbstractCssProperty<BorderBottomColor> implements StateChangeInformer<Bean> { public void setRgbCssValue(final RgbCssValue rgbCssValue) { if (rgbCssValue == null) { throw new NullValueException("rgbCssValue can not be null"); } if (this.rgbCssValue != null) { if (rgbCssValue.isAlreadyInUse() && !Objects.equals( this.rgbCssValue.getStateChangeInformer(), rgbCssValue.getStateChangeInformer()) ) { try { final RgbCssValue rgbCssValueClone = CloneUtil .deepClone(rgbCssValue); this.rgbCssValue.setAlreadyInUse(false); this.rgbCssValue = rgbCssValueClone; if (LOGGER.isLoggable(Level.WARNING)) { LOGGER.warning("cloned rgbCssValue " + rgbCssValue + "(hashcode: " + rgbCssValue.hashCode() + ") as it is already used by another object"); } } catch (final CloneNotSupportedException e) { throw new InvalidValueException(e.toString()); } } else { this.rgbCssValue.setAlreadyInUse(false); this.rgbCssValue = rgbCssValue; } } else { if (rgbCssValue.isAlreadyInUse()) { try { this.rgbCssValue = CloneUtil.deepClone(rgbCssValue); if (LOGGER.isLoggable(Level.WARNING)) { LOGGER.warning("cloned rgbCssValue " + rgbCssValue + "(hashcode: " + rgbCssValue.hashCode() + ") as it is already used by another object"); } } catch (final CloneNotSupportedException e) { throw new InvalidValueException(e.toString()); } } else { this.rgbCssValue = rgbCssValue; } } cssValue = this.rgbCssValue.getValue(); this.rgbCssValue.setStateChangeInformer(this); this.rgbCssValue.setAlreadyInUse(true); makeRgbaCssValueNull(); makeHslCssValueNull(); makeHslaCssValueNull(); } BorderBottomColor();  BorderBottomColor(final String cssValue);  BorderBottomColor(final BorderBottomColor borderBottomColor);  BorderBottomColor(final RgbCssValue rgbCssValue); BorderBottomColor setValue(final String value); @Override String getCssName(); @Override String getCssValue(); @Override String toString(); String getValue(); @Override BorderBottomColor setCssValue(final String cssValue); void setAsInitial(); void setAsInherit(); void setAsTransparent(); static boolean isValid(final String cssValue); @Override void stateChanged(final Bean stateChangedObject); RgbCssValue getRgbCssValue(); RgbaCssValue getRgbaCssValue(); HslCssValue getHslCssValue(); HslaCssValue getHslaCssValue(); void setRgbCssValue(final RgbCssValue rgbCssValue); void setRgbaCssValue(final RgbaCssValue rgbaCssValue); void setHslCssValue(final HslCssValue hslCssValue); void setHslaCssValue(final HslaCssValue hslaCssValue); boolean hasPredefinedConstantValue(); static final String INITIAL; static final String INHERIT; static final String TRANSPARENT; }
@Test public void testSetRgbCssValue() { try { BorderBottomColor borderBottomColor = new BorderBottomColor(); RgbCssValue rgbCssValue = new RgbCssValue("rgb(15, 25, 255)"); borderBottomColor.setRgbCssValue(rgbCssValue); borderBottomColor.setRgbCssValue(rgbCssValue); assertEquals(CssNameConstants.BORDER_BOTTOM_COLOR + ": rgb(15, 25, 255)", borderBottomColor.toString()); assertEquals("rgb(15, 25, 255)", borderBottomColor.getCssValue()); BorderBottomColor borderBottomColor2 = new BorderBottomColor(); borderBottomColor2.setRgbCssValue(rgbCssValue); RgbCssValue rgbCssValueClone = borderBottomColor2.getRgbCssValue(); assertNotEquals(borderBottomColor.getRgbCssValue(), rgbCssValueClone); RgbCssValue rgbCssValue2 = new RgbCssValue("rgb(55, 5, 255)"); borderBottomColor2.setRgbCssValue(rgbCssValue2); assertNotEquals(rgbCssValueClone, borderBottomColor2.getRgbCssValue()); assertEquals(rgbCssValue2, borderBottomColor2.getRgbCssValue()); borderBottomColor2.setAsTransparent(); assertEquals(BorderBottomColor.TRANSPARENT, borderBottomColor2.getCssValue()); assertNull(borderBottomColor2.getRgbCssValue()); assertFalse(rgbCssValue2.isAlreadyInUse()); } catch (Exception e) { e.printStackTrace(); fail(); } }