@Test public void createProductWithExistingId() { int databaseSizeBeforeCreate = productRepository.findAll().size(); product.setId(10L); given() .contentType(JSON) .body(product) .when().post("/api/products") .then() .statusCode(400); List<Product> productList = productRepository.findAll(); Assertions.assertEquals(productList.size(), databaseSizeBeforeCreate); }
@GET @Path("/products") public Response findAll(@BeanParam PageableImpl pageable) { LOGGER.debug("REST request to get all Products"); return Response.ok().entity(productService.findAll(pageable)).build(); }
ProductResource { @GET @Path("/products") public Response findAll(@BeanParam PageableImpl pageable) { LOGGER.debug("REST request to get all Products"); return Response.ok().entity(productService.findAll(pageable)).build(); } }
ProductResource { @GET @Path("/products") public Response findAll(@BeanParam PageableImpl pageable) { LOGGER.debug("REST request to get all Products"); return Response.ok().entity(productService.findAll(pageable)).build(); } @Inject  ProductResource(ProductService productService); }
ProductResource { @GET @Path("/products") public Response findAll(@BeanParam PageableImpl pageable) { LOGGER.debug("REST request to get all Products"); return Response.ok().entity(productService.findAll(pageable)).build(); } @Inject  ProductResource(ProductService productService); @GET @Path("/products") Response findAll(@BeanParam PageableImpl pageable); @GET @Path("/products/search") Page<ProductDTO> findAllByProductName(@QueryParam("name") String name, @BeanParam PageableImpl pageable); @GET @Path("/products/{id}") Response findById(@PathParam("id") long id); @POST @Path("/products") Response create(ProductDTO productDTO); @PUT @Path("/products") Response update(ProductDTO productDTO); @DELETE @Path("/products/{id}") Response delete(@PathParam("id") long id); }
ProductResource { @GET @Path("/products") public Response findAll(@BeanParam PageableImpl pageable) { LOGGER.debug("REST request to get all Products"); return Response.ok().entity(productService.findAll(pageable)).build(); } @Inject  ProductResource(ProductService productService); @GET @Path("/products") Response findAll(@BeanParam PageableImpl pageable); @GET @Path("/products/search") Page<ProductDTO> findAllByProductName(@QueryParam("name") String name, @BeanParam PageableImpl pageable); @GET @Path("/products/{id}") Response findById(@PathParam("id") long id); @POST @Path("/products") Response create(ProductDTO productDTO); @PUT @Path("/products") Response update(ProductDTO productDTO); @DELETE @Path("/products/{id}") Response delete(@PathParam("id") long id);  }