use of javax.ws.rs.core.Response in project dropwizard by dropwizard.
the class OptionalFormParamResourceTest method shouldReturnUUIDWhenValidUUIDIsPresent.
@Test
public void shouldReturnUUIDWhenValidUUIDIsPresent() throws IOException {
final String uuid = "fd94b00d-bd50-46b3-b42f-905a9c9e7d78";
final Form form = new Form("uuid", uuid);
final Response response = target("/optional/uuid").request().post(Entity.form(form));
assertThat(response.readEntity(String.class)).isEqualTo(uuid);
}
use of javax.ws.rs.core.Response in project dropwizard by dropwizard.
the class OptionalFormParamResourceTest method shouldReturnMyMessageWhenMyMessageIsPresent.
@Test
public void shouldReturnMyMessageWhenMyMessageIsPresent() throws IOException {
final String myMessage = "My Message";
final Form form = new Form("mymessage", myMessage);
final Response response = target("/optional/my-message").request().post(Entity.form(form));
assertThat(response.readEntity(String.class)).isEqualTo(myMessage);
}
use of javax.ws.rs.core.Response in project dropwizard by dropwizard.
the class ConstraintViolationExceptionMapperTest method maxMessageContainsParameterName.
@Test
public void maxMessageContainsParameterName() {
final Response response = target("/valid/paramValidation").queryParam("length", 50).request().get();
assertThat(response.getStatus()).isEqualTo(400);
assertThat(response.readEntity(String.class)).containsOnlyOnce("query param length must be less than or equal to 5");
}
use of javax.ws.rs.core.Response in project dropwizard by dropwizard.
the class ConstraintViolationExceptionMapperTest method getInvalidCookieParamsIs400.
@Test
public void getInvalidCookieParamsIs400() throws Exception {
final Response response = target("/valid/cooks").request().get();
assertThat(response.getStatus()).isEqualTo(400);
String ret = "{\"errors\":[\"cookie user_id may not be empty\"]}";
assertThat(response.readEntity(String.class)).isEqualTo(ret);
}
use of javax.ws.rs.core.Response in project dropwizard by dropwizard.
the class ConstraintViolationExceptionMapperTest method getInvalidNestedReturnIs500.
@Test
public void getInvalidNestedReturnIs500() throws Exception {
final Response response = target("/valid/nested").request().get();
assertThat(response.getStatus()).isEqualTo(500);
String ret = "{\"errors\":[\"server response representation.name may not be empty\"]}";
assertThat(response.readEntity(String.class)).isEqualTo(ret);
}
Aggregations