return new NoSuchCustomerException();
}
});
CustomerService customerService = JAXRSClientFactory
.createFromModel("http://localhost:" + port + "/services/jaxrs", CustomerService.class,
"classpath:/data/model/CustomerService-jaxrs.xml", providers, null);
System.out.println("Using RESTful CustomerService");
Customer customer = createCustomer("Smith");
customerService.updateCustomer(customer);
customer = customerService.getCustomerByName("Smith");
printCustomerDetails(customer);
customer = customerService.getCustomerByName("Barry");
if (customer != null) {
throw new RuntimeException("Barry should not be found");
}
System.out.println("Status : " + WebClient.client(customerService).getResponse().getStatus());
try {
customerService.getCustomerByName("John");
throw new RuntimeException("Exception is expected");
} catch (NoSuchCustomerException ex) {
System.out.println("NoSuchCustomerException : John");
}
}