### Question:
Circle extends ACircle { public static ICircle createCircle(final IVector2 center, final double radius) { return new Circle(center, radius); } protected  Circle(); protected  Circle(final ICircle circle); protected  Circle(final IVector2 center, final double radius); static ICircle from2Points(final IVector2 p1, final IVector2 p2); static Optional<ICircle> from3Points(final IVector2 p1, final IVector2 p2, final IVector2 p3); static Optional<ICircle> fromNPoints(final List<IVector2> points); static Optional<ICircle> hullCircle(final List<IVector2> points); static ICircle createCircle(final IVector2 center, final double radius); @Override ICircle withMargin(final double margin); @Override ICircle mirror(); @Override double radius(); @Override IVector2 center(); @Override final boolean equals(final Object o); @Override final int hashCode(); @Override String toString();  }### Answer:
@Test public void testIsLineIntersectingShape() { ICircle circle = Circle.createCircle(Vector2.fromXY(1, 1), 1); Line line = Line.fromDirection(Vector2.fromXY(0, 0), Vector2.fromXY(1, 1)); Assert.assertEquals(true, circle.isIntersectingWithLine(line)); Line line3 = Line.fromDirection(Vector2.fromXY(-1, 1), Vector2.fromXY(1, 0)); Assert.assertEquals(true, circle.isIntersectingWithLine(line3)); Line line2 = Line.fromDirection(Vector2f.ZERO_VECTOR, Vector2.fromXY(-1, 1)); Assert.assertEquals(false, circle.isIntersectingWithLine(line2)); }
@Test public void LineIntersections() { ICircle circle = Circle.createCircle(Vector2.fromXY(1, 1), 1); Line line = Line.fromDirection(Vector2f.ZERO_VECTOR, Vector2.fromXY(-1, 1)); if (circle.lineIntersections(line).size() == 0) { Assert.assertTrue(true); } else { Assert.assertTrue(false); } Line line2 = Line.fromDirection(Vector2.fromXY(-1, 1), Vector2.fromXY(1, 0)); List<IVector2> result = circle.lineIntersections(line2); if ((result.get(0).x() == 2) && (result.get(0).y() == 1) && (result.get(1).x() == 0) && (result.get(1).y() == 1)) { Assert.assertTrue(true); } else { Assert.assertTrue(false); } }
@Test public void testNearestPointOutside() { ICircle circle = Circle.createCircle(Vector2.fromXY(-2, 4), 3); Vector2 point = Vector2.fromXY(-1, 4); Assert.assertEquals(circle.nearestPointOutside(point), Vector2.fromXY(1, 4)); Vector2 point3 = Vector2.fromXY(1, 2); Assert.assertEquals(circle.nearestPointOutside(point3), Vector2.fromXY(1, 2)); }
@Test public void testTangentialIntersections() { ICircle circle = Circle.createCircle(Vector2.fromXY(5, 7), 6); IVector2 externalPoint = Vector2.fromXY(1, 1); List<IVector2> res = circle.tangentialIntersections(externalPoint); for (IVector2 p : res) { if (p.isCloseTo(Vector2.fromXY(5, 1), ACCURACY)) { return; } } Assert.fail(); }