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;