### Question:
ProductController { @RequestMapping(method = RequestMethod.GET) public Iterable<Product> getProducts(@RequestParam("category") long categoryId) { return productService.findProductsByCategoryId(categoryId); }  @RequestMapping(path = "/{productId}", method = RequestMethod.GET) Product getProductDetail(@PathVariable("productId") long productId); @RequestMapping(method = RequestMethod.GET) Iterable<Product> getProducts(@RequestParam("category") long categoryId);  }### Answer:
@Test public void shouldReturnTheProductsOfACategory() { long categoryId = 1; List<Product> products = TestDataFactory.getProductList(5, categoryId); when(productService.findProductsByCategoryId(categoryId)).thenReturn(products); assertThat(productController.getProducts(categoryId)).isEqualTo(products); }