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

AccountTest.java 693B

1234567891011121314151617181920212223242526272829303132
  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. @Test
  8. public void accountCreationTest() {
  9. Account actual = new Account(100);
  10. assertNotNull(actual);
  11. }
  12. @Test
  13. public void depositTest() {
  14. Account test = new Account(50);
  15. test.deposit(50);
  16. int expected = 100;
  17. int actual = test.balance();
  18. assertEquals(expected, actual);
  19. }
  20. @Test
  21. public void nullaryConstructorTest() {
  22. Account test = new Account();
  23. int expected = 0;
  24. int actual = test.balance();
  25. assertEquals(expected, actual);
  26. }
  27. }