### Question:
GDAL extends FileDriver<GDALDataset> implements RasterDriver<GDALDataset> { public static GDALDataset open(File file) throws IOException { return new GDAL().open(file, null); } GDAL(); static void init(); static GDALDataset open(File file); @Override boolean isEnabled(Messages messages); String getGDALDriverName(); @Override String name(); @Override List<String> aliases(); @Override Class<GDALDataset> type(); @Override String family(); @Override boolean canOpen(Map<?, Object> opts, Messages msgs); @Override Set<Capability> capabilities();  }### Answer:
@Test public void testOpen() throws Exception { GDAL drv = new GDAL(); assertTrue(drv.canOpen(data, null, null)); GDALDataset ds = drv.open(data, null); assertNotNull(ds); }
@Test public void testReadRaster() throws Exception { ByteBuffer buf = ByteBuffer.allocateDirect(10000); buf.order(ByteOrder.nativeOrder()); Dataset ds = gdal.Open(data.getAbsolutePath()); ds.ReadRaster_Direct(0, 0, 1, 1, 1, 1, gdalconst.GDT_Float32, buf, null); }
@Test public void testQuerySmallerRaster() throws Exception { GDALDataset ds = GDAL.open(data); Raster wholeimage = ds.read(new RasterQuery()); int count = wholeimage.data().size(); assertEquals(count, (ds.size().width()*ds.size().height())); Bounds smaller = ds.bounds().scale(0.5); assertTrue(ds.bounds().getArea()> smaller.getArea()); ds.bounds().contains(smaller); RasterQuery q1 = new RasterQuery() .datatype(DataType.DOUBLE) .bounds(smaller); Raster halfsize = ds.read(q1); assertEquals("should be half", (Integer)new Double(wholeimage.size().width()*.5).intValue(), (Integer)halfsize.size().width()); }