Configuration configuration = cP.serializeConfiguration();
String curDir = System.getProperty("user.dir"); //$NON-NLS-1$
String imageFile = curDir + TEST_IMAGE;
ImageRepresentation image = new ImageRepresentation(
new File(imageFile), ImageType.PNG);
ImageScaler scaler = new ImageScaler();
IArtefactRepresentation result = scaler.process(image, configuration);
Assert.assertNotNull(result);
String type = result.getType();
Assert.assertEquals(ImageRepresentation.TYPE, type);
ImageRepresentation resultImage = (ImageRepresentation) result;
File f = image.getImageFile();
Assert.assertTrue(f.exists());
Assert.assertTrue(f.isFile());
float heightScale = ((float) resultImage.getHeight())
/ ((float) image.getHeight());
float widthScale = ((float) resultImage.getWidth())
/ ((float) image.getWidth());
Assert.assertEquals(SCALE, heightScale, 0.05);
Assert.assertEquals(SCALE, widthScale, 0.05);
}