customers.put(newCustomer.getName(), newCustomer);
return newCustomer;
}
public Customer getCustomerByName(String name) throws NoSuchCustomerException {
Customer customer = customers.get(name);
if (customer == null) {
NoSuchCustomer noSuchCustomer = new NoSuchCustomer();
noSuchCustomer.setCustomerName(name);
throw new NoSuchCustomerException("Did not find any matching customer for name=" + name,
noSuchCustomer);