@Test
public void testCheckEmptySourceRegion() {

    final ImageReadParam params = new ImageReadParam();
    Rectangle sourceRegion = new Rectangle(300, 300, 700, 700);
    params.setSourceRegion(sourceRegion);
    Assert.assertEquals(sourceRegion.x, 300);
    Assert.assertEquals(sourceRegion.y, 300);
    Assert.assertEquals(sourceRegion.height, 700);
    Assert.assertEquals(sourceRegion.width, 700);
    
    final Rectangle intersecting = new Rectangle(400, 400, 900, 900);
    boolean isEmpty = CoverageUtilities.checkEmptySourceRegion(params, intersecting);
    
    Assert.assertFalse(isEmpty);
    final Rectangle intersection = params.getSourceRegion();
    Assert.assertEquals(intersection.x, 400);
    Assert.assertEquals(intersection.y, 400);
    Assert.assertEquals(intersection.height, 600);
    Assert.assertEquals(intersection.width, 600);
   
    final Rectangle intersecting2 = new Rectangle(0, 0, 300, 300);
    isEmpty = CoverageUtilities.checkEmptySourceRegion(params, intersecting2);
    Assert.assertTrue(isEmpty);
}