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

123456789101112131415161718192021222324252627282930313233343536
  1. import static org.junit.Assert.*;
  2. import org.junit.After;
  3. import org.junit.Before;
  4. import org.junit.Test;
  5. public class AccountTest
  6. {
  7. Account account;
  8. @Before
  9. public void setUp()
  10. {
  11. account = new Account();
  12. }
  13. @Test
  14. public void depositTest()
  15. {
  16. account = new Account(1000);
  17. account.deposit(100);
  18. int expected = 1100;
  19. int actual = account.balance();
  20. assertEquals(expected, actual);
  21. }
  22. @Test
  23. public void balanceTest() {
  24. account = new Account(1000);
  25. int expected = 1000;
  26. int actual = account.balance();
  27. assertEquals(expected, actual);
  28. }
  29. }