// Check that we got everything correctly after the crop.
//
// /////////////////////////////////////////////////////////////////////
// checking the ranges of the output image.
final GridGeometry2D croppedGG = (GridGeometry2D) cropped.getGridGeometry();
final GridEnvelope2D croppedGR = (GridEnvelope2D) croppedGG.getGridRange();
final MathTransform croppedG2W = croppedGG.getGridToCRS(PixelInCell.CELL_CENTER);
final GeneralEnvelope croppedEnvelope = (GeneralEnvelope) cropped.getEnvelope();
assertTrue("min x do not match after crop", 29 == croppedGR.x);
assertTrue("min y do not match after crop", 30 == croppedGR.y);
assertTrue("max x do not match after crop", 90 == croppedGR.getMaxX());
assertTrue("max y do not match after crop", 91 == croppedGR.getMaxY());
// check that the affine transform are the same thing
assertTrue("The Grdi2World tranformations of the original and the cropped covearage do not match",
sourceG2W.equals(croppedG2W));
// check that the envelope is correct
final GeneralEnvelope expectedEnvelope = new GeneralEnvelope(croppedGR,