use of javax.ws.rs.core.Form in project dropwizard by dropwizard.
the class OptionalFormParamResourceTest method shouldReturnMessageWhenMessageIsPresent.
@Test
public void shouldReturnMessageWhenMessageIsPresent() throws IOException {
final String customMessage = "Custom Message";
final Form form = new Form("message", customMessage);
final Response response = target("/optional/message").request().post(Entity.form(form));
assertThat(response.readEntity(String.class)).isEqualTo(customMessage);
}
use of javax.ws.rs.core.Form 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.Form 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.Form in project dropwizard by dropwizard.
the class OptionalFormParamResourceTest method shouldReturnMessageWhenMessageBlank.
@Test
public void shouldReturnMessageWhenMessageBlank() throws IOException {
final Form form = new Form("message", "");
final Response response = target("/optional/message").request().post(Entity.form(form));
assertThat(response.readEntity(String.class)).isEqualTo("");
}
use of javax.ws.rs.core.Form in project dropwizard by dropwizard.
the class OptionalFormParamResourceTest method shouldThrowBadRequestExceptionWhenInvalidUUIDIsPresent.
@Test
public void shouldThrowBadRequestExceptionWhenInvalidUUIDIsPresent() throws IOException {
final String invalidUUID = "invalid-uuid";
final Form form = new Form("uuid", invalidUUID);
final Response response = target("/optional/uuid").request().post(Entity.form(form));
assertThat(response.getStatus()).isEqualTo(Response.Status.BAD_REQUEST.getStatusCode());
}
Aggregations