BorderImageSlice extends AbstractCssProperty<BorderImageSlice> { protected static String getProducedCssValue(final Float top, final CssLengthUnit topUnit, final Float right, final CssLengthUnit rightUnit, final Float bottom, final CssLengthUnit bottomUnit, final Float left, final CssLengthUnit leftUnit, final String middle) { if ((ObjectUtil.isEqual(top, right) && Objects.equals(topUnit, rightUnit)) && (ObjectUtil.isEqual(right, bottom) && ObjectUtil.isEqual(rightUnit, bottomUnit)) && (ObjectUtil.isEqual(bottom, left) && Objects.equals(bottomUnit, leftUnit))) { if (middle != null) { return (top != null && topUnit != null ? String.valueOf(top).concat(topUnit.getUnit()) : top != null ? String.valueOf(top) : DEFAULT_VALUE) .concat(" ").concat(middle); } return top != null && topUnit != null ? String.valueOf(top).concat(topUnit.getUnit()) : top != null ? String.valueOf(top) : DEFAULT_VALUE; } else if ((ObjectUtil.isEqual(top, bottom) && Objects.equals(topUnit, bottomUnit)) && (ObjectUtil.isEqual(right, left) && Objects.equals(rightUnit, leftUnit))) { final StringBuilder cssValueBuilder = new StringBuilder(); if (top != null) { cssValueBuilder.append(top); if (topUnit != null) { cssValueBuilder.append(topUnit.getUnit()); } } cssValueBuilder.append(' '); if (right != null) { cssValueBuilder.append(right); if (rightUnit != null) { cssValueBuilder.append(rightUnit.getUnit()); } } if (middle != null) { cssValueBuilder.append(' ').append(middle); } return cssValueBuilder.toString(); } else if ((ObjectUtil.isEqual(right, left) && Objects.equals(rightUnit, leftUnit))) { final StringBuilder cssValueBuilder = new StringBuilder(); if (top != null) { cssValueBuilder.append(top); if (topUnit != null) { cssValueBuilder.append(topUnit.getUnit()); } } cssValueBuilder.append(' '); if (right != null) { cssValueBuilder.append(right); if (rightUnit != null) { cssValueBuilder.append(rightUnit.getUnit()); } } cssValueBuilder.append(' '); if (bottom != null) { cssValueBuilder.append(bottom); if (bottomUnit != null) { cssValueBuilder.append(bottomUnit.getUnit()); } } if (middle != null) { cssValueBuilder.append(' ').append(middle); } return cssValueBuilder.toString(); } else { final StringBuilder cssValueBuilder = new StringBuilder(); if (top != null) { cssValueBuilder.append(top); if (topUnit != null) { cssValueBuilder.append(topUnit.getUnit()); } } cssValueBuilder.append(' '); if (right != null) { cssValueBuilder.append(right); if (rightUnit != null) { cssValueBuilder.append(rightUnit.getUnit()); } } cssValueBuilder.append(' '); if (bottom != null) { cssValueBuilder.append(bottom); if (bottomUnit != null) { cssValueBuilder.append(bottomUnit.getUnit()); } } cssValueBuilder.append(' '); if (left != null) { cssValueBuilder.append(left); if (leftUnit != null) { cssValueBuilder.append(leftUnit.getUnit()); } } if (middle != null) { cssValueBuilder.append(' ').append(middle); } return cssValueBuilder.toString(); } } BorderImageSlice();  BorderImageSlice(final String cssValue);  BorderImageSlice(final BorderImageSlice bottom);  BorderImageSlice(final float percent);  BorderImageSlice(final float value,
            final CssLengthUnit cssLengthUnit); void setPercent(final float percent); @Override String getCssName(); @Override String getCssValue(); @Override String toString(); @Override BorderImageSlice setCssValue(final String cssValue); void setAsInitial(); void setAsInherit(); void addFill(); void removeFill(); void setBorderImageTopRightBottomLeft(final Float top,
            final Float right, final Float bottom, final Float left,
            final CssLengthUnit unit); void setBorderImageTopRightBottomLeft(final Float top,
            final CssLengthUnit topUnit, final Float right,
            final CssLengthUnit rightUnit, final Float bottom,
            final CssLengthUnit bottomUnit, final Float left,
            final CssLengthUnit leftUnit); void setTop(final Float top, final CssLengthUnit topUnit); void setRight(final Float right, final CssLengthUnit rightUnit); void setBottom(final Float bottom, final CssLengthUnit bottomUnit); void setLeft(final Float left, final CssLengthUnit leftUnit); Float getTop(); CssLengthUnit getTopUnit(); Float getRight(); CssLengthUnit getRightUnit(); Float getBottom(); CssLengthUnit getBottomUnit(); Float getLeft(); CssLengthUnit getLeftUnit(); static boolean isValid(final String cssValue); boolean hasPredefinedConstantValue(); static final String FILL; static final String INITIAL; static final String INHERIT; }
@Test public void testGetProducedCssValue() { assertEquals("5.0ch 10.0cm 15.0em 20.0ex fill", BorderImageSlice.getProducedCssValue(5F, CssLengthUnit.CH, 10F, CssLengthUnit.CM, 15F, CssLengthUnit.EM, 20F, CssLengthUnit.EX, BorderImageSlice.FILL)); assertEquals("5.0ch 10.0cm 15.0em 20.0ex", BorderImageSlice.getProducedCssValue(5F, CssLengthUnit.CH, 10F, CssLengthUnit.CM, 15F, CssLengthUnit.EM, 20F, CssLengthUnit.EX, null)); assertEquals("5.0px fill", BorderImageSlice.getProducedCssValue(5F, CssLengthUnit.PX, 5F, CssLengthUnit.PX, 5F, CssLengthUnit.PX, 5F, CssLengthUnit.PX, BorderImageSlice.FILL)); assertEquals("5.0px", BorderImageSlice.getProducedCssValue(5F, CssLengthUnit.PX, 5F, CssLengthUnit.PX, 5F, CssLengthUnit.PX, 5F, CssLengthUnit.PX, null)); assertEquals("5.0px 15.0px fill", BorderImageSlice.getProducedCssValue(5F, CssLengthUnit.PX, 15F, CssLengthUnit.PX, 5F, CssLengthUnit.PX, 15F, CssLengthUnit.PX, BorderImageSlice.FILL)); assertEquals("5.0px 15.0px", BorderImageSlice.getProducedCssValue(5F, CssLengthUnit.PX, 15F, CssLengthUnit.PX, 5F, CssLengthUnit.PX, 15F, CssLengthUnit.PX, null)); assertEquals("5.0px 15.0px 25.0px fill", BorderImageSlice.getProducedCssValue(5F, CssLengthUnit.PX, 15F, CssLengthUnit.PX, 25F, CssLengthUnit.PX, 15F, CssLengthUnit.PX, BorderImageSlice.FILL)); assertEquals("5.0px 15.0px 25.0px", BorderImageSlice.getProducedCssValue(5F, CssLengthUnit.PX, 15F, CssLengthUnit.PX, 25F, CssLengthUnit.PX, 15F, CssLengthUnit.PX, null)); }