private static boolean imagesAreTheSame(BufferedImage img1, BufferedImage img2) {
        if (img1.getWidth() != img2.getWidth() || img1.getHeight() != img2.getHeight()) {
            ExtentReportExtension.getCurrentTest().createNode("Image 1 size : " + img1.getWidth() + "x" + img1.getHeight());
            ExtentReportExtension.getCurrentTest().createNode("Image 2 size : " + img2.getWidth() + "x" + img2.getHeight());
            fail(IMAGES_ARE_DIFFERENT_SIZES);
        }

        for (int y = 0; y < img1.getHeight(); y++) {
            for (int x = 0; x < img1.getWidth(); x++) {
                if (img1.getRGB(x, y)  != img2.getRGB(x, y)){
                    return false;
                }
            }
        }
        return true;
    }
Tests that the images are the same. If they are not the same it will return false (which may fail the test
depending on the test type). Different sizes are so fatal that they will immediately fail the test.
jme3-screenshot-tests/src/main/java/org/jmonkeyengine/screenshottests/testframework/TestDriver.java