use of javax.ws.rs.client.WebTarget in project jersey by jersey.
the class ValidateOnExecutionBasicTest method testOnMethodGetterMiss.
@Test
public void testOnMethodGetterMiss() throws Exception {
final WebTarget target = target("getter-on-method-miss");
Response response = target.request().get();
assertThat(response.getStatus(), equalTo(400));
response = target.path("sanity").request().get();
assertThat(response.getStatus(), equalTo(400));
}
use of javax.ws.rs.client.WebTarget in project jersey by jersey.
the class ValidateOnExecutionBasicTest method testOnTypeGetterMatch.
@Test
public void testOnTypeGetterMatch() throws Exception {
final WebTarget target = target("getter-on-type-match");
assertThat(target.request().get().getStatus(), equalTo(400));
assertThat(target.path("sanity").request().get().getStatus(), equalTo(400));
}
use of javax.ws.rs.client.WebTarget in project jersey by jersey.
the class ValidateOnExecutionBasicTest method testGetterResourceMethod.
/**
* Validation should fail when getter (also a resource method) is invoked and not when the resource class is validated.
*/
@Test
public void testGetterResourceMethod() throws Exception {
final WebTarget target = target("getter-resource-method");
final Response response = target.request().get();
assertThat(response.getStatus(), equalTo(500));
}
use of javax.ws.rs.client.WebTarget in project jersey by jersey.
the class ValidateOnExecutionBasicTest method testOnTypeGetterNull.
@Test
public void testOnTypeGetterNull() throws Exception {
final WebTarget target = target("on-type-getter-null");
Response response = target.path("nogetter").request().get();
assertThat(response.getStatus(), equalTo(400));
response = target.path("getter").request().get();
assertThat(response.getStatus(), equalTo(400));
}
use of javax.ws.rs.client.WebTarget in project jersey by jersey.
the class ValidateOnExecutionBasicTest method testBeansValidateGetterInvalidReturnPhone.
@Test
public void testBeansValidateGetterInvalidReturnPhone() throws Exception {
final WebTarget target = target("getter-on-beans").path("invalidPhone");
final AnotherContactBean contactBean = new AnotherContactBean("jersey@example.com", null, "Jersey JAX-RS", null);
final Response response = target.request().post(Entity.xml(contactBean));
contactBean.setPhone("12");
assertThat(response.getStatus(), equalTo(200));
assertThat(response.readEntity(AnotherContactBean.class), equalTo(contactBean));
}
Aggregations