@Test
    void testBoundsCheck() {

        final ImageBuilder imageBuilder = new ImageBuilder(100, 100, false);

        executeBadBounds(imageBuilder, -1, 0, 50, 50);
        executeBadBounds(imageBuilder, 0, -1, 50, 50);
        executeBadBounds(imageBuilder, 0, 0, 0, 50);
        executeBadBounds(imageBuilder, 0, 0, 50, 0);
        executeBadBounds(imageBuilder, 90, 0, 50, 50);
        executeBadBounds(imageBuilder, 0, 90, 50, 50);
    }
Test of bad bounds in sub-image
src/test/java/org/apache/commons/imaging/common/ImageBuilderTest.java