@Override
    public void update(float tpf){
        super.update(tpf);

        if(framesToTakeScreenshotsOn.contains(tick)){
            screenshotAppState.takeScreenshot();
        }
        if(tick >= tickToTerminateApp){
            getApplication().stop(true);
            synchronized (waitLock) {
                waitLock.notify(); // Release the wait
            }
        }

        tick++;
    }
The test driver injects the screenshot taking into the application lifecycle, pauses the main test thread until the
screenshots have been taken and then compares the screenshots to the expected images.

@author Richard Tingle (aka richtea)
jme3-screenshot-tests/src/main/java/org/jmonkeyengine/screenshottests/testframework/TestDriver.java