|
@@ -0,0 +1,44 @@
|
|
1
|
+package rocks.zipcode.quiz3a.collections.bank;
|
|
2
|
+
|
|
3
|
+import org.junit.Assert;
|
|
4
|
+import org.junit.Test;
|
|
5
|
+import rocks.zipcode.quiz3a.collections.Bank;
|
|
6
|
+import rocks.zipcode.quiz3a.objectorientation.account.BankAccount;
|
|
7
|
+
|
|
8
|
+public class RemoveBankAccountByIndexTest {
|
|
9
|
+ @Test
|
|
10
|
+ public void test1() {
|
|
11
|
+ // given
|
|
12
|
+ Bank bank = new Bank();
|
|
13
|
+ BankAccount bankAccount = new BankAccount();
|
|
14
|
+ bank.addBankAccount(bankAccount);
|
|
15
|
+ Assert.assertTrue(bank.containsBankAccount(bankAccount));
|
|
16
|
+
|
|
17
|
+ // when
|
|
18
|
+ bank.removeBankAccountByIndex(0);
|
|
19
|
+
|
|
20
|
+ // then
|
|
21
|
+ Assert.assertFalse(bank.containsBankAccount(bankAccount));
|
|
22
|
+ }
|
|
23
|
+
|
|
24
|
+ @Test
|
|
25
|
+ public void test2() {
|
|
26
|
+ // given
|
|
27
|
+ Bank bank = new Bank();
|
|
28
|
+ BankAccount bankAccount1 = new BankAccount();
|
|
29
|
+ BankAccount bankAccount2 = new BankAccount();
|
|
30
|
+
|
|
31
|
+ bank.addBankAccount(bankAccount1);
|
|
32
|
+ bank.addBankAccount(bankAccount2);
|
|
33
|
+
|
|
34
|
+ Assert.assertTrue(bank.containsBankAccount(bankAccount1));
|
|
35
|
+ Assert.assertTrue(bank.containsBankAccount(bankAccount2));
|
|
36
|
+
|
|
37
|
+ // when
|
|
38
|
+ bank.removeBankAccountByIndex(1);
|
|
39
|
+
|
|
40
|
+ // then
|
|
41
|
+ Assert.assertTrue(bank.containsBankAccount(bankAccount1));
|
|
42
|
+ Assert.assertFalse(bank.containsBankAccount(bankAccount2));
|
|
43
|
+ }
|
|
44
|
+}
|