### Question:
FormDefinitionGeneratorImpl implements FormDefinitionGenerator { @Override public void generateAllForms(Diagram diagram) { try { LOGGER.finest("Generating all forms"); final Path path = diagram.getMetadata().getPath(); final org.uberfire.java.nio.file.Path nioPath = Paths.convert(path); ioService.startBatch(ioService.getFileSystem(nioPath.toUri())); final Definitions definitions = toDefinitions(diagram); final BusinessProcessFormModel processFormModel = bpmnFormModelGenerator.generateProcessFormModel(definitions, path); createFormForModel(processFormModel, nioPath); List<TaskFormModel> taskFormModels = bpmnFormModelGenerator.generateTaskFormModels(definitions, path); for (TaskFormModel taskFormModel : taskFormModels) { createFormForModel(taskFormModel, nioPath); } } catch (Exception ex) { LOGGER.severe("Error generating all diagram forms"); throw new RuntimeException(ex); } finally { ioService.endBatch(); } } @Inject  FormDefinitionGeneratorImpl(FormGenerationModelProviders providers,
                                       @Named("ioStrategy") final IOService ioService,
                                       final BPMNFormModelGenerator bpmnFormModelGenerator,
                                       final FormDefinitionSerializer serializer,
                                       @Authoring final BPMNFormGeneratorService<Path> bpmnFormGeneratorService); @Override void generateProcessForm(Diagram diagram); @Override void generateSelectedForms(Diagram diagram, String... taskIds); @Override void generateAllForms(Diagram diagram); void createFormForModel(JBPMFormModel formModel, org.uberfire.java.nio.file.Path path);  }### Answer:
@Test public void testGenerateAllForms() { generator.generateAllForms(diagram); verify(generator, times(4)).createFormForModel(formModelArgumentCaptor.capture(), any()); verify(formDefinitionSerializer, times(4)).serialize(formDefinitionArgumentCaptor.capture()); verify(ioService, times(1)).startBatch(any()); verify(ioService, times(1)).getFileSystem(any()); verify(ioService, times(4)).createFile(any()); verify(ioService, times(4)).write(any(), anyString()); verify(ioService, times(1)).endBatch(); List<JBPMFormModel> formModels = formModelArgumentCaptor.getAllValues(); List<FormDefinition> forms = formDefinitionArgumentCaptor.getAllValues(); Assertions.assertThat(formModels) .isNotEmpty() .hasSize(forms.size()) .hasSize(4); for (int i = 0; i < formModels.size(); i++) { JBPMFormModel formModel = formModels.get(i); FormDefinition form = forms.get(i); if (formModel instanceof BusinessProcessFormModel) { checkProcessFormGenerated((BusinessProcessFormModel) formModel, form); } else { TaskFormModel taskFormModel = (TaskFormModel) formModel; checkTaskFormGenerated(taskFormModel, taskFormModel.getTaskName(), form); } } }