@Test
    void testBadCoordinates() {

        try {
            final int[] sample = new int[100];
            final AbstractTiffRasterData raster = new TiffRasterDataInt(10, 10, sample);
            raster.getIntValue(11, 11);
            fail("Access method getValue() did not detect bad coordinates");
        } catch (final IllegalArgumentException illArgEx) {
            // success!
        }
        try {
            final int[] sample = new int[100];
            final AbstractTiffRasterData raster = new TiffRasterDataInt(10, 10, sample);
            raster.setValue(11, 11, 5.0f);
            fail("Access method setValue() did not detect bad coordinates");
        } catch (final IllegalArgumentException illArgEx) {
            // success!
        }
    }
Test of access with bad coordinates, of class TiffRasterData.
src/test/java/org/apache/commons/imaging/formats/tiff/TiffRasterDataIntTest.java