/** Test adding and deleting a customer. */ public final void testAddDeleteCustomer() { // add customer try { bank.addCustomer("201", "Mr", "New", "Customer"); } catch (BankException e) { e.printStackTrace(); } // delete customer try { Customer c1 = bank.getCustomer("201"); assertNotNull(c1); c1 = bank.deleteCustomer("201"); assertNull(c1); } catch (BankException e) { e.printStackTrace(); } // force exception try { Customer c2 = bank.deleteCustomer("999"); // TODO: cause exception // fail("deleteCustomer hasn't caused an exception as it should"); } catch (BankException e) { // ignore } } // testAddDeleteCustomer
/** Remove the accounts and customers. */ protected final void tearDown() { // delete test accounts and customers try { bank.deleteAccount("120-2001"); bank.deleteAccount("120-2002"); bank.deleteAccount("120-2010"); bank.deleteAccount("120-2011"); bank.deleteAccount("120-2012"); bank.deleteCustomer("120"); bank.deleteCustomer("130"); } catch (BankException ex) { ex.printStackTrace(); } bank = null; } // tearDown