Package org.glassfish.jersey.examples.beanvalidation.webapp.domain

Examples of org.glassfish.jersey.examples.beanvalidation.webapp.domain.ContactCard


                path("contact");
        final Response response = target.
                request(MediaType.APPLICATION_JSON_TYPE).
                post(Entity.entity(CARD_1, MediaType.APPLICATION_JSON_TYPE));

        final ContactCard contactCard = response.readEntity(ContactCard.class);

        assertEquals(200, response.getStatus());
        assertNotNull(contactCard.getId());

        final Response invalidResponse = target.
                request(MediaType.APPLICATION_JSON_TYPE).
                post(Entity.entity(CARD_1, MediaType.APPLICATION_JSON_TYPE));
        assertEquals(500, invalidResponse.getStatus());
        assertTrue(getValidationMessageTemplates(invalidResponse).contains("{contact.already.exist}"));

        assertEquals(200, target.path("" + contactCard.getId()).request(MediaType.APPLICATION_JSON_TYPE).delete().getStatus());
    }
View Full Code Here


        return templates;
    }

    @Test
    public void testAddInvalidContact() throws Exception {
        final ContactCard entity = new ContactCard();
        entity.setPhone("Crrrn");

        final Response response = target().
                path("contact").
                request(MediaType.APPLICATION_JSON_TYPE).
                post(Entity.entity(entity, MediaType.APPLICATION_JSON_TYPE));
View Full Code Here

TOP

Related Classes of org.glassfish.jersey.examples.beanvalidation.webapp.domain.ContactCard

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.