@Test
public void testGuardSessionHandler_cacheMissing() throws Exception {

    final Invocable delegate = mock(Invocable.class);
    doThrow(NoSuchMethodException.class).when(delegate).invokeFunction("missingFunction", "test");
    final ScriptProgressCheck check = new ScriptProgressCheck(delegate, new ScriptProgressCheck.ScriptHelper(), null);
    check.guardSessionHandler("missingFunction", handle -> handle.apply("test"));
    // now throw a script exception if called after first missing
    doThrow(ScriptException.class).when(delegate).invokeFunction("missingFunction", "test");
    check.guardSessionHandler("missingFunction", handle -> handle.apply("test"));
}