@Test
public void testSmartResize() throws IOException {

	// tests with horizontal input ...
	BufferedImage biH = ImageTestUtil.readImage("testgrid-horizontal-hd_1920x1080.png");
	// .. to horizontal output
	BufferedImage outputImage1 = manipulator.cropAndResize(biH,
		new ImageManipulationParametersImpl().setWidth(500).setHeight(300));
	assertThat(outputImage1).matchesReference("outputImage1-smart-reference.png");
	// .. to vertical output
	BufferedImage outputImage2 = manipulator.cropAndResize(biH,
		new ImageManipulationParametersImpl().setWidth(300).setHeight(500));
	assertThat(outputImage2).matchesReference("outputImage2-smart-reference.png");
	// .. to square output
	BufferedImage outputImage3 = manipulator.cropAndResize(biH,
		new ImageManipulationParametersImpl().setWidth(500).setHeight(500));
	assertThat(outputImage3).matchesReference("outputImage3-smart-reference.png");
	// tests with vertical input ...
	BufferedImage biV = ImageTestUtil.readImage("testgrid-vertical-hd_1080x1920.png");
	// .. to horizontal output
	BufferedImage outputImage4 = manipulator.cropAndResize(biV,
		new ImageManipulationParametersImpl().setWidth(500).setHeight(300));
	assertThat(outputImage4).matchesReference("outputImage4-smart-reference.png");
	// .. to vertical output
	BufferedImage outputImage5 = manipulator.cropAndResize(biV,
		new ImageManipulationParametersImpl().setWidth(300).setHeight(500));
	assertThat(outputImage5).matchesReference("outputImage5-smart-reference.png");
	// .. to square output
	BufferedImage outputImage6 = manipulator.cropAndResize(biV,
		new ImageManipulationParametersImpl().setWidth(500).setHeight(500));
	assertThat(outputImage6).matchesReference("outputImage6-smart-reference.png");
	// tests with square input ...
	BufferedImage biS = ImageTestUtil.readImage("testgrid-square_1080x1080.png");
	// .. to horizontal output
	BufferedImage outputImage7 = manipulator.cropAndResize(biS,
		new ImageManipulationParametersImpl().setWidth(500).setHeight(300));
	assertThat(outputImage7).matchesReference("outputImage7-smart-reference.png");
	// .. to vertical output
	BufferedImage outputImage8 = manipulator.cropAndResize(biS,
		new ImageManipulationParametersImpl().setWidth(300).setHeight(500));
	assertThat(outputImage8).matchesReference("outputImage8-smart-reference.png");
	// .. to square output
	BufferedImage outputImage9 = manipulator.cropAndResize(biS,
		new ImageManipulationParametersImpl().setWidth(500).setHeight(500));
	assertThat(outputImage9).matchesReference("outputImage9-smart-reference.png");
	// test if same input and ouput format omits resampling
	// 1920x1080
	BufferedImage outputImage10 = manipulator.cropAndResize(biH,
		new ImageManipulationParametersImpl().setWidth(1920).setHeight(1080));
	assertEquals("The image should not have been resized since the parameters match the source image dimension.", biH.hashCode(), outputImage10
		.hashCode());
	// 1080x1920
	BufferedImage outputImage11 = manipulator.cropAndResize(biV,
		new ImageManipulationParametersImpl().setWidth(1080).setHeight(1920));
	assertEquals("The image should not have been resized since the parameters match the source image dimension.", biV.hashCode(), outputImage11
		.hashCode());
	// 1080x1080
	BufferedImage outputImage12 = manipulator.cropAndResize(biS,
		new ImageManipulationParametersImpl().setWidth(1080).setHeight(1080));
	assertEquals("The image should not have been resized since the parameters match the source image dimension.", biS.hashCode(), outputImage12
		.hashCode());
	// when you want to update the referenceImage, execute the code below
	// and copy the files to src/test/resources/references/
	// ImageTestUtil.writePngImage(outputImage1, new File("target/outputImage1-smart-reference.png"));
}