Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @Named
- @Path(CUSTOMERS_PATH)
- @Produces(MediaType.APPLICATION_JSON)
- public class CustomerResourceImpl extends AbstractResource implements
- ICustomerResource
- ...
- @Override
- @POST
- @Consumes(MediaType.APPLICATION_JSON)
- public Response add(final CustomerDto pDto) {
- try {
- getService().add(pDto);
- } catch (final ValidationException ve) {
- badRequest(ve.getErrors());
- }
- return Response.ok().build();
- }
- }
- @Test
- public void addTest() {
- final Response response = target(NameTokens.CUSTOMERS_PATH).request()
- .header("Content-Type", MediaType.APPLICATION_JSON)
- .post(Entity.entity(new CustomerDto(), MediaType.APPLICATION_JSON));
- Assert.assertNotNull(response, "Response cannot be null");
- Assert.assertEquals(response.getStatus(), Status.OK.getStatusCode(),
- "Response status code isn't ok");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement