### Question:
Quadrilateral extends AQuadrilateral { public static IQuadrilateral fromCorners(final IVector2 a, final IVector2 b, final IVector2 c, final IVector2 d) { Validate.notNull(a); Validate.notNull(b); Validate.notNull(c); Validate.notNull(d); List<IVector2> corners = new ArrayList<>(4); corners.add(a); corners.add(b); corners.add(c); corners.add(d); return fromCorners(corners); } @SuppressWarnings("unused") private  Quadrilateral(); private  Quadrilateral(final List<IVector2> corners); static IQuadrilateral fromCorners(final IVector2 a, final IVector2 b, final IVector2 c, final IVector2 d); static IQuadrilateral fromCorners(final List<IVector2> points); @Override List<IVector2> getCorners(); @Override final boolean equals(final Object o); @Override final int hashCode(); @Override List<IVector2> lineIntersections(final ILine line);  }### Answer:
@Test public void fromCorners() throws Exception { List<IVector2> corners = new ArrayList<>(4); corners.add(Vector2.fromXY(-1, -1)); corners.add(Vector2.fromXY(-1, 1)); corners.add(Vector2.fromXY(1, -1)); corners.add(Vector2.fromXY(1, 1)); IQuadrilateral quadrilateral = Quadrilateral.fromCorners(corners); for (List<IVector2> permCorners : Collections2.permutations(corners)) { IQuadrilateral permQuadrangle = Quadrilateral.fromCorners(permCorners); assertThat(permQuadrangle.getCorners()).containsAll(permCorners); assertThat(permQuadrangle).isEqualTo(quadrilateral); } }
@Test public void isPointInShape() throws Exception { List<IVector2> acorners = new ArrayList<>(4); acorners.add(Vector2.fromXY(1, -1)); acorners.add(Vector2.fromXY(-1, 1)); acorners.add(Vector2.fromXY(1, 1)); acorners.add(Vector2.fromXY(-1, -1)); for (List<IVector2> corners : Collections2.permutations(acorners)) { IQuadrilateral quadrilateral = Quadrilateral.fromCorners(corners.get(0), corners.get(1), corners.get(2), corners.get(3)); assertThat(quadrilateral.isPointInShape(Vector2.fromXY(0, 0))).isTrue(); assertThat(quadrilateral.isPointInShape(Vector2.fromXY(1, 0.9))).isTrue(); assertThat(quadrilateral.isPointInShape(Vector2.fromXY(1, 0.5))).isTrue(); assertThat(quadrilateral.isPointInShape(Vector2.fromXY(-1, -0.9))).isTrue(); assertThat(quadrilateral.isPointInShape(Vector2.fromXY(-1, -0.5))).isTrue(); assertThat(quadrilateral.isPointInShape(Vector2.fromXY(-1, -0))).isTrue(); assertThat(quadrilateral.isPointInShape(Vector2.fromXY(0, -0.9))).isTrue(); assertThat(quadrilateral.isPointInShape(Vector2.fromXY(0, 0.9))).isTrue(); assertThat(quadrilateral.isPointInShape(Vector2.fromXY(0, -0.2))).isTrue(); } }