ImageRect { public ImageRect(String dimensions) { if (dimensions == null) { throw error(BAD_REQUEST, "image_error_incomplete_crop_parameters"); } String[] parts = dimensions.split(","); if (parts.length != 4) { throw error(BAD_REQUEST, "image_error_incomplete_crop_parameters"); } this.startX = Integer.parseInt(parts[0]); this.startY = Integer.parseInt(parts[1]); this.width = Integer.parseInt(parts[2]); this.height = Integer.parseInt(parts[3]); } ImageRect(String dimensions);  ImageRect(int startX, int startY, int height, int width);  ImageRect(); int getStartX(); int getStartY(); int getWidth(); int getHeight(); @Override String toString(); void validateCropBounds(int imageWidth, int imageHeight); void validate(); @Override boolean equals(Object obj);  }
@Test public void testImageRect() { ImageRect rect = new ImageRect("1,2,3,4"); assertEquals(1, rect.getStartX()); assertEquals(2, rect.getStartY()); assertEquals(3, rect.getWidth()); assertEquals(4, rect.getHeight()); }