use of org.apache.cxf.jaxrs.client.validation.JAXRSClientBeanValidationFeature in project cxf by apache.
the class JAXRSClientServerValidationSpringTest method testHelloRestValidationFailsIfNameIsNullClient.
@Test
public void testHelloRestValidationFailsIfNameIsNullClient() throws Exception {
JAXRSClientFactoryBean bean = new JAXRSClientFactoryBean();
bean.setAddress("http://localhost:" + PORT + "/bwrest");
bean.setServiceClass(BookWorld.class);
bean.setFeatures(Arrays.asList(new JAXRSClientBeanValidationFeature()));
BookWorld service = bean.create(BookWorld.class);
BookWithValidation bw = service.echoBook(new BookWithValidation("RS", "123"));
assertEquals("123", bw.getId());
try {
service.echoBook(new BookWithValidation(null, "123"));
fail("Validation failure expected");
} catch (ConstraintViolationException ex) {
// complete
}
}
Aggregations