use of org.example.customers.NoSuchCustomer in project tesb-rt-se by Talend.
the class CustomerServiceImpl method getCustomerByName.
public Customer getCustomerByName(String name) throws NoSuchCustomerException {
if (name.equals("John")) {
throw new RuntimeException("John is not available");
}
if (!name.equals(customer.getName())) {
NoSuchCustomer noSuchCustomer = new NoSuchCustomer();
noSuchCustomer.setCustomerName(name);
throw new NoSuchCustomerException("Did not find any matching customer for name=" + name, noSuchCustomer);
}
return customer;
}
Aggregations