}
private void testConstructor4(TestHarness harness)
{
harness.checkPoint("(Point2D, Color, Point2D, Color, boolean)");
GradientPaint gp = new GradientPaint(
new Point2D.Float(1.0f, 2.0f), Color.red,
new Point2D.Float(3.0f, 4.0f), Color.blue, true
);
harness.check(gp.getPoint1().getX(), 1.0);
harness.check(gp.getPoint1().getY(), 2.0);
harness.check(gp.getColor1(), Color.red);
harness.check(gp.getPoint2().getX(), 3.0);
harness.check(gp.getPoint2().getY(), 4.0);
harness.check(gp.getColor2(), Color.blue);
harness.check(gp.isCyclic(), true);
// try null arguments
boolean pass = false;
try
{
gp = new GradientPaint(null, Color.red, new Point2D.Float(3.0f, 4.0f), Color.blue, true);
}
catch (NullPointerException e)
{
pass = true;
}
harness.check(pass);
pass = false;
try
{
gp = new GradientPaint(new Point2D.Float(1.0f, 2.0f), null, new Point2D.Float(3.0f, 4.0f), Color.blue, true);
}
catch (NullPointerException e)
{
pass = true;
}
harness.check(pass);
pass = false;
try
{
gp = new GradientPaint(new Point2D.Float(1.0f, 2.0f), Color.red, null, Color.blue, true);
}
catch (NullPointerException e)
{
pass = true;
}
harness.check(pass);
pass = false;
try
{
gp = new GradientPaint(new Point2D.Float(1.0f, 2.0f), Color.red, new Point2D.Float(1.0f, 2.0f), null, true);
}
catch (NullPointerException e)
{
pass = true;
}