@Test
public void testZoomlevel2() throws IOException {

    MBTilesReader reader = new MBTilesReader(getClass().getResource("world_lakes.mbtiles"), null);
    
    GeneralParameterValue[] parameters = new GeneralParameterValue[1];
    GridGeometry2D gg = new GridGeometry2D(new GridEnvelope2D(new Rectangle(500,500)), new ReferencedEnvelope(0,180.0,-85.0,0,MBTilesReader.WGS_84));
    parameters[0] = new Parameter<GridGeometry2D>(AbstractGridFormat.READ_GRIDGEOMETRY2D, gg);
    GridCoverage2D gc = reader.read(parameters);
    RenderedImage img = gc.getRenderedImage();
    assertEquals(0, gc.getEnvelope().getMinimum(0),0.01);
    assertEquals(-20037508.34, gc.getEnvelope().getMinimum(1),0.01);
    assertEquals(20037508.34, gc.getEnvelope().getMaximum(0),0.01);
    assertEquals(0, gc.getEnvelope().getMaximum(1),0.01);
    assertEquals(512, img.getWidth());
    assertEquals(512, img.getHeight());
    //ImageIO.write(img, "png", DataUtilities.urlToFile(getClass().getResource("world_lakes.png")));
    ImageAssert.assertEquals(DataUtilities.urlToFile(getClass().getResource("world_lakes.png")), img, 250);
}