@Test
public void testResizeImage() {

	// Width only
	BufferedImage bi = new BufferedImage(100, 200, BufferedImage.TYPE_INT_ARGB);
	bi = manipulator.resizeIfRequested(bi, new ImageManipulationParametersImpl().setWidth(200));
	assertEquals(200, bi.getWidth());
	assertEquals(400, bi.getHeight());
	// Same width
	bi = new BufferedImage(100, 200, BufferedImage.TYPE_INT_ARGB);
	BufferedImage outputImage = manipulator.resizeIfRequested(bi, new ImageManipulationParametersImpl().setWidth(100));
	assertEquals(100, bi.getWidth());
	assertEquals(200, bi.getHeight());
	assertEquals("The image should not have been resized since the parameters match the source image dimension.", bi.hashCode(), outputImage
		.hashCode());
	// Height only
	bi = new BufferedImage(100, 200, BufferedImage.TYPE_INT_ARGB);
	bi = manipulator.resizeIfRequested(bi, new ImageManipulationParametersImpl().setHeight(50));
	assertEquals(25, bi.getWidth());
	assertEquals(50, bi.getHeight());
	// Same height
	bi = new BufferedImage(100, 200, BufferedImage.TYPE_INT_ARGB);
	outputImage = manipulator.resizeIfRequested(bi, new ImageManipulationParametersImpl().setHeight(200));
	assertEquals(100, bi.getWidth());
	assertEquals(200, bi.getHeight());
	assertEquals("The image should not have been resized since the parameters match the source image dimension.", bi.hashCode(), outputImage
		.hashCode());
	// Height and Width
	bi = new BufferedImage(100, 200, BufferedImage.TYPE_INT_ARGB);
	bi = manipulator.resizeIfRequested(bi, new ImageManipulationParametersImpl().setWidth(200).setHeight(300));
	assertEquals(200, bi.getWidth());
	assertEquals(300, bi.getHeight());
	// No parameters
	bi = new BufferedImage(100, 200, BufferedImage.TYPE_INT_ARGB);
	outputImage = manipulator.resizeIfRequested(bi, new ImageManipulationParametersImpl());
	assertEquals(100, outputImage.getWidth());
	assertEquals(200, outputImage.getHeight());
	assertEquals("The image should not have been resized since no parameters were set.", bi.hashCode(), outputImage.hashCode());
	// Same height / width
	bi = new BufferedImage(100, 200, BufferedImage.TYPE_INT_ARGB);
	outputImage = manipulator.resizeIfRequested(bi, new ImageManipulationParametersImpl().setWidth(100).setHeight(200));
	assertEquals(100, bi.getWidth());
	assertEquals(200, bi.getHeight());
	assertEquals("The image should not have been resized since the parameters match the source image dimension.", bi.hashCode(), outputImage
		.hashCode());
}