Leon Hunter vor 5 Jahren
Ursprung
Commit
8a51e96de6

+ 4
- 8
src/main/java/rocks/zipcode/quiz3a/collections/Bank.java Datei anzeigen

@@ -8,18 +8,14 @@ import java.util.List;
8 8
  * @author leon on 27/12/2018.
9 9
  */
10 10
 public class Bank {
11
-    public List<BankAccount> getBankAccounts() {
11
+    public BankAccount removeBankAccountByIndex(Integer indexNumber) {
12 12
         return null;
13 13
     }
14 14
 
15
-    public void setBankAccounts(List<BankAccount> bankAccounts) {
15
+    public void addBankAccount(BankAccount bankAccount) {
16 16
     }
17 17
 
18
-    public BankAccount findBankAccountById(Long id) {
19
-        return null;
20
-    }
21
-
22
-    public BankAccount removeBankAccount(Long id) {
23
-        return null;
18
+    public Boolean containsBankAccount(BankAccount bankAccount) {
19
+        throw new UnsupportedOperationException("Method not yet implemented");
24 20
     }
25 21
 }

+ 3
- 0
src/main/java/rocks/zipcode/quiz3a/collections/WordCounter.java Datei anzeigen

@@ -3,6 +3,9 @@ package rocks.zipcode.quiz3a.collections;
3 3
 import java.util.Map;
4 4
 
5 5
 public class WordCounter {
6
+    public WordCounter(String... strings) {
7
+    }
8
+
6 9
     public static Map<String, Integer> getWordCountMap() {
7 10
         return null;
8 11
     }

+ 22
- 0
src/test/java/rocks/zipcode/quiz3a/collections/bank/AddBankAccountTest.java Datei anzeigen

@@ -0,0 +1,22 @@
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 AddBankAccountTest {
9
+    @Test
10
+    public void test1() {
11
+        // given
12
+        Bank bank = new Bank();
13
+        BankAccount bankAccount = new BankAccount();
14
+        Assert.assertFalse(bank.containsBankAccount(bankAccount));
15
+
16
+        // when
17
+        bank.addBankAccount(bankAccount);
18
+
19
+        // then
20
+        Assert.assertTrue(bank.containsBankAccount(bankAccount));
21
+    }
22
+}

+ 0
- 4
src/test/java/rocks/zipcode/quiz3a/collections/bank/FindBankAccountByIdTest.java Datei anzeigen

@@ -1,4 +0,0 @@
1
-package rocks.zipcode.quiz3a.collections.bank;
2
-
3
-public class FindBankAccountByIdTest {
4
-}

+ 44
- 0
src/test/java/rocks/zipcode/quiz3a/collections/bank/RemoveBankAccountByIndexTest.java Datei anzeigen

@@ -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
+}

+ 0
- 4
src/test/java/rocks/zipcode/quiz3a/collections/bank/RemoveBankAccountTest.java Datei anzeigen

@@ -1,4 +0,0 @@
1
-package rocks.zipcode.quiz3a.collections.bank;
2
-
3
-public class RemoveBankAccountTest {
4
-}

+ 0
- 4
src/test/java/rocks/zipcode/quiz3a/collections/bank/SetBankAccountsTest.java Datei anzeigen

@@ -1,4 +0,0 @@
1
-package rocks.zipcode.quiz3a.collections.bank;
2
-
3
-public class SetBankAccountsTest {
4
-}