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

AccountTest.java 1.2KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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 AccountTest.
  7. *
  8. * @author (your name)
  9. * @version (a version number or a date)
  10. */
  11. public class AccountTest
  12. {
  13. /**
  14. * Default constructor for test class AccountTest
  15. */
  16. public AccountTest()
  17. {
  18. }
  19. /**
  20. * Sets up the test fixture.
  21. *
  22. * Called before every test case method.
  23. */
  24. @Before
  25. public void setUp()
  26. {
  27. }
  28. /**
  29. * Tears down the test fixture.
  30. *
  31. * Called after every test case method.
  32. */
  33. @After
  34. public void tearDown()
  35. {
  36. }
  37. @Test
  38. public void accountSum()
  39. {
  40. Account account1 = new Account(0);
  41. assertEquals(null, account1.open(5));
  42. }
  43. @Test
  44. public void deposit()
  45. {
  46. Account account1 = new Account();
  47. account1.deposit(5);
  48. }
  49. @Test
  50. public void balance()
  51. {
  52. Account account2 = new Account();
  53. assertEquals(10, account2.balance());
  54. }
  55. @Test
  56. public void transfer()
  57. {
  58. Account account1 = new Account();
  59. account1.deposit(10);
  60. assertEquals(true, account1.transfer(account1, 5));
  61. }
  62. }