@Test public void getProductComponents() throws Exception { when(portfolioService.getProductComponents("test", "LOB","product1")).thenReturn(Stream.of(TestUtils.makeBuildingBlockMetricSummary()).collect(Collectors.toList())); mockMvc.perform(MockMvcRequestBuilders.get("/portfolio/test/lob/products/product1/components")) .andExpect(status().isOk()); verify(portfolioService).getProductComponents("test", "lob","product1"); }
@GetMapping("/{name}/{lob}/products/{productName}/components") public List<BuildingBlockMetricSummary> getProductComponents( @PathVariable("name") String name, @PathVariable("lob") String lob, @PathVariable("productName") String productName) { return portfolioService.getProductComponents(name, lob, productName); }
PortfolioController { @GetMapping("/{name}/{lob}/products/{productName}/components") public List<BuildingBlockMetricSummary> getProductComponents( @PathVariable("name") String name, @PathVariable("lob") String lob, @PathVariable("productName") String productName) { return portfolioService.getProductComponents(name, lob, productName); } }
PortfolioController { @GetMapping("/{name}/{lob}/products/{productName}/components") public List<BuildingBlockMetricSummary> getProductComponents( @PathVariable("name") String name, @PathVariable("lob") String lob, @PathVariable("productName") String productName) { return portfolioService.getProductComponents(name, lob, productName); } @Autowired  PortfolioController(PortfolioService portfolioService); }
PortfolioController { @GetMapping("/{name}/{lob}/products/{productName}/components") public List<BuildingBlockMetricSummary> getProductComponents( @PathVariable("name") String name, @PathVariable("lob") String lob, @PathVariable("productName") String productName) { return portfolioService.getProductComponents(name, lob, productName); } @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}/products/{productName}/components") public List<BuildingBlockMetricSummary> getProductComponents( @PathVariable("name") String name, @PathVariable("lob") String lob, @PathVariable("productName") String productName) { return portfolioService.getProductComponents(name, lob, productName); } @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);  }