QuoteV1Controller { @RequestMapping(value = "/company/{name}", method = RequestMethod.GET) public ResponseEntity<List<CompanyInfo>> getCompanies(@PathVariable("name") final String name) { logger.debug("QuoteController.getCompanies: retrieving companies for: " + name); List<CompanyInfo> companies = service.getCompanyInfo(name); logger.info(String.format("Retrieved companies with search parameter: %s - list: {}", name), companies); return new ResponseEntity<List<CompanyInfo>>(companies, HttpStatus.OK); }  @RequestMapping(value = "/quotes", method = RequestMethod.GET) ResponseEntity<List<Quote>> getQuotes(@RequestParam(value="q", required=false) String query); @RequestMapping(value = "/company/{name}", method = RequestMethod.GET) ResponseEntity<List<CompanyInfo>> getCompanies(@PathVariable("name") final String name); @ExceptionHandler({ Exception.class }) void handleException(Exception e, HttpServletResponse response);  }
@Test public void getCompanies() throws Exception { List<CompanyInfo> comps = new ArrayList<>(); comps.add(TestConfiguration.company()); when(service.getCompanyInfo(TestConfiguration.QUOTE_NAME)).thenReturn( comps); mockMvc.perform( get("/v1/company/" + TestConfiguration.QUOTE_NAME).contentType( MediaType.APPLICATION_JSON)).andExpect(status().isOk()) .andDo(print()) .andExpect(jsonPath("$").isArray()); }