@Test
    void testImageColorModel() {
        ImageBuilder imageBuilder;
        BufferedImage bImage;
        ColorModel model;
        imageBuilder = new ImageBuilder(100, 100, false);
        bImage = imageBuilder.getBufferedImage();
        model = bImage.getColorModel();
        assertFalse(model.hasAlpha(), "Output image has alpha where not specified");

        imageBuilder = new ImageBuilder(100, 100, true, false);
        bImage = imageBuilder.getBufferedImage();
        model = bImage.getColorModel();
        assertTrue(model.hasAlpha(), "Output image does not have alpha where specified");
        assertFalse(model.isAlphaPremultiplied(), "Output image has alpha pre-multiplied where not specified");

        imageBuilder = new ImageBuilder(100, 100, true, true);
        bImage = imageBuilder.getBufferedImage();
        model = bImage.getColorModel();
        assertTrue(model.hasAlpha(), "Output image does not have alpha where specified");
        assertTrue(model.isAlphaPremultiplied(), "Output image does not have alpha pre-multiplied where specified");
    }
Test whether color model is properly applied to buffered images
src/test/java/org/apache/commons/imaging/common/ImageBuilderTest.java