@Test public void createCategoryWithExistingId() { int databaseSizeBeforeCreate = categoryRepository.findAll().size(); category.setId(10L); given() .contentType(JSON) .body(category) .when().post("/api/categories") .then() .statusCode(400); List<Category> categoryList = categoryRepository.findAll(); Assertions.assertEquals(categoryList.size(), databaseSizeBeforeCreate); }
@GET @Path("/categories") public Response findAll(@BeanParam PageableImpl pageable) { LOGGER.debug("REST request to get all Categories"); return Response.ok().entity(categoryService.findAll(pageable)).build(); }
CategoryResource { @GET @Path("/categories") public Response findAll(@BeanParam PageableImpl pageable) { LOGGER.debug("REST request to get all Categories"); return Response.ok().entity(categoryService.findAll(pageable)).build(); } }
CategoryResource { @GET @Path("/categories") public Response findAll(@BeanParam PageableImpl pageable) { LOGGER.debug("REST request to get all Categories"); return Response.ok().entity(categoryService.findAll(pageable)).build(); } @Inject  CategoryResource(CategoryService categoryService); }
CategoryResource { @GET @Path("/categories") public Response findAll(@BeanParam PageableImpl pageable) { LOGGER.debug("REST request to get all Categories"); return Response.ok().entity(categoryService.findAll(pageable)).build(); } @Inject  CategoryResource(CategoryService categoryService); @GET @Path("/categories") Response findAll(@BeanParam PageableImpl pageable); @GET @Path("/categories/search") List<CategoryDTO> findAllByCategoryName(@QueryParam("name") String fullName); @GET @Path("/categories/{id}") Response findById(@PathParam("id") long id); @POST @Path("/categories") Response create(CategoryDTO categoryDTO); @PUT @Path("/categories") Response update(CategoryDTO categoryDTO); @DELETE @Path("/categories/{id}") Response delete(@PathParam("id") long id); }
CategoryResource { @GET @Path("/categories") public Response findAll(@BeanParam PageableImpl pageable) { LOGGER.debug("REST request to get all Categories"); return Response.ok().entity(categoryService.findAll(pageable)).build(); } @Inject  CategoryResource(CategoryService categoryService); @GET @Path("/categories") Response findAll(@BeanParam PageableImpl pageable); @GET @Path("/categories/search") List<CategoryDTO> findAllByCategoryName(@QueryParam("name") String fullName); @GET @Path("/categories/{id}") Response findById(@PathParam("id") long id); @POST @Path("/categories") Response create(CategoryDTO categoryDTO); @PUT @Path("/categories") Response update(CategoryDTO categoryDTO); @DELETE @Path("/categories/{id}") Response delete(@PathParam("id") long id);  }