### Question:
Triangle extends ATriangle { @Override public List<IVector2> lineIntersections(final ILine line) { ILineSegment ab = Lines.segmentFromPoints(a, b); ILineSegment bc = Lines.segmentFromPoints(b, c); ILineSegment ac = Lines.segmentFromPoints(a, c); ILineSegment[] lines = new ILineSegment[] { ab, ac, bc }; List<IVector2> intersections = new ArrayList<>(); for (ILineSegment segment : lines) { Optional<IVector2> intersection = segment.intersectLine(Lines.lineFromLegacyLine(line)); intersection.ifPresent(intersections::add); } return intersections; } @SuppressWarnings("unused") private  Triangle(); protected  Triangle(final IVector2 a, final IVector2 b, final IVector2 c); protected  Triangle(final Triangle triangle); static Triangle fromCorners(final IVector2 a, final IVector2 b, final IVector2 c); @Override ITriangle withMargin(final double margin); @Override ITriangle shortenToPoint(final IVector2 x); @Override IVector2 getA(); @Override IVector2 getB(); @Override IVector2 getC(); @Override List<IVector2> getCorners(); @Override final boolean equals(final Object o); @Override double area(); @Override boolean isNeighbour(ITriangle triangle); @Override List<IVector2> lineIntersections(final ILine line); @Override int hashCode(); @Override String toString();  }### Answer:
@Test public void testLineIntersections() { Vector2 a = Vector2.fromXY(0.0, 0.0); Vector2 b = Vector2.fromXY(1000.0, 0.0); Vector2 c = Vector2.fromXY(0.0, 1000.0); Triangle triangle = Triangle.fromCorners(a, b, c); ILine line1 = edu.tigers.sumatra.math.line.Line.fromPoints(Vector2.fromXY(1, 1), Vector2.fromXY(2, 2)); assertThat(triangle.lineIntersections(line1)).hasSize(3); ILine line4 = edu.tigers.sumatra.math.line.Line.fromPoints(Vector2.fromXY(0, 500), Vector2.fromXY(500, 500)); assertThat(triangle.lineIntersections(line4)).hasSize(2); ILine line2 = edu.tigers.sumatra.math.line.Line.fromPoints(Vector2.fromXY(-1, 0), Vector2.fromXY(-1, 0)); assertThat(triangle.lineIntersections(line2)).isEmpty(); ILine line3 = edu.tigers.sumatra.math.line.Line.fromPoints(Vector2.fromXY(0, -1), Vector2.fromXY(1, -1)); assertThat(triangle.lineIntersections(line3)).isEmpty(); }