@Test public void testUploadQuestionGroup() { UploadQuestionGroupForm form = new UploadQuestionGroupForm(); form.setSelectedCountry("INDIA"); String result = controller.upload(form, requestContext); assertThat(result, is("success")); verify(questionnaireServiceFacade).uploadPPIQuestionGroup("INDIA"); }
public String upload(UploadQuestionGroupForm uploadQuestionGroupForm, RequestContext requestContext) { String result = "success"; if (selectedCountryNotPresent(uploadQuestionGroupForm.getSelectedCountry())) { constructErrorMessage(requestContext.getMessageContext(), "questionnaire.error.ppi.country", "selectedCountry", "Please specify the Country"); result = "failure"; } else { try { questionnaireServiceFacade.uploadPPIQuestionGroup(uploadQuestionGroupForm.getSelectedCountry()); } catch(ValidationException e) { handleValidationException(e, requestContext); result = "failure"; } catch (SystemException e) { constructErrorMessage(requestContext.getMessageContext(), e.getKey(), "selectedCountry", e.getKey()); result = "failure"; } catch (Exception e) { constructAndLogSystemError(requestContext.getMessageContext(), new SystemException(e.getMessage(), e)); result = "failure"; } } return result; }
UploadQuestionGroupController extends QuestionnaireController { public String upload(UploadQuestionGroupForm uploadQuestionGroupForm, RequestContext requestContext) { String result = "success"; if (selectedCountryNotPresent(uploadQuestionGroupForm.getSelectedCountry())) { constructErrorMessage(requestContext.getMessageContext(), "questionnaire.error.ppi.country", "selectedCountry", "Please specify the Country"); result = "failure"; } else { try { questionnaireServiceFacade.uploadPPIQuestionGroup(uploadQuestionGroupForm.getSelectedCountry()); } catch(ValidationException e) { handleValidationException(e, requestContext); result = "failure"; } catch (SystemException e) { constructErrorMessage(requestContext.getMessageContext(), e.getKey(), "selectedCountry", e.getKey()); result = "failure"; } catch (Exception e) { constructAndLogSystemError(requestContext.getMessageContext(), new SystemException(e.getMessage(), e)); result = "failure"; } } return result; } }
UploadQuestionGroupController extends QuestionnaireController { public String upload(UploadQuestionGroupForm uploadQuestionGroupForm, RequestContext requestContext) { String result = "success"; if (selectedCountryNotPresent(uploadQuestionGroupForm.getSelectedCountry())) { constructErrorMessage(requestContext.getMessageContext(), "questionnaire.error.ppi.country", "selectedCountry", "Please specify the Country"); result = "failure"; } else { try { questionnaireServiceFacade.uploadPPIQuestionGroup(uploadQuestionGroupForm.getSelectedCountry()); } catch(ValidationException e) { handleValidationException(e, requestContext); result = "failure"; } catch (SystemException e) { constructErrorMessage(requestContext.getMessageContext(), e.getKey(), "selectedCountry", e.getKey()); result = "failure"; } catch (Exception e) { constructAndLogSystemError(requestContext.getMessageContext(), new SystemException(e.getMessage(), e)); result = "failure"; } } return result; } UploadQuestionGroupController();  UploadQuestionGroupController(QuestionnaireServiceFacade questionnaireServiceFacade); }
UploadQuestionGroupController extends QuestionnaireController { public String upload(UploadQuestionGroupForm uploadQuestionGroupForm, RequestContext requestContext) { String result = "success"; if (selectedCountryNotPresent(uploadQuestionGroupForm.getSelectedCountry())) { constructErrorMessage(requestContext.getMessageContext(), "questionnaire.error.ppi.country", "selectedCountry", "Please specify the Country"); result = "failure"; } else { try { questionnaireServiceFacade.uploadPPIQuestionGroup(uploadQuestionGroupForm.getSelectedCountry()); } catch(ValidationException e) { handleValidationException(e, requestContext); result = "failure"; } catch (SystemException e) { constructErrorMessage(requestContext.getMessageContext(), e.getKey(), "selectedCountry", e.getKey()); result = "failure"; } catch (Exception e) { constructAndLogSystemError(requestContext.getMessageContext(), new SystemException(e.getMessage(), e)); result = "failure"; } } return result; } UploadQuestionGroupController();  UploadQuestionGroupController(QuestionnaireServiceFacade questionnaireServiceFacade); List<String> getAllCountriesForPPI(); String upload(UploadQuestionGroupForm uploadQuestionGroupForm, RequestContext requestContext); }
UploadQuestionGroupController extends QuestionnaireController { public String upload(UploadQuestionGroupForm uploadQuestionGroupForm, RequestContext requestContext) { String result = "success"; if (selectedCountryNotPresent(uploadQuestionGroupForm.getSelectedCountry())) { constructErrorMessage(requestContext.getMessageContext(), "questionnaire.error.ppi.country", "selectedCountry", "Please specify the Country"); result = "failure"; } else { try { questionnaireServiceFacade.uploadPPIQuestionGroup(uploadQuestionGroupForm.getSelectedCountry()); } catch(ValidationException e) { handleValidationException(e, requestContext); result = "failure"; } catch (SystemException e) { constructErrorMessage(requestContext.getMessageContext(), e.getKey(), "selectedCountry", e.getKey()); result = "failure"; } catch (Exception e) { constructAndLogSystemError(requestContext.getMessageContext(), new SystemException(e.getMessage(), e)); result = "failure"; } } return result; } UploadQuestionGroupController();  UploadQuestionGroupController(QuestionnaireServiceFacade questionnaireServiceFacade); List<String> getAllCountriesForPPI(); String upload(UploadQuestionGroupForm uploadQuestionGroupForm, RequestContext requestContext);  }