### Question:
Main { private static ProcessSnapshot resume(Runner runner, ProcessConfiguration cfg, ProcessSnapshot snapshot, Map<String, Object> args, Set<String> events) throws Exception { Map<String, Object> initiator = cfg.initiator(); if (initiator != null) { args.put(Constants.Request.INITIATOR_KEY, initiator); } Map<String, Object> currentUser = cfg.currentUser(); if (currentUser != null) { args.put(Constants.Request.CURRENT_USER_KEY, currentUser); } for (String event : events) { snapshot = runner.resume(snapshot, event, args); } return snapshot; } @Inject  Main(Runner runner,
                RunnerConfiguration runnerCfg,
                ProcessConfiguration processCfg,
                WorkingDirectory workDir,
                TaskProviders taskProviders); static void main(String[] args); void execute();  }### Answer:
@Test public void testForm() throws Exception { deploy("form"); save(ProcessConfiguration.builder().build()); byte[] log = run(); assertLog(log, ".*Before.*"); List<Form> forms = formService.list(); assertEquals(1, forms.size()); Form myForm = forms.get(0); assertEquals("myForm", myForm.name()); Map<String, Object> data = new HashMap<>(); data.put("fullName", "John Smith"); data.put("age", 33); log = resume(myForm.eventName(), ProcessConfiguration.builder().arguments(Collections.singletonMap("myForm", data)).build()); assertLog(log, ".*After.*John Smith.*"); }
@Test public void testSuspend() throws Exception { deploy("suspend"); save(ProcessConfiguration.builder() .putArguments("testValue", "XYZ") .build()); byte[] log = run(); assertLog(log, ".*aaa.*"); log = resume("ev1", ProcessConfiguration.builder().build()); assertLog(log, ".*XYZ.*"); }
@Test public void testDefaultProcessVariables() throws Exception { deploy("defaultVariables"); save(ProcessConfiguration.builder().build()); byte[] log = run(); assertLog(log, ".*workDir: '.*'.*"); assertLog(log, ".*processInfo: '\\{.*\\}'.*"); assertLog(log, ".*projectInfo: '\\{\\}'.*"); log = resume("ev1", ProcessConfiguration.builder() .putArguments("workDir", "1") .putArguments("processInfo", "2") .putArguments("projectInfo", "3") .build()); assertLog(log, ".*workDir: '.*'.*"); assertLog(log, ".*processInfo: '\\{.*\\}'.*"); assertLog(log, ".*projectInfo: '\\{\\}'.*"); }
@Test public void testReentrant() throws Exception { deploy("reentrantTask"); save(ProcessConfiguration.builder() .putArguments("actionName", "boo") .build()); byte[] log = run(); assertLog(log, ".*execute \\{action=boo\\}.*"); log = resume(ReentrantTaskExample.EVENT_NAME, ProcessConfiguration.builder().build()); assertLog(log, ".*result.ok: true.*"); assertLog(log, ".*result.action: boo.*"); assertLog(log, ".*result.k: v.*"); }