Search in sources :

Example 1 with ValidationErrorMessage

use of io.dropwizard.jersey.validation.ValidationErrorMessage in project API by ca-cwds.

the class StaffPersonResourceTest method createDelegatesToResourceDelegate.

/**
   * Create Tests
   * 
   * @throws Exception required for test compilation
   */
@Test
public void createDelegatesToResourceDelegate() throws Exception {
    StaffPerson staffperson = new StaffPerson("1969-01-01", "Bart", "Student", "Simpson", "Q", "", new BigDecimal(9165551212L), 124, "1969-01-01", "", true, "abcdefghij", "description", "id", "03", false, "1234567890", "emailaddy");
    final Response resp = inMemoryResource.client().target(ROOT_RESOURCE).request().accept(MediaType.APPLICATION_JSON).post(Entity.entity(staffperson, MediaType.APPLICATION_JSON));
    ValidationErrorMessage msg = resp.readEntity(ValidationErrorMessage.class);
    if (msg != null) {
        final List<String> errors = msg.getErrors();
        if (errors != null && errors.size() > 0) {
            for (String err : errors) {
                System.out.println("ERROR: " + err);
            }
        }
    }
    verify(resourceDelegate).create(eq(staffperson));
}
Also used : Response(javax.ws.rs.core.Response) StaffPerson(gov.ca.cwds.rest.api.domain.cms.StaffPerson) ValidationErrorMessage(io.dropwizard.jersey.validation.ValidationErrorMessage) BigDecimal(java.math.BigDecimal) Test(org.junit.Test)

Aggregations

StaffPerson (gov.ca.cwds.rest.api.domain.cms.StaffPerson)1 ValidationErrorMessage (io.dropwizard.jersey.validation.ValidationErrorMessage)1 BigDecimal (java.math.BigDecimal)1 Response (javax.ws.rs.core.Response)1 Test (org.junit.Test)1