@Test
public void testReadManifest() throws Exception {

    final Invocable delegate = mock(Invocable.class);
    final ScriptProgressCheck.ScriptHelper helper = new ScriptProgressCheck.ScriptHelper();
    final ScriptProgressCheck check = new ScriptProgressCheck(delegate, helper, null);
    final List<Map.Entry<String, Object[]>> argRecord = new ArrayList<>();
    doAnswer(call -> argRecord.add(toEntry(call.getArgument(0), call.getArguments())))
            .when(delegate).invokeFunction(anyString(), any());
    final PackageId arg1 = PackageId.fromString("my_packages:example:1.0");
    final Manifest arg2 = new Manifest();
    check.readManifest(arg1, arg2);
    Map.Entry<String, Object[]> call = argRecord.stream()
            .filter(entry -> "readManifest".equals(entry.getKey()) && entry.getValue().length == 3).findFirst()
            .orElse(null);
    assertNotNull("expect call for readManifest", call);
    assertSame("same arg1", arg1, call.getValue()[1]);
    assertSame("same arg2", arg2, call.getValue()[2]);
}