### Question:
BPMNFormModelGeneratorImpl implements BPMNFormModelGenerator { @Override public List<TaskFormModel> generateTaskFormModels(Definitions source, Path path) { Process process = getProcess(source); final ClassLoader projectClassLoader = projectClassLoaderHelper.getModuleClassLoader(moduleService.resolveModule(path)); if (process != null) { ProcessTaskFormsGenerationResult result = readUserTaskFormVariables(process); return result.getAllTaskFormVariables().stream().filter(taskFormVariables -> { if (!taskFormVariables.isValid()) { logger.warn(generateErrorMessage(taskFormVariables)); return false; } return true; }).map(taskFormVariables -> taskFormVariables.toFormModel(variable -> createModelProperty(variable, projectClassLoader))) .collect(Collectors.toList()); } return Collections.emptyList(); } @Inject  BPMNFormModelGeneratorImpl(KieModuleService moduleService,
                                      ModuleClassLoaderHelper projectClassLoaderHelper); @Override BusinessProcessFormModel generateProcessFormModel(Definitions source,
                                                             Path path); @Override List<TaskFormModel> generateTaskFormModels(Definitions source,
                                                      Path path); @Override TaskFormModel generateTaskFormModel(Definitions source,
                                               String taskId,
                                               Path path); @Override Process getProcess(Definitions source);  }### Answer:
@Test public void testGenerateAllTaskFormModelForTasksWithSharedForm() { final String TASK_NAME = "task"; final int EXPECTED_MODELS = 2; List<TaskFormModel> generatedModels = generator.generateTaskFormModels(processWithSharedForms, path); assertNotNull(generatedModels); assertEquals(EXPECTED_MODELS, generatedModels.size()); for (TaskFormModel formModel : generatedModels) { assertNotNull(formModel); assertEquals(PROCESS_WITH_SHARED_FORMS_ID, formModel.getProcessId()); assertNotNull(formModel.getProperties()); assertFalse(formModel.getProperties().isEmpty()); if (formModel.getFormName().equals(TASK_NAME + BPMNVariableUtils.TASK_FORM_SUFFIX)) { checkExpectedMergedFormVariables(formModel); } } }
@Test public void testGenerateAllTaskFormModelForTasksWithSharedFormWithWrongMappings() { final String TASK_NAME = "task"; final int EXPECTED_MODELS = 1; List<TaskFormModel> generatedModels = generator.generateTaskFormModels(processWithSharedFormsWrongMappings, path); assertNotNull(generatedModels); assertEquals(EXPECTED_MODELS, generatedModels.size()); for (TaskFormModel formModel : generatedModels) { assertNotNull(formModel); assertEquals(PROCESS_WITH_SHARED_FORMS_WRONG_MAPPINGS_ID, formModel.getProcessId()); assertNotNull(formModel.getProperties()); assertFalse(formModel.getProperties().isEmpty()); assertNotEquals(TASK_NAME + BPMNVariableUtils.TASK_FORM_SUFFIX, formModel.getFormName()); } }