### Question:
Point2d implements Sc2ApiSerializable<Common.Point2D> { public static Point2d from(Common.Point2D sc2ApiPoint2d) { require("sc2api point2d", sc2ApiPoint2d); return new Point2d(sc2ApiPoint2d); } private  Point2d(Common.Point2D sc2ApiPoint2d); private  Point2d(float x, float y); static Point2d of(float x, float y); static Point2d from(Common.Point2D sc2ApiPoint2d); @Override Common.Point2D toSc2Api(); float getX(); float getY(); Point2d add(Point2d pointToAdd); Point2d add(float addX, float addY); Point2d sub(Point2d pointToSubtract); Point2d sub(float subX, float subY); Point2d div(float divBy); Point2d mul(float mulBy); double distance(Point2d b); float dot(Point2d b); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString();  }### Answer:
@Test void throwsExceptionWhenSc2ApiPoint2DIsNull() { assertThatExceptionOfType(IllegalArgumentException.class) .isThrownBy(() -> Point2d.from(nothing())) .withMessage("sc2api point2d is required"); }
@Test void throwsExceptionWhenSc2ApiPoint2DDoesNotHaveX() { assertThatExceptionOfType(IllegalArgumentException.class) .isThrownBy(() -> Point2d.from(Common.Point2D.newBuilder().setY(POINT_Y).build())) .withMessage("x is required"); }
@Test void throwsExceptionWhenSc2ApiPoint2DDoesNotHaveY() { assertThatExceptionOfType(IllegalArgumentException.class) .isThrownBy(() -> Point2d.from(Common.Point2D.newBuilder().setX(POINT_X).build())) .withMessage("y is required"); }