RectangularBox { public static RectangularBox newInstanceFromPoints(Point bottomLeft, Point topRight) { if (bottomLeft == null || topRight == null) { throw new IllegalArgumentException("null point is not allowed."); } return newInstance(bottomLeft.y, bottomLeft.x, topRight.y, topRight.x); } RectangularBox(int bottom, int left, int top, int right); int getBottom(); int getLeft(); int getTop(); int getRight(); void rotate(Rotation desiredRotation); @Override String toString(); @Override int hashCode(); @Override boolean equals(Object other); static RectangularBox newInstance(int bottom, int left, int top, int right); static RectangularBox newInstanceFromPoints(Point bottomLeft, Point topRight); TopLeftRectangularBox toTopLeftRectangularBox();  }
@Test(expected = IllegalArgumentException.class) public void testNullBottomLeft() { RectangularBox.newInstanceFromPoints(null, new Point(10, 10)); }
@Test(expected = IllegalArgumentException.class) public void testNullTopRight() { RectangularBox.newInstanceFromPoints(new Point(10, 10), null); }