### Question:
FormEditorServiceImpl extends KieService<FormModelerContent> implements FormEditorService { @Override public void delete(Path path, String comment) { try { KieModule module = moduleService.resolveModule(path); if (module == null) { logger.warn("Form : " + path.toURI() + " does not belong to a valid module"); return; } deleteService.delete(path, comment); } catch (final Exception e) { logger.error("Form: " + path.toURI() + " couldn't be deleted due to the following error. ", e); } } @Inject  FormEditorServiceImpl(@Named("ioStrategy") IOService ioService,
                                 SessionInfo sessionInfo,
                                 Event<ResourceOpenedEvent> resourceOpenedEvent,
                                 FieldManager fieldManager,
                                 FormModelHandlerManager modelHandlerManager,
                                 KieModuleService moduleService,
                                 FormDefinitionSerializer formDefinitionSerializer,
                                 ModuleFormFinderService moduleFormFinderService,
                                 DeleteService deleteService,
                                 CommentedOptionFactory commentedOptionFactory,
                                 RenameService renameService,
                                 CopyService copyService); @Override FormModelerContent loadContent(Path path); @Override Path createForm(Path path,
                           String formName,
                           FormModel formModel); @Override void delete(Path path,
                       String comment); @Override Path save(Path path,
                     FormModelerContent content,
                     Metadata metadata,
                     String comment); @Override FormModelerContent rename(Path path,
                                     String newFileName,
                                     String commitMessage,
                                     boolean saveBeforeRenaming,
                                     FormModelerContent content,
                                     Metadata metadata); @Override void copy(Path path,
                     String newFileName,
                     String commitMessage,
                     boolean saveBeforeCopying,
                     FormModelerContent content,
                     Metadata metadata); static final String SHORT_KEY; static final String LONG_KEY; }### Answer:
@Test public void testDeleteForm() { formEditorService.delete(path, COMMIT_MESSAGE); verify(moduleService).resolveModule(path); verify(deleteService).delete(path, COMMIT_MESSAGE); }
@Test public void testDeleteFormWrongProject() { when(moduleService.resolveModule(any())).thenReturn(null); formEditorService.delete(path, COMMIT_MESSAGE); verify(moduleService).resolveModule(path); verify(deleteService, never()).delete(path, COMMIT_MESSAGE); }
@Test public void testDeleteFormWithException() { when(moduleService.resolveModule(any())).thenThrow(new IllegalStateException("Testing exception handling")); formEditorService.delete(path, COMMIT_MESSAGE); verify(moduleService).resolveModule(path); verify(deleteService, never()).delete(path, COMMIT_MESSAGE); }