@Test void testStartQuestionnaire() throws Exception { String id = "1"; QuestionnaireResponse questionnaireResponse = QuestionnaireResponse.create(id, "label", "desc", QuestionnaireStatus.NOT_STARTED); when(questionnaireService.startQuestionnaire(id)).thenReturn(questionnaireResponse); mockMvc .perform(get(QuestionnaireController.URI + "/start/" + id)) .andExpect(status().isOk()) .andExpect(jsonPath("$.id", Matchers.is(id))); verify(questionnaireService).startQuestionnaire(id); }
@GetMapping(value = "/start/{id}") @ResponseBody public QuestionnaireResponse startQuestionnaire(@PathVariable("id") String id) { return questionnaireService.startQuestionnaire(id); }
QuestionnaireController extends PluginController { @GetMapping(value = "/start/{id}") @ResponseBody public QuestionnaireResponse startQuestionnaire(@PathVariable("id") String id) { return questionnaireService.startQuestionnaire(id); } }
QuestionnaireController extends PluginController { @GetMapping(value = "/start/{id}") @ResponseBody public QuestionnaireResponse startQuestionnaire(@PathVariable("id") String id) { return questionnaireService.startQuestionnaire(id); } QuestionnaireController(
      QuestionnaireService questionnaireService,
      MenuReaderService menuReaderService,
      AppSettings appSettings,
      UserAccountService userAccountService); }
QuestionnaireController extends PluginController { @GetMapping(value = "/start/{id}") @ResponseBody public QuestionnaireResponse startQuestionnaire(@PathVariable("id") String id) { return questionnaireService.startQuestionnaire(id); } QuestionnaireController(
      QuestionnaireService questionnaireService,
      MenuReaderService menuReaderService,
      AppSettings appSettings,
      UserAccountService userAccountService); @GetMapping("/**") String initView(Model model); @ResponseBody @GetMapping(value = "/list") List<QuestionnaireResponse> getQuestionnaires(); @GetMapping(value = "/start/{id}") @ResponseBody QuestionnaireResponse startQuestionnaire(@PathVariable("id") String id); @ResponseBody @GetMapping("/submission-text/{id}") @SuppressWarnings("javasecurity:S5131") // id is validated in questionnaireService String getQuestionnaireSubmissionText(@PathVariable("id") String id); }
QuestionnaireController extends PluginController { @GetMapping(value = "/start/{id}") @ResponseBody public QuestionnaireResponse startQuestionnaire(@PathVariable("id") String id) { return questionnaireService.startQuestionnaire(id); } QuestionnaireController(
      QuestionnaireService questionnaireService,
      MenuReaderService menuReaderService,
      AppSettings appSettings,
      UserAccountService userAccountService); @GetMapping("/**") String initView(Model model); @ResponseBody @GetMapping(value = "/list") List<QuestionnaireResponse> getQuestionnaires(); @GetMapping(value = "/start/{id}") @ResponseBody QuestionnaireResponse startQuestionnaire(@PathVariable("id") String id); @ResponseBody @GetMapping("/submission-text/{id}") @SuppressWarnings("javasecurity:S5131") // id is validated in questionnaireService String getQuestionnaireSubmissionText(@PathVariable("id") String id); static final String ID; static final String URI; }