Browse Source

added empty tests

Trinh Tong 6 years ago
parent
commit
89a2fff781
2 changed files with 94 additions and 19 deletions
  1. 4
    17
      Checkbook/src/main/java/Checkbook.java
  2. 90
    2
      Checkbook/src/test/java/CheckbookTest.java

+ 4
- 17
Checkbook/src/main/java/Checkbook.java View File

@@ -72,7 +72,7 @@ public class Checkbook {
72 72
         return sum;
73 73
     }
74 74
 
75
-    public ArrayList<Transaction> getCheckbook() {
75
+    public List<Transaction> getCheckbook() {
76 76
         return checkbook;
77 77
     }
78 78
 
@@ -81,7 +81,7 @@ public class Checkbook {
81 81
         List<Transaction> arr = new ArrayList<>();
82 82
         for (Transaction ts : this.checkbook) {
83 83
             Object valueToCheck = getObject(fieldName, ts);
84
-            if (valueToCheck.equals(value)) {
84
+            if (valueToCheck != null && valueToCheck.equals(value)) {
85 85
                 arr.add(ts);
86 86
             }
87 87
         }
@@ -97,11 +97,9 @@ public class Checkbook {
97 97
         } catch (NoSuchFieldException | IllegalAccessException noField) {
98 98
             noField.printStackTrace();
99 99
         }
100
-
101 100
         return null;
102 101
     }
103 102
 
104
-
105 103
     public boolean containsAll(Collection<Transaction> c) {
106 104
         return checkbook.containsAll(c);
107 105
     }
@@ -118,22 +116,11 @@ public class Checkbook {
118 116
         checkbook.clear();
119 117
     }
120 118
 
121
-    private Transaction[] getAllTransactionByType(TransactionType tt) {
122
-        ArrayList<Transaction> arr = new ArrayList<>();
123
-        for (Transaction t: this.checkbook) {
124
-            if (t.getType().equals(tt)) {
125
-                arr.add(t);
126
-            }
127
-        }
128
-        return this.toArrayFromList(arr);
129
-    }
130
-
131
-
132 119
     public Transaction[] getAllDebitTransactions() {
133
-        return getAllTransactionByType(TransactionType.DEBIT);
120
+        return getSpecificTransactions("typee", TransactionType.DEBIT);
134 121
     }
135 122
 
136 123
     public Transaction[] getAllCreditTransactions() {
137
-        return getAllTransactionByType(TransactionType.CREDIT);
124
+        return getSpecificTransactions("typee", TransactionType.CREDIT);
138 125
     }
139 126
 }

+ 90
- 2
Checkbook/src/test/java/CheckbookTest.java View File

@@ -229,7 +229,7 @@ public class CheckbookTest {
229 229
     }
230 230
 
231 231
     @Test
232
-    public void getTransactionAddingNewTForDateA() {
232
+    public void getTransactionAddingNewTForDate() {
233 233
         LocalDate a = LocalDate.of(2018, 12, 05);
234 234
         Transaction t = new Transaction("foo", p1, TransactionType.DEBIT, 2.00);
235 235
 
@@ -255,5 +255,93 @@ public class CheckbookTest {
255 255
         assertEquals(expArr, checkbookWithOwner.getSpecificTransactions("payee", payee));
256 256
     }
257 257
 
258
-    // Contains all,
258
+    @Test
259
+    public void testContainsAll() {
260
+
261
+    }
262
+
263
+    @Test
264
+    public void testContainsNone() {
265
+
266
+    }
267
+
268
+    @Test
269
+    public void testContainsAllAddThenCheck() {
270
+
271
+    }
272
+
273
+    @Test
274
+    public void testAddAll() {
275
+
276
+    }
277
+
278
+    @Test
279
+    public void testAddAllNone() {
280
+
281
+    }
282
+
283
+    @Test
284
+    public void testAddAllException() {
285
+
286
+    }
287
+
288
+    @Test
289
+    public void testRemoveAll() {
290
+
291
+    }
292
+
293
+    @Test
294
+    public void testRemoveAllNone() {
295
+
296
+    }
297
+
298
+    @Test
299
+    public void testRemoveAllAddNewTransactions() {
300
+
301
+    }
302
+
303
+    @Test
304
+    public void testClear() {
305
+
306
+    }
307
+
308
+    @Test
309
+    public void testClearEmpty() {
310
+
311
+    }
312
+
313
+    @Test
314
+    public void testClearAddAndRemove() {
315
+
316
+    }
317
+
318
+    @Test
319
+    public void testGetDebits() {
320
+
321
+    }
322
+
323
+    @Test
324
+    public void testGetDebitsNone() {
325
+
326
+    }
327
+
328
+    @Test
329
+    public void testGetDebitsAdded() {
330
+
331
+    }
332
+
333
+    @Test
334
+    public void testGetCredits() {
335
+
336
+    }
337
+
338
+    @Test
339
+    public void testGetCreditsNone() {
340
+
341
+    }
342
+
343
+    @Test
344
+    public void testGetCreditsRemoveAndAdd() {
345
+
346
+    }
259 347
 }