/* This is the test class for BankAccount.
 * We write a tester for each method.
 * Every tester name starts with "test".
 * They are public and void methods with no arguments.
 * Compile this file and click "Test" to see if all testcases
 * pass. 
 * Try to complete the "testWithdraw" method.
 */ 
import junit.framework.TestCase;

public class BankAccountTester extends TestCase {
  
  /**
   * Test the constructors in the BankAccount class.
   * 
   * Method name must start with "test".
   */ 
  public void testConstructors() {
    
    int numAccounts = BankAccount.getTotalNumAccounts();
    
    BankAccount b1 = new BankAccount("Angelina", "Jolie", 500000.0, true, 1234);
    
    // assertEquals(expectedValue, actualValue)
    // if expectedValue equals actualValue the
    // test case passes, otherwise it fails
    
    assertEquals(500000.0, b1.getBalance());
    assertEquals(numAccounts + 1, BankAccount.getTotalNumAccounts());
    
    assertNotNull(b1);

    BankAccount b2 = new BankAccount("Brad", "Pitt", 0.0, false, 4321);
    
    assertEquals(numAccounts + 2, BankAccount.getTotalNumAccounts());
    
    // for more information, see the following URL for all assertEquals methods:
    // http://junit.sourceforge.net/javadoc/
  }
  
  /**
   * Test the depost method in the BankAccount class.
   * 
   * Method name must start with "test".
   */ 
  public void testDeposit() {
    BankAccount b = new BankAccount("A", "B", 100.0, true, 1111);

    b.deposit(205.1);
    assertEquals(300.1, b.getBalance());

    b.deposit(1000.0);
    assertEquals(1295.0, b.getBalance(), 0.1);
  }

  /**
   * Test the withdraw method in the BankAccount class.
   * 
   * Method name must start with "test".
   */ 
  public void testWithdraw() {
   //complete this!
  }
}