@Test public void listJudgmentKeywords() throws Exception { ResultActions actions = mockMvc.perform(get("/keywords/" + courtType.toString() + "/" + phrase) .accept(MediaType.APPLICATION_JSON)); actions .andExpect(status().isOk()) .andExpect(jsonPath("$.[0].id").value(1)) .andExpect(jsonPath("$.[0].phrase").value("opinia prawna")) .andExpect(jsonPath("$.[1].id").value(2)) .andExpect(jsonPath("$.[1].phrase").value("opinia o wykroczeniu")); verify(judgmentKeywordRepository, times(1)).findAllByCourtTypeAndPhrasePart(courtType, phrase); verify(simpleKeywordConverter, times(1)).convertJudgmentKeywords(testKeywords); }
@RequestMapping("/keywords/{courtType}/{phrase}") @ResponseBody public List<SimpleKeyword> listJudgmentKeywords(@PathVariable("courtType") CourtType courtType, @PathVariable("phrase") String phrase) { return simpleKeywordConverter.convertJudgmentKeywords(judgmentKeywordRepository.findAllByCourtTypeAndPhrasePart(courtType, phrase)); }
KeywordController { @RequestMapping("/keywords/{courtType}/{phrase}") @ResponseBody public List<SimpleKeyword> listJudgmentKeywords(@PathVariable("courtType") CourtType courtType, @PathVariable("phrase") String phrase) { return simpleKeywordConverter.convertJudgmentKeywords(judgmentKeywordRepository.findAllByCourtTypeAndPhrasePart(courtType, phrase)); } }
KeywordController { @RequestMapping("/keywords/{courtType}/{phrase}") @ResponseBody public List<SimpleKeyword> listJudgmentKeywords(@PathVariable("courtType") CourtType courtType, @PathVariable("phrase") String phrase) { return simpleKeywordConverter.convertJudgmentKeywords(judgmentKeywordRepository.findAllByCourtTypeAndPhrasePart(courtType, phrase)); }  }
KeywordController { @RequestMapping("/keywords/{courtType}/{phrase}") @ResponseBody public List<SimpleKeyword> listJudgmentKeywords(@PathVariable("courtType") CourtType courtType, @PathVariable("phrase") String phrase) { return simpleKeywordConverter.convertJudgmentKeywords(judgmentKeywordRepository.findAllByCourtTypeAndPhrasePart(courtType, phrase)); }  @RequestMapping("/keywords/{courtType}/{phrase}") @ResponseBody List<SimpleKeyword> listJudgmentKeywords(@PathVariable("courtType") CourtType courtType, @PathVariable("phrase") String phrase); }
KeywordController { @RequestMapping("/keywords/{courtType}/{phrase}") @ResponseBody public List<SimpleKeyword> listJudgmentKeywords(@PathVariable("courtType") CourtType courtType, @PathVariable("phrase") String phrase) { return simpleKeywordConverter.convertJudgmentKeywords(judgmentKeywordRepository.findAllByCourtTypeAndPhrasePart(courtType, phrase)); }  @RequestMapping("/keywords/{courtType}/{phrase}") @ResponseBody List<SimpleKeyword> listJudgmentKeywords(@PathVariable("courtType") CourtType courtType, @PathVariable("phrase") String phrase);  }