StrategyBasedLinearGradientBuilder extends AbstractLinearGradientBuilder { public StrategyBasedLinearGradientBuilder setGradientDirectionAsCentralRotationAngle(double radians) { this.rotateVectorAngle = radians; this.isCentralRotationAngleStrategy = true; return this; } StrategyBasedLinearGradientBuilder(); StrategyBasedLinearGradientBuilder setGradientDirectionAsCentralRotationAngle(double radians); StrategyBasedLinearGradientBuilder setGradientDirectionAsStrategy(GradientStrategy gradientStrategy); double getRotateVectorAngle(); GradientStrategy getGradientStrategy(); boolean isCentralRotationAngleStrategy();  }
@Test public void builderZeroAngleTest() throws IOException, InterruptedException { AbstractLinearGradientBuilder gradientBuilder = new StrategyBasedLinearGradientBuilder() .setGradientDirectionAsCentralRotationAngle(0d) .addColorStop(new GradientColorStop(ColorConstants.RED.getColorValue(), 0d, OffsetType.RELATIVE)) .addColorStop(new GradientColorStop(ColorConstants.GREEN.getColorValue(), 0.5, OffsetType.RELATIVE)) .addColorStop(new GradientColorStop(ColorConstants.BLUE.getColorValue(), 1d, OffsetType.RELATIVE)); generateAndComparePdfs("builderZeroAngleTest.pdf", null, gradientBuilder); }
@Test public void builderPositiveAngleTest() throws IOException, InterruptedException { AbstractLinearGradientBuilder gradientBuilder = new StrategyBasedLinearGradientBuilder() .setGradientDirectionAsCentralRotationAngle(Math.PI/3) .addColorStop(new GradientColorStop(ColorConstants.RED.getColorValue(), 0d, OffsetType.RELATIVE)) .addColorStop(new GradientColorStop(ColorConstants.GREEN.getColorValue(), 0.5, OffsetType.RELATIVE)) .addColorStop(new GradientColorStop(ColorConstants.BLUE.getColorValue(), 1d, OffsetType.RELATIVE)); generateAndComparePdfs("builderPositiveAngleTest.pdf", null, gradientBuilder); }
@Test public void builderNegativeAngleTest() throws IOException, InterruptedException { AbstractLinearGradientBuilder gradientBuilder = new StrategyBasedLinearGradientBuilder() .setGradientDirectionAsCentralRotationAngle(-Math.PI/3) .addColorStop(new GradientColorStop(ColorConstants.RED.getColorValue(), 0d, OffsetType.RELATIVE)) .addColorStop(new GradientColorStop(ColorConstants.GREEN.getColorValue(), 0.5, OffsetType.RELATIVE)) .addColorStop(new GradientColorStop(ColorConstants.BLUE.getColorValue(), 1d, OffsetType.RELATIVE)); generateAndComparePdfs("builderNegativeAngleTest.pdf", null, gradientBuilder); }