some code samples, various examples of simple modeling ideas and some minor algorithms.

DepositAccountTest.java 834B

123456789101112131415161718192021222324252627282930313233343536373839
  1. import static org.junit.Assert.*;
  2. import org.junit.After;
  3. import org.junit.Before;
  4. import org.junit.Test;
  5. /**
  6. * The test class DepositAccountTest.
  7. *
  8. * @author (your name)
  9. * @version (a version number or a date)
  10. */
  11. public class DepositAccountTest
  12. {
  13. @Test
  14. public void withdrawTest(){
  15. DepositAccount test = new DepositAccount(1000, 0.1D);
  16. try{test.withdraw(100);}
  17. catch(AccountException ae){};
  18. assertTrue(test.balance() == 900);
  19. }
  20. @Test
  21. public void updateTest(){
  22. DepositAccount test = new DepositAccount(1000, 0.1D);
  23. test.update();
  24. assertTrue(test.balance() == 1100);
  25. }
  26. @Test
  27. public void setIntrestTest(){
  28. DepositAccount test = new DepositAccount(1000, 0.1D);
  29. test.setInterest(0.05D);
  30. test.update();
  31. assertTrue(test.balance() == 1050);
  32. }
  33. }