@Test
public void testConvertObjectGroupsToAreas() throws Exception {

	BufferedImage image1 = ImageIO
			.read(getClass().getResource("ImageUtilsTest_convert_object_groups_to_areas_expected.png"));
	Rectangle rectangle1 = new Rectangle(0, 0, image1.getWidth(), image1.getHeight());
	BufferedImage image2 = ImageIO
			.read(getClass().getResource("ImageUtilsTest_convert_object_groups_to_areas_actual.png"));
	Rectangle rectangle2 = new Rectangle(0, 0, image2.getWidth(), image2.getHeight());
	ImageComparedResult result = new DefaultImageComparator().compare(image1, rectangle1, image2, rectangle2);
	List<Point> points = ((DiffPoints) result).getDiffPoints();
	List<ObjectGroup> objectGroups = new ArrayList<ObjectGroup>();
	for (int i = 0; i < points.size(); i++) {
		objectGroups.add(new ObjectGroup(points.get(i)));
	}
	// ImageUtils.convertObjectGroupsToAreas内の計算でObjectGroupを作成するので、expectedの値もObjectGroupのマージンを考慮
	int margin = DEFAULT_GROUP_DISTANCE / 2;
	List<Rectangle> expected = new ArrayList<Rectangle>();
	expected.add(new Rectangle(1 - margin, 0 - margin, 1 + margin * 2, 1 + margin * 2));
	expected.add(new Rectangle(2 - margin, 0 - margin, 1 + margin * 2, 1 + margin * 2));
	expected.add(new Rectangle(3 - margin, 0 - margin, 1 + margin * 2, 1 + margin * 2));
	expected.add(new Rectangle(1 - margin, 1 - margin, 1 + margin * 2, 1 + margin * 2));
	expected.add(new Rectangle(2 - margin, 1 - margin, 1 + margin * 2, 1 + margin * 2));
	expected.add(new Rectangle(3 - margin, 1 - margin, 1 + margin * 2, 1 + margin * 2));
	List<Rectangle> actual = ImageUtils.convertObjectGroupsToAreas(objectGroups);
	assertThat(actual, is(expected));
}