Пример #1
0
  @Test
  public void testDelete() {
    try {
      accVec.create(new OrdinaryAccount("200"));
      assertEquals(1, accVec.numberOfAccounts(), 0);
      accVec.delete("200");
      assertEquals(0, accVec.numberOfAccounts(), 0);

    } catch (AccountCreationException acex) {
      System.out.println("Should not enter this catch block");
    } catch (AccountDeletionException adex) {
      System.out.println("Should not enter this catch block either");
    }
  }
Пример #2
0
  @Test
  public void testNumberOfAccounts() {
    try {
      accVec.delete("200");
    } catch (AccountDeletionException ade) {

    } finally {
      assertEquals(0, accVec.numberOfAccounts(), 0);
    }

    try {
      accVec.create(new OrdinaryAccount("300"));
      assertEquals(1, accVec.numberOfAccounts(), 0);

    } catch (AccountCreationException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
  }