### Question:
GameMasterController { @RequestMapping(value = "/game/{gameId}/contender-names", method = RequestMethod.GET) public @ResponseBody ContenderNamesResponse getContenderNames(@PathVariable Long gameId) throws InvalidGameIdException { Set<String> contenderNames = new HashSet<>(); for (Contender contender: repoUtil.findGameById(gameId).getContenders()) { contenderNames.add(contender.getName()); } return new ContenderNamesResponse(contenderNames); }  @RequestMapping(value = "/game/{gameId}/contender-names", method = RequestMethod.GET) @ResponseBody ContenderNamesResponse getContenderNames(@PathVariable Long gameId); @RequestMapping(value = "/game/{gameId}/start-game", method = RequestMethod.POST) void startGame(@PathVariable Long gameId); @RequestMapping(value = "/game/{gameId}/start-round", method = RequestMethod.POST) void startRound(@PathVariable Long gameId); @RequestMapping(value = "/game/{gameId}/start-voting", method = RequestMethod.POST) void startVoting(@PathVariable Long gameId); @RequestMapping(value = "/game/{gameId}/question-votes", method = RequestMethod.GET) @ResponseBody QuestionVotesResponse getQuestionVotes(@PathVariable Long gameId); @RequestMapping(value = "/game/{gameId}/set-next-to-score", method = RequestMethod.POST) void setNextToScore(@PathVariable Long gameId); @RequestMapping(value = "/game/{gameId}/final-results", method = RequestMethod.GET) @ResponseBody FinalResultsResponse getFinalResults(@PathVariable Long gameId); @RequestMapping(value = "/game/{gameId}/all-votes-submitted", method = RequestMethod.GET) @ResponseBody AllVotesSubmitted allVotesSubmitted(@PathVariable Long gameId); @RequestMapping(value = "/game/{gameId}/more-to-vote-on", method = RequestMethod.GET) @ResponseBody MoreToVoteOn moreQuestionsToVoteOn(@PathVariable Long gameId);  }### Answer:
@Test public void givenValidGameId_whenCallingGetContenderNames_thenReturnCorrespondingContenderNames() throws Exception { List<Contender> contenders = new ArrayList<>(); Contender contender = new Contender(); contender.setId(1L); contender.setName("Anthony"); contenders.add(contender); contender = new Contender(); contender.setId(2L); contender.setName("Liz"); contenders.add(contender); Game game = new Game(); game.setId(1L); game.setContenders(contenders); Set<String> givenNames = new HashSet<>(); givenNames.add("Anthony"); givenNames.add("Liz"); doReturn(game).when(repoUtil).findGameById(1L); mockMvc.perform(get("/game/1/contender-names").accept(MediaType.APPLICATION_JSON)) .andExpect(status().isOk()) .andExpect(content().json("{\"names\":[\"Anthony\", \"Liz\"]}")); Set<String> contenderNamesResponse = gameMasterController.getContenderNames(1L).getNames(); assertEquals(givenNames, contenderNamesResponse); verify(repoUtil, times(2)).findGameById(1L); }