Search in sources :

Example 1 with NoSuchCustomer

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;
}
Also used : NoSuchCustomer(org.example.customers.NoSuchCustomer) NoSuchCustomerException(org.example.customers.NoSuchCustomerException)

Aggregations

NoSuchCustomer (org.example.customers.NoSuchCustomer)1 NoSuchCustomerException (org.example.customers.NoSuchCustomerException)1