@Test public void portfolio() throws Exception { when(portfolioService.getPortfolio("portfolio1", "LOB")).thenReturn(PortfolioResponse.getPortfolio(TestUtils.makePortfolio(MetricLevel.PORTFOLIO, RoleRelationShipType.BusinessOwner))); mockMvc.perform(MockMvcRequestBuilders.get("/portfolio/portfolio1/LOB")) .andDo(print()) .andExpect(status().isOk()); verify(portfolioService).getPortfolio("portfolio1", "LOB"); }
@GetMapping("/{name}/{lob}") public PortfolioResponse getPortfolio(@PathVariable("name") String name, @PathVariable("lob") String lob) { return portfolioService.getPortfolio(name, lob); }
PortfolioController { @GetMapping("/{name}/{lob}") public PortfolioResponse getPortfolio(@PathVariable("name") String name, @PathVariable("lob") String lob) { return portfolioService.getPortfolio(name, lob); } }
PortfolioController { @GetMapping("/{name}/{lob}") public PortfolioResponse getPortfolio(@PathVariable("name") String name, @PathVariable("lob") String lob) { return portfolioService.getPortfolio(name, lob); } @Autowired  PortfolioController(PortfolioService portfolioService); }
PortfolioController { @GetMapping("/{name}/{lob}") public PortfolioResponse getPortfolio(@PathVariable("name") String name, @PathVariable("lob") String lob) { return portfolioService.getPortfolio(name, lob); } @Autowired  PortfolioController(PortfolioService portfolioService); @GetMapping() List<PortfolioResponse> getPortfolios(); @GetMapping("/{name}/{lob}") PortfolioResponse getPortfolio(@PathVariable("name") String name, @PathVariable("lob") String lob); @GetMapping("/{name}/{lob}/products") List<BuildingBlockMetricSummary> getPortfolioProducts(@PathVariable("name") String name,
                                                                         @PathVariable("lob") String lob); @GetMapping("/{name}/{lob}/products/{productName}") BuildingBlockMetricSummary getPortfolioProduct(
            @PathVariable("name") String name,
            @PathVariable("lob") String lob,
            @PathVariable("productName") String productName); @GetMapping("/{name}/{lob}/products/{productName}/components") List<BuildingBlockMetricSummary> getProductComponents(
            @PathVariable("name") String name,
            @PathVariable("lob") String lob,
            @PathVariable("productName") String productName); }
PortfolioController { @GetMapping("/{name}/{lob}") public PortfolioResponse getPortfolio(@PathVariable("name") String name, @PathVariable("lob") String lob) { return portfolioService.getPortfolio(name, lob); } @Autowired  PortfolioController(PortfolioService portfolioService); @GetMapping() List<PortfolioResponse> getPortfolios(); @GetMapping("/{name}/{lob}") PortfolioResponse getPortfolio(@PathVariable("name") String name, @PathVariable("lob") String lob); @GetMapping("/{name}/{lob}/products") List<BuildingBlockMetricSummary> getPortfolioProducts(@PathVariable("name") String name,
                                                                         @PathVariable("lob") String lob); @GetMapping("/{name}/{lob}/products/{productName}") BuildingBlockMetricSummary getPortfolioProduct(
            @PathVariable("name") String name,
            @PathVariable("lob") String lob,
            @PathVariable("productName") String productName); @GetMapping("/{name}/{lob}/products/{productName}/components") List<BuildingBlockMetricSummary> getProductComponents(
            @PathVariable("name") String name,
            @PathVariable("lob") String lob,
            @PathVariable("productName") String productName);  }