### Question:
NewFormDefinitionlHandler extends DefaultNewResourceHandler { @Override public void create(final org.guvnor.common.services.project.model.Package pkg, final String baseFileName, final NewResourcePresenter presenter) { busyIndicatorView.showBusyIndicator(translationService.getTranslation(FormEditorConstants.NewFormDefinitionlHandlerSelectFormUse)); modelerService.call(getSuccessCallback(presenter), getErrorCallback()).createForm(pkg.getPackageMainResourcesPath(), buildFileName(baseFileName, resourceType), formModelsPresenter.getFormModel()); } @Inject  NewFormDefinitionlHandler(final Caller<FormEditorService> modelerService,
                                     final FormDefinitionResourceType resourceType,
                                     final TranslationService translationService,
                                     final FormModelsPresenter formModelsPresenter,
                                     final WorkspaceProjectContext context,
                                     final Caller<KieModuleService> moduleService,
                                     final Caller<ValidationService> validationService,
                                     final PlaceManager placeManager,
                                     final Event<NotificationEvent> notificationEvent,
                                     final Event<NewResourceSuccessEvent> newResourceSuccessEvent,
                                     final BusyIndicatorView busyIndicatorView); @Override String getDescription(); @Override IsWidget getIcon(); @Override ResourceTypeDefinition getResourceType(); @Override List<Pair<String, ? extends IsWidget>> getExtensions(); @Override void validate(String baseFileName,
                         ValidatorWithReasonCallback callback); @Override void create(final org.guvnor.common.services.project.model.Package pkg,
                       final String baseFileName,
                       final NewResourcePresenter presenter); @Override List<Profile> getProfiles();  }### Answer:
@Test public void testSuccessfulCreation() { handler.create(pkg, NEW_FORM_NAME, newResourcePresenter); verify(translationService).getTranslation(FormEditorConstants.NewFormDefinitionlHandlerSelectFormUse); verify(busyIndicatorView).showBusyIndicator(anyString()); verify(busyIndicatorView).hideBusyIndicator(); verify(newResourcePresenter).complete(); verify(notificationEvent).fire(any()); verify(newResourceSuccessEvent).fire(any()); verify(placeManager).goTo(any(Path.class)); }
@Test public void testFailedCreation() { when(formEditorService.createForm(any(), anyString(), any())).thenThrow(new IllegalStateException("Something wrong happened")); handler.create(pkg, NEW_FORM_NAME, newResourcePresenter); verify(translationService).getTranslation(FormEditorConstants.NewFormDefinitionlHandlerSelectFormUse); verify(busyIndicatorView).showBusyIndicator(anyString()); verify(errorCallback).error(any(), any()); }