Przeglądaj źródła

checkbook tests finished

Trinh Tong 6 lat temu
rodzic
commit
16ff93f08f

+ 87
- 70
.idea/workspace.xml Wyświetl plik

@@ -2,6 +2,8 @@
2 2
 <project version="4">
3 3
   <component name="ChangeListManager">
4 4
     <list default="true" id="926ad23d-2ddc-41ae-980d-780dcc1811fa" name="Default" comment="">
5
+      <change beforePath="$PROJECT_DIR$/Checkbook/src/main/java/Account.java" beforeDir="false" afterPath="$PROJECT_DIR$/Checkbook/src/main/java/Account.java" afterDir="false" />
6
+      <change beforePath="$PROJECT_DIR$/Checkbook/src/main/java/Checkbook.java" beforeDir="false" afterPath="$PROJECT_DIR$/Checkbook/src/main/java/Checkbook.java" afterDir="false" />
5 7
       <change beforePath="$PROJECT_DIR$/Checkbook/src/test/java/CheckbookTest.java" beforeDir="false" afterPath="$PROJECT_DIR$/Checkbook/src/test/java/CheckbookTest.java" afterDir="false" />
6 8
     </list>
7 9
     <ignored path="$PROJECT_DIR$/Checkbook/target/" />
@@ -22,13 +24,13 @@
22 24
       <usages-collector id="statistics.file.types.open">
23 25
         <counts>
24 26
           <entry key="CLASS" value="6" />
25
-          <entry key="JAVA" value="44" />
27
+          <entry key="JAVA" value="45" />
26 28
           <entry key="Markdown" value="1" />
27 29
         </counts>
28 30
       </usages-collector>
29 31
       <usages-collector id="statistics.file.types.edit">
30 32
         <counts>
31
-          <entry key="JAVA" value="9750" />
33
+          <entry key="JAVA" value="11342" />
32 34
           <entry key="Markdown" value="11" />
33 35
         </counts>
34 36
       </usages-collector>
@@ -40,8 +42,8 @@
40 42
         <entry file="file://$PROJECT_DIR$/README.md">
41 43
           <provider selected="true" editor-type-id="split-provider[text-editor;markdown-preview-editor]">
42 44
             <state split_layout="FIRST">
43
-              <first_editor relative-caret-position="283">
44
-                <caret line="48" lean-forward="true" selection-start-line="48" selection-end-line="48" />
45
+              <first_editor relative-caret-position="214">
46
+                <caret line="45" column="14" lean-forward="true" selection-start-line="45" selection-start-column="14" selection-end-line="45" selection-end-column="14" />
45 47
               </first_editor>
46 48
               <second_editor />
47 49
             </state>
@@ -51,7 +53,7 @@
51 53
       <file pinned="false" current-in-tab="false">
52 54
         <entry file="file://$PROJECT_DIR$/Checkbook/src/main/java/Transaction.java">
53 55
           <provider selected="true" editor-type-id="text-editor">
54
-            <state relative-caret-position="-279">
56
+            <state relative-caret-position="-438">
55 57
               <caret line="12" column="26" lean-forward="true" selection-start-line="12" selection-start-column="26" selection-end-line="12" selection-end-column="26" />
56 58
               <folding>
57 59
                 <element signature="imports" expanded="true" />
@@ -63,13 +65,12 @@
63 65
       <file pinned="false" current-in-tab="false">
64 66
         <entry file="file://$PROJECT_DIR$/Checkbook/src/main/java/Checkbook.java">
65 67
           <provider selected="true" editor-type-id="text-editor">
66
-            <state relative-caret-position="-1294">
67
-              <caret line="45" lean-forward="true" selection-start-line="45" selection-end-line="45" />
68
+            <state relative-caret-position="169">
69
+              <caret line="47" column="45" lean-forward="true" selection-start-line="47" selection-start-column="45" selection-end-line="47" selection-end-column="45" />
68 70
               <folding>
69 71
                 <element signature="imports" expanded="true" />
70 72
                 <element signature="e#1262#1263#0" expanded="true" />
71 73
                 <element signature="e#1316#1317#0" expanded="true" />
72
-                <element signature="e#1584#1585#0" expanded="true" />
73 74
                 <element signature="e#1641#1642#0" expanded="true" />
74 75
                 <element signature="e#2881#2882#0" expanded="true" />
75 76
                 <element signature="e#2928#2929#0" expanded="true" />
@@ -79,6 +80,10 @@
79 80
                 <element signature="e#3116#3117#0" expanded="true" />
80 81
                 <element signature="e#3136#3137#0" expanded="true" />
81 82
                 <element signature="e#3169#3170#0" expanded="true" />
83
+                <element signature="e#2396#2397#0" expanded="true" />
84
+                <element signature="e#2443#2444#0" expanded="true" />
85
+                <element signature="e#2528#2529#0" expanded="true" />
86
+                <element signature="e#2585#2586#0" expanded="true" />
82 87
                 <element signature="e#3541#3542#0" expanded="true" />
83 88
                 <element signature="e#3610#3611#0" expanded="true" />
84 89
                 <element signature="e#3665#3666#0" expanded="true" />
@@ -91,8 +96,8 @@
91 96
       <file pinned="false" current-in-tab="true">
92 97
         <entry file="file://$PROJECT_DIR$/Checkbook/src/test/java/CheckbookTest.java">
93 98
           <provider selected="true" editor-type-id="text-editor">
94
-            <state relative-caret-position="362">
95
-              <caret line="354" column="94" selection-start-line="354" selection-start-column="94" selection-end-line="354" selection-end-column="94" />
99
+            <state relative-caret-position="238">
100
+              <caret line="365" column="48" selection-start-line="365" selection-start-column="48" selection-end-line="365" selection-end-column="48" />
96 101
               <folding>
97 102
                 <element signature="imports" expanded="true" />
98 103
               </folding>
@@ -101,6 +106,15 @@
101 106
         </entry>
102 107
       </file>
103 108
       <file pinned="false" current-in-tab="false">
109
+        <entry file="file://$PROJECT_DIR$/Checkbook/src/main/java/Account.java">
110
+          <provider selected="true" editor-type-id="text-editor">
111
+            <state relative-caret-position="23">
112
+              <caret line="1" column="1" lean-forward="true" selection-start-line="1" selection-start-column="1" selection-end-line="1" selection-end-column="1" />
113
+            </state>
114
+          </provider>
115
+        </entry>
116
+      </file>
117
+      <file pinned="false" current-in-tab="false">
104 118
         <entry file="file://$PROJECT_DIR$/Checkbook/src/main/java/Payee.java">
105 119
           <provider selected="true" editor-type-id="text-editor">
106 120
             <state relative-caret-position="241">
@@ -148,9 +162,9 @@
148 162
         <option value="$PROJECT_DIR$/Checkbook/src/main/java/TransactionType.java" />
149 163
         <option value="$PROJECT_DIR$/Checkbook/src/main/java/AccountBook.java" />
150 164
         <option value="$PROJECT_DIR$/README.md" />
151
-        <option value="$PROJECT_DIR$/Checkbook/src/main/java/Account.java" />
152 165
         <option value="$PROJECT_DIR$/Checkbook/src/main/java/Transaction.java" />
153 166
         <option value="$PROJECT_DIR$/Checkbook/src/main/java/Payee.java" />
167
+        <option value="$PROJECT_DIR$/Checkbook/src/main/java/Account.java" />
154 168
         <option value="$PROJECT_DIR$/Checkbook/src/main/java/Checkbook.java" />
155 169
         <option value="$PROJECT_DIR$/Checkbook/src/test/java/CheckbookTest.java" />
156 170
       </list>
@@ -238,7 +252,7 @@
238 252
   <component name="PropertiesComponent">
239 253
     <property name="WebServerToolWindowFactoryState" value="false" />
240 254
     <property name="aspect.path.notification.shown" value="true" />
241
-    <property name="com.android.tools.idea.instantapp.provision.ProvisionBeforeRunTaskProvider.myTimeStamp" value="1544135882851" />
255
+    <property name="com.android.tools.idea.instantapp.provision.ProvisionBeforeRunTaskProvider.myTimeStamp" value="1544138934248" />
242 256
     <property name="com.intellij.testIntegration.createTest.CreateTestDialog.defaultLibrary" value="JUnit4" />
243 257
     <property name="extract.method.default.visibility" value="private" />
244 258
     <property name="jdk.selected.JAVA_MODULE" value="1.8" />
@@ -269,7 +283,7 @@
269 283
       </list>
270 284
     </option>
271 285
   </component>
272
-  <component name="RunManager" selected="JUnit.CheckbookTest.testGetCreditsafterAdding">
286
+  <component name="RunManager" selected="JUnit.CheckbookTest.testRemoveAllAddNewTransactions">
273 287
     <configuration default="true" type="Applet" factoryName="Applet">
274 288
       <option name="POLICY_FILE" value="$APPLICATION_HOME_DIR$/bin/appletviewer.policy" />
275 289
       <method v="2">
@@ -282,55 +296,55 @@
282 296
         <option name="Make" enabled="true" />
283 297
       </method>
284 298
     </configuration>
285
-    <configuration name="CheckbookTest.testGetCredits" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
299
+    <configuration name="CheckbookTest.testClearAddAndRemove" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
286 300
       <module name="Checkbook" />
287 301
       <option name="PACKAGE_NAME" value="" />
288 302
       <option name="MAIN_CLASS_NAME" value="CheckbookTest" />
289
-      <option name="METHOD_NAME" value="testGetCredits" />
303
+      <option name="METHOD_NAME" value="testClearAddAndRemove" />
290 304
       <option name="TEST_OBJECT" value="method" />
291 305
       <option name="WORKING_DIRECTORY" value="%MODULE_WORKING_DIR%" />
292 306
       <method v="2">
293 307
         <option name="Make" enabled="true" />
294 308
       </method>
295 309
     </configuration>
296
-    <configuration name="CheckbookTest.testGetCreditsNone" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
310
+    <configuration name="CheckbookTest.testClearEmpty" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
297 311
       <module name="Checkbook" />
298 312
       <option name="PACKAGE_NAME" value="" />
299 313
       <option name="MAIN_CLASS_NAME" value="CheckbookTest" />
300
-      <option name="METHOD_NAME" value="testGetCreditsNone" />
314
+      <option name="METHOD_NAME" value="testClearEmpty" />
301 315
       <option name="TEST_OBJECT" value="method" />
302 316
       <option name="WORKING_DIRECTORY" value="%MODULE_WORKING_DIR%" />
303 317
       <method v="2">
304 318
         <option name="Make" enabled="true" />
305 319
       </method>
306 320
     </configuration>
307
-    <configuration name="CheckbookTest.testGetCreditsafterAdding" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
321
+    <configuration name="CheckbookTest.testRemoveAll" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
308 322
       <module name="Checkbook" />
309 323
       <option name="PACKAGE_NAME" value="" />
310 324
       <option name="MAIN_CLASS_NAME" value="CheckbookTest" />
311
-      <option name="METHOD_NAME" value="testGetCreditsafterAdding" />
325
+      <option name="METHOD_NAME" value="testRemoveAll" />
312 326
       <option name="TEST_OBJECT" value="method" />
313 327
       <option name="WORKING_DIRECTORY" value="%MODULE_WORKING_DIR%" />
314 328
       <method v="2">
315 329
         <option name="Make" enabled="true" />
316 330
       </method>
317 331
     </configuration>
318
-    <configuration name="CheckbookTest.testGetDebitsManipulatedCheckbook" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
332
+    <configuration name="CheckbookTest.testRemoveAllAddNewTransactions" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
319 333
       <module name="Checkbook" />
320 334
       <option name="PACKAGE_NAME" value="" />
321 335
       <option name="MAIN_CLASS_NAME" value="CheckbookTest" />
322
-      <option name="METHOD_NAME" value="testGetDebitsManipulatedCheckbook" />
336
+      <option name="METHOD_NAME" value="testRemoveAllAddNewTransactions" />
323 337
       <option name="TEST_OBJECT" value="method" />
324 338
       <option name="WORKING_DIRECTORY" value="%MODULE_WORKING_DIR%" />
325 339
       <method v="2">
326 340
         <option name="Make" enabled="true" />
327 341
       </method>
328 342
     </configuration>
329
-    <configuration name="CheckbookTest.testToArrayFailV2" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
343
+    <configuration name="CheckbookTest.testRemoveAllNone" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
330 344
       <module name="Checkbook" />
331 345
       <option name="PACKAGE_NAME" value="" />
332 346
       <option name="MAIN_CLASS_NAME" value="CheckbookTest" />
333
-      <option name="METHOD_NAME" value="testToArrayFailV2" />
347
+      <option name="METHOD_NAME" value="testRemoveAllNone" />
334 348
       <option name="TEST_OBJECT" value="method" />
335 349
       <option name="WORKING_DIRECTORY" value="%MODULE_WORKING_DIR%" />
336 350
       <method v="2">
@@ -361,19 +375,19 @@
361 375
       </method>
362 376
     </configuration>
363 377
     <list>
364
-      <item itemvalue="JUnit.CheckbookTest.testGetDebitsManipulatedCheckbook" />
365
-      <item itemvalue="JUnit.CheckbookTest.testToArrayFailV2" />
366
-      <item itemvalue="JUnit.CheckbookTest.testGetCredits" />
367
-      <item itemvalue="JUnit.CheckbookTest.testGetCreditsNone" />
368
-      <item itemvalue="JUnit.CheckbookTest.testGetCreditsafterAdding" />
378
+      <item itemvalue="JUnit.CheckbookTest.testClearEmpty" />
379
+      <item itemvalue="JUnit.CheckbookTest.testClearAddAndRemove" />
380
+      <item itemvalue="JUnit.CheckbookTest.testRemoveAll" />
381
+      <item itemvalue="JUnit.CheckbookTest.testRemoveAllNone" />
382
+      <item itemvalue="JUnit.CheckbookTest.testRemoveAllAddNewTransactions" />
369 383
     </list>
370 384
     <recent_temporary>
371 385
       <list>
372
-        <item itemvalue="JUnit.CheckbookTest.testGetCreditsafterAdding" />
373
-        <item itemvalue="JUnit.CheckbookTest.testGetCreditsNone" />
374
-        <item itemvalue="JUnit.CheckbookTest.testGetCredits" />
375
-        <item itemvalue="JUnit.CheckbookTest.testToArrayFailV2" />
376
-        <item itemvalue="JUnit.CheckbookTest.testGetDebitsManipulatedCheckbook" />
386
+        <item itemvalue="JUnit.CheckbookTest.testRemoveAllAddNewTransactions" />
387
+        <item itemvalue="JUnit.CheckbookTest.testRemoveAllNone" />
388
+        <item itemvalue="JUnit.CheckbookTest.testRemoveAll" />
389
+        <item itemvalue="JUnit.CheckbookTest.testClearAddAndRemove" />
390
+        <item itemvalue="JUnit.CheckbookTest.testClearEmpty" />
377 391
       </list>
378 392
     </recent_temporary>
379 393
   </component>
@@ -388,44 +402,44 @@
388 402
       <option name="presentableId" value="Default" />
389 403
       <updated>1543958631974</updated>
390 404
       <workItem from="1543958633447" duration="3259000" />
391
-      <workItem from="1544046850600" duration="24772000" />
405
+      <workItem from="1544046850600" duration="27867000" />
392 406
     </task>
393 407
     <servers />
394 408
   </component>
395 409
   <component name="TestHistory">
396
-    <history-entry file="CheckbookTest_getTransactionsForPayeeExistsAfterAdd - 2018.12.06 at 14h 24m 20s.xml">
397
-      <configuration name="CheckbookTest.getTransactionsForPayeeExistsAfterAdd" configurationId="JUnit" />
410
+    <history-entry file="CheckbookTest_testContainsNone - 2018.12.06 at 17h 51m 55s.xml">
411
+      <configuration name="CheckbookTest.testContainsNone" configurationId="JUnit" />
398 412
     </history-entry>
399
-    <history-entry file="CheckbookTest_getTransactionsForPayeeExistsAfterAdd - 2018.12.06 at 14h 24m 50s.xml">
400
-      <configuration name="CheckbookTest.getTransactionsForPayeeExistsAfterAdd" configurationId="JUnit" />
413
+    <history-entry file="CheckbookTest_testContainsAllAddThenCheck - 2018.12.06 at 17h 53m 50s.xml">
414
+      <configuration name="CheckbookTest.testContainsAllAddThenCheck" configurationId="JUnit" />
401 415
     </history-entry>
402
-    <history-entry file="CheckbookTest_getTransactionAddingNewTForDateA - 2018.12.06 at 14h 27m 07s.xml">
403
-      <configuration name="CheckbookTest.getTransactionAddingNewTForDateA" configurationId="JUnit" />
416
+    <history-entry file="CheckbookTest_testAddAll - 2018.12.06 at 17h 58m 31s.xml">
417
+      <configuration name="CheckbookTest.testAddAll" configurationId="JUnit" />
404 418
     </history-entry>
405
-    <history-entry file="CheckbookTest_getTransactionsForPayeeExists - 2018.12.06 at 14h 31m 23s.xml">
406
-      <configuration name="CheckbookTest.getTransactionsForPayeeExists" configurationId="JUnit" />
419
+    <history-entry file="CheckbookTest_testAddAllNone - 2018.12.06 at 17h 59m 27s.xml">
420
+      <configuration name="CheckbookTest.testAddAllNone" configurationId="JUnit" />
407 421
     </history-entry>
408
-    <history-entry file="CheckbookTest_testGetDebits - 2018.12.06 at 17h 31m 07s.xml">
409
-      <configuration name="CheckbookTest.testGetDebits" configurationId="JUnit" />
422
+    <history-entry file="CheckbookTest_testAddAllOtherCollection - 2018.12.06 at 18h 03m 32s.xml">
423
+      <configuration name="CheckbookTest.testAddAllOtherCollection" configurationId="JUnit" />
410 424
     </history-entry>
411
-    <history-entry file="CheckbookTest_testGetDebits - 2018.12.06 at 17h 31m 20s.xml">
412
-      <configuration name="CheckbookTest.testGetDebits" configurationId="JUnit" />
425
+    <history-entry file="CheckbookTest_testClear - 2018.12.06 at 18h 09m 32s.xml">
426
+      <configuration name="CheckbookTest.testClear" configurationId="JUnit" />
413 427
     </history-entry>
414
-    <history-entry file="CheckbookTest_testGetDebits - 2018.12.06 at 17h 32m 48s.xml">
415
-      <configuration name="CheckbookTest.testGetDebits" configurationId="JUnit" />
428
+    <history-entry file="CheckbookTest_testClearEmpty - 2018.12.06 at 18h 10m 23s.xml">
429
+      <configuration name="CheckbookTest.testClearEmpty" configurationId="JUnit" />
416 430
     </history-entry>
417
-    <history-entry file="CheckbookTest_testGetDebitsNone - 2018.12.06 at 17h 34m 21s.xml">
418
-      <configuration name="CheckbookTest.testGetDebitsNone" configurationId="JUnit" />
431
+    <history-entry file="CheckbookTest_testClearAddAndRemove - 2018.12.06 at 18h 12m 07s.xml">
432
+      <configuration name="CheckbookTest.testClearAddAndRemove" configurationId="JUnit" />
419 433
     </history-entry>
420
-    <history-entry file="CheckbookTest_testGetDebitsManipulatedCheckbook - 2018.12.06 at 17h 35m 23s.xml">
421
-      <configuration name="CheckbookTest.testGetDebitsManipulatedCheckbook" configurationId="JUnit" />
434
+    <history-entry file="CheckbookTest_testRemoveAll - 2018.12.06 at 18h 14m 56s.xml">
435
+      <configuration name="CheckbookTest.testRemoveAll" configurationId="JUnit" />
422 436
     </history-entry>
423
-    <history-entry file="CheckbookTest_testToArrayFailV2 - 2018.12.06 at 17h 36m 26s.xml">
424
-      <configuration name="CheckbookTest.testToArrayFailV2" configurationId="JUnit" />
437
+    <history-entry file="CheckbookTest_testRemoveAllNone - 2018.12.06 at 18h 25m 04s.xml">
438
+      <configuration name="CheckbookTest.testRemoveAllNone" configurationId="JUnit" />
425 439
     </history-entry>
426 440
   </component>
427 441
   <component name="TimeTrackingManager">
428
-    <option name="totallyTimeSpent" value="28031000" />
442
+    <option name="totallyTimeSpent" value="31126000" />
429 443
   </component>
430 444
   <component name="ToolWindowManager">
431 445
     <frame x="0" y="23" width="1440" height="877" extended-state="0" />
@@ -553,13 +567,6 @@
553 567
         </state>
554 568
       </provider>
555 569
     </entry>
556
-    <entry file="file://$PROJECT_DIR$/Checkbook/src/main/java/Account.java">
557
-      <provider selected="true" editor-type-id="text-editor">
558
-        <state relative-caret-position="46">
559
-          <caret line="2" lean-forward="true" selection-start-line="2" selection-end-line="2" />
560
-        </state>
561
-      </provider>
562
-    </entry>
563 570
     <entry file="file://$PROJECT_DIR$/Checkbook/src/main/java/AccountBook.java">
564 571
       <provider selected="true" editor-type-id="text-editor">
565 572
         <state relative-caret-position="46">
@@ -601,7 +608,7 @@
601 608
     </entry>
602 609
     <entry file="file://$PROJECT_DIR$/Checkbook/src/main/java/Transaction.java">
603 610
       <provider selected="true" editor-type-id="text-editor">
604
-        <state relative-caret-position="-279">
611
+        <state relative-caret-position="-438">
605 612
           <caret line="12" column="26" lean-forward="true" selection-start-line="12" selection-start-column="26" selection-end-line="12" selection-end-column="26" />
606 613
           <folding>
607 614
             <element signature="imports" expanded="true" />
@@ -612,22 +619,28 @@
612 619
     <entry file="file://$PROJECT_DIR$/README.md">
613 620
       <provider selected="true" editor-type-id="split-provider[text-editor;markdown-preview-editor]">
614 621
         <state split_layout="FIRST">
615
-          <first_editor relative-caret-position="283">
616
-            <caret line="48" lean-forward="true" selection-start-line="48" selection-end-line="48" />
622
+          <first_editor relative-caret-position="214">
623
+            <caret line="45" column="14" lean-forward="true" selection-start-line="45" selection-start-column="14" selection-end-line="45" selection-end-column="14" />
617 624
           </first_editor>
618 625
           <second_editor />
619 626
         </state>
620 627
       </provider>
621 628
     </entry>
629
+    <entry file="file://$PROJECT_DIR$/Checkbook/src/main/java/Account.java">
630
+      <provider selected="true" editor-type-id="text-editor">
631
+        <state relative-caret-position="23">
632
+          <caret line="1" column="1" lean-forward="true" selection-start-line="1" selection-start-column="1" selection-end-line="1" selection-end-column="1" />
633
+        </state>
634
+      </provider>
635
+    </entry>
622 636
     <entry file="file://$PROJECT_DIR$/Checkbook/src/main/java/Checkbook.java">
623 637
       <provider selected="true" editor-type-id="text-editor">
624
-        <state relative-caret-position="-1294">
625
-          <caret line="45" lean-forward="true" selection-start-line="45" selection-end-line="45" />
638
+        <state relative-caret-position="169">
639
+          <caret line="47" column="45" lean-forward="true" selection-start-line="47" selection-start-column="45" selection-end-line="47" selection-end-column="45" />
626 640
           <folding>
627 641
             <element signature="imports" expanded="true" />
628 642
             <element signature="e#1262#1263#0" expanded="true" />
629 643
             <element signature="e#1316#1317#0" expanded="true" />
630
-            <element signature="e#1584#1585#0" expanded="true" />
631 644
             <element signature="e#1641#1642#0" expanded="true" />
632 645
             <element signature="e#2881#2882#0" expanded="true" />
633 646
             <element signature="e#2928#2929#0" expanded="true" />
@@ -637,6 +650,10 @@
637 650
             <element signature="e#3116#3117#0" expanded="true" />
638 651
             <element signature="e#3136#3137#0" expanded="true" />
639 652
             <element signature="e#3169#3170#0" expanded="true" />
653
+            <element signature="e#2396#2397#0" expanded="true" />
654
+            <element signature="e#2443#2444#0" expanded="true" />
655
+            <element signature="e#2528#2529#0" expanded="true" />
656
+            <element signature="e#2585#2586#0" expanded="true" />
640 657
             <element signature="e#3541#3542#0" expanded="true" />
641 658
             <element signature="e#3610#3611#0" expanded="true" />
642 659
             <element signature="e#3665#3666#0" expanded="true" />
@@ -647,8 +664,8 @@
647 664
     </entry>
648 665
     <entry file="file://$PROJECT_DIR$/Checkbook/src/test/java/CheckbookTest.java">
649 666
       <provider selected="true" editor-type-id="text-editor">
650
-        <state relative-caret-position="362">
651
-          <caret line="354" column="94" selection-start-line="354" selection-start-column="94" selection-end-line="354" selection-end-column="94" />
667
+        <state relative-caret-position="238">
668
+          <caret line="365" column="48" selection-start-line="365" selection-start-column="48" selection-end-line="365" selection-end-column="48" />
652 669
           <folding>
653 670
             <element signature="imports" expanded="true" />
654 671
           </folding>

+ 1
- 1
Checkbook/src/main/java/Account.java Wyświetl plik

@@ -1,2 +1,2 @@
1
-public class Account<T extends AccountBook> {
1
+public class Account {
2 2
 }

+ 45
- 36
Checkbook/src/main/java/Checkbook.java Wyświetl plik

@@ -2,6 +2,7 @@
2 2
 import java.lang.reflect.Field;
3 3
 import java.time.LocalDate;
4 4
 import java.util.*;
5
+import java.util.regex.Pattern;
5 6
 
6 7
 public class Checkbook {
7 8
     // Checkbook is a list of Transactions
@@ -28,43 +29,43 @@ public class Checkbook {
28 29
 
29 30
     //blind us with your Java eloquence....
30 31
 
31
-    public int size() {
32
+    int size() {
32 33
         return this.checkbook.size();
33 34
     }
34 35
 
35
-    public boolean isEmpty() {
36
+    boolean isEmpty() {
36 37
         return this.checkbook.isEmpty();
37 38
     }
38 39
 
39
-    public boolean contains(Transaction transaction) {
40
+    boolean contains(Transaction transaction) {
40 41
         return this.checkbook.contains(transaction);
41 42
     }
42 43
 
43
-    public boolean add(Transaction transaction) {
44
+    boolean add(Transaction transaction) {
44 45
         return this.checkbook.add(transaction);
45 46
     }
46 47
 
47
-    public boolean remove(Transaction transaction) {
48
+    boolean remove(Transaction transaction) {
48 49
         return this.checkbook.remove(transaction);
49 50
     }
50 51
 
51
-    public Iterator<Transaction> iterator() {
52
+    Iterator<Transaction> iterator() {
52 53
         return this.checkbook.iterator();
53 54
     }
54 55
 
55
-    public Transaction[] toArray() {
56
+    Transaction[] toArray() {
56 57
         return checkbook.toArray(new Transaction[checkbook.size()]);
57 58
     }
58 59
 
59
-    public Transaction[] toArray(Transaction[] a) {
60
+    Transaction[] toArray(Transaction[] a) {
60 61
         return this.checkbook.toArray(a);
61 62
     }
62 63
 
63
-    public Transaction[] toArrayFromList(List<Transaction> list) {
64
+    Transaction[] toArrayFromList(List<Transaction> list) {
64 65
         return list.toArray(new Transaction[list.size()]);
65 66
     }
66 67
 
67
-    public double checkbookValue() {
68
+    double checkbookValue() {
68 69
         double sum = 0.0;
69 70
         for (Transaction t: this.checkbook) {
70 71
             sum += t.getAmount();
@@ -72,11 +73,43 @@ public class Checkbook {
72 73
         return sum;
73 74
     }
74 75
 
75
-    public List<Transaction> getCheckbook() {
76
+    List<Transaction> getCheckbook() {
76 77
         return checkbook;
77 78
     }
78 79
 
79
-    public Transaction[] getSpecificTransactions(String fieldName, Object value) {
80
+    boolean containsAll(Collection<Transaction> c) {
81
+        return checkbook.containsAll(c);
82
+    }
83
+
84
+    boolean addAll(Collection<Transaction> c) {
85
+        return checkbook.addAll(c);
86
+    }
87
+
88
+    boolean removeAll(Collection<Transaction> c) {
89
+        return checkbook.removeAll(c);
90
+    }
91
+
92
+    void clear() {
93
+        checkbook.clear();
94
+    }
95
+
96
+     Transaction[] getAllTransactionsForDate(LocalDate a) {
97
+        return getSpecificTransactions("date", a);
98
+    }
99
+
100
+    Transaction[] getAllTransactionsForPayee(Payee a) {
101
+        return getSpecificTransactions("payee", a);
102
+    }
103
+
104
+    Transaction[] getAllDebitTransactions() {
105
+        return getSpecificTransactions("typee", TransactionType.DEBIT);
106
+    }
107
+
108
+    Transaction[] getAllCreditTransactions() {
109
+        return getSpecificTransactions("typee", TransactionType.CREDIT);
110
+    }
111
+
112
+    private Transaction[] getSpecificTransactions(String fieldName, Object value) {
80 113
 
81 114
         List<Transaction> arr = new ArrayList<>();
82 115
         for (Transaction ts : this.checkbook) {
@@ -99,28 +132,4 @@ public class Checkbook {
99 132
         }
100 133
         return null;
101 134
     }
102
-
103
-    public boolean containsAll(Collection<Transaction> c) {
104
-        return checkbook.containsAll(c);
105
-    }
106
-
107
-    boolean addAll(Collection<Transaction> c) {
108
-        return checkbook.addAll(c);
109
-    }
110
-
111
-    boolean removeAll(Collection<Transaction> c) {
112
-        return checkbook.removeAll(c);
113
-    }
114
-
115
-    void clear() {
116
-        checkbook.clear();
117
-    }
118
-
119
-    public Transaction[] getAllDebitTransactions() {
120
-        return getSpecificTransactions("typee", TransactionType.DEBIT);
121
-    }
122
-
123
-    public Transaction[] getAllCreditTransactions() {
124
-        return getSpecificTransactions("typee", TransactionType.CREDIT);
125
-    }
126 135
 }

+ 102
- 19
Checkbook/src/test/java/CheckbookTest.java Wyświetl plik

@@ -1,16 +1,16 @@
1
-import org.junit.Assert;
2 1
 import org.junit.Test;
3 2
 
4 3
 import java.time.LocalDate;
5
-import java.util.Arrays;
6
-import java.util.NoSuchElementException;
4
+import java.util.*;
7 5
 
8 6
 import static org.junit.Assert.*;
9 7
 
10 8
 public class CheckbookTest {
11 9
     private Checkbook checkbook, checkbookWithDefault, checkbookWithOwner;
12 10
     private Payee p1, p2, p3;
13
-    private Transaction t1, t2, t3;
11
+    private Transaction t1, t2, t3, t4;
12
+    private ArrayList<Transaction> outsideTransactions;
13
+
14 14
     private final double cashAmount = 500.00;
15 15
     private final double t2Amount = 100.00;
16 16
     private final double t3Amount = 50.00;
@@ -25,6 +25,9 @@ public class CheckbookTest {
25 25
         t1 = new Transaction("ZC Fund", p1, TransactionType.CREDIT, cashAmount);
26 26
         t2 = new Transaction("Allowance", p3, TransactionType.DEBIT, t2Amount);
27 27
         t3 = new Transaction("Food", p2, TransactionType.CREDIT, t3Amount);
28
+        t4 = new Transaction("meow", new Payee(), TransactionType.DEBIT, 10.00);
29
+        outsideTransactions = new ArrayList<>();
30
+
28 31
 
29 32
         checkbook = new Checkbook(t1, t2, t3);
30 33
         checkbookWithDefault = new Checkbook(t2Amount);
@@ -235,12 +238,21 @@ public class CheckbookTest {
235 238
 
236 239
         checkbookWithDefault.add(t);
237 240
 
238
-        for (Transaction ta: checkbookWithDefault.getSpecificTransactions("date", a)) {
241
+        for (Transaction ta: checkbookWithDefault.getAllTransactionsForDate(a)) {
239 242
             assertEquals(a, ta.getDate());
240 243
         }
241 244
     }
242 245
 
243 246
     @Test
247
+    public void getTransactionsForWrongDate() {
248
+        LocalDate a = LocalDate.of(2220, 10, 20);
249
+
250
+        for (Transaction t:checkbook.getAllTransactionsForDate(a)) {
251
+            assertNull(t);
252
+        }
253
+    }
254
+
255
+    @Test
244 256
     public void getTransactionsForPayeeExists() {
245 257
         Payee payee = new Payee();
246 258
         Transaction t = new Transaction("test", payee, TransactionType.DEBIT, 10.00);
@@ -250,69 +262,140 @@ public class CheckbookTest {
250 262
         checkbookWithDefault.add(t);
251 263
         checkbookWithOwner.add(t);
252 264
 
253
-        assertEquals(expArr, checkbook.getSpecificTransactions("payee", payee));
254
-        assertEquals(expArr, checkbookWithDefault.getSpecificTransactions("payee", payee));
255
-        assertEquals(expArr, checkbookWithOwner.getSpecificTransactions("payee", payee));
265
+        assertEquals(expArr, checkbook.getAllTransactionsForPayee(payee));
266
+        assertEquals(expArr, checkbookWithDefault.getAllTransactionsForPayee(payee));
267
+        assertEquals(expArr, checkbookWithOwner.getAllTransactionsForPayee(payee));
268
+    }
269
+
270
+    @Test
271
+    public void getTransactionsForPayeeNotExists() {
272
+        Payee p = new Payee();
273
+        Transaction[] arr = {};
274
+        assertEquals(arr, checkbook.getAllTransactionsForPayee(p));
256 275
     }
257 276
 
258 277
     @Test
259 278
     public void testContainsAll() {
279
+        ArrayList<Transaction> arr = new ArrayList<>();
280
+        arr.add(t1);
281
+        arr.add(t2);
260 282
 
283
+        assertTrue(checkbook.containsAll(arr));
261 284
     }
262 285
 
263 286
     @Test
264 287
     public void testContainsNone() {
288
+        outsideTransactions. add(t4);
265 289
 
290
+        assertFalse(checkbook.containsAll(outsideTransactions));
291
+        assertFalse(checkbookWithOwner.containsAll(outsideTransactions));
292
+        assertFalse(checkbookWithDefault.containsAll(outsideTransactions));
266 293
     }
267 294
 
268 295
     @Test
269 296
     public void testContainsAllAddThenCheck() {
270 297
 
298
+        outsideTransactions.add(t4);
299
+        checkbook.add(t4);
300
+        checkbookWithOwner.add(t4);
301
+        checkbookWithDefault.add(t4);
302
+
303
+        assertTrue(checkbook.containsAll(outsideTransactions));
304
+        assertTrue(checkbookWithOwner.containsAll(outsideTransactions));
305
+        assertTrue(checkbookWithDefault.containsAll(outsideTransactions));
271 306
     }
272 307
 
273 308
     @Test
274 309
     public void testAddAll() {
310
+        int expectedSize = 5;
311
+        outsideTransactions.add(t4);
312
+        outsideTransactions.add(t1);
313
+
314
+        checkbook.addAll(outsideTransactions);
275 315
 
316
+        assertEquals(expectedSize, checkbook.size());
276 317
     }
277 318
 
278 319
     @Test
279 320
     public void testAddAllNone() {
321
+        int expSize = 3;
280 322
 
323
+        outsideTransactions.clear();
324
+        checkbook.addAll(outsideTransactions);
325
+
326
+        assertEquals(expSize, checkbook.size());
281 327
     }
282 328
 
283 329
     @Test
284
-    public void testAddAllException() {
330
+    public void testAddAllOtherCollection() {
331
+        int expSize = 5;
332
+        Set<Transaction> set = new HashSet<>();
333
+        set.add(t1);
334
+        set.add(t4);
285 335
 
336
+        checkbook.addAll(set);
337
+        assertEquals(expSize, checkbook.size());
286 338
     }
287 339
 
288 340
     @Test
289 341
     public void testRemoveAll() {
342
+        List<Transaction> arrToRemove = new ArrayList<>();
343
+        arrToRemove.add(t1);
344
+        arrToRemove.add(t2);
345
+        arrToRemove.add(t3);
346
+
347
+        int expSize = 0;
290 348
 
349
+        checkbook.removeAll(arrToRemove);
350
+        assertEquals(expSize, checkbook.size());
291 351
     }
292 352
 
293 353
     @Test
294 354
     public void testRemoveAllNone() {
295
-
355
+        int size = 0;
356
+        Checkbook cb = new Checkbook();
357
+        cb.removeAll(new HashSet<>());
358
+        assertEquals(size, cb.size());
296 359
     }
297 360
 
298 361
     @Test
299 362
     public void testRemoveAllAddNewTransactions() {
300
-
363
+        int expSize = 2;
364
+        outsideTransactions.add(t1);
365
+        checkbook.removeAll(outsideTransactions);
366
+        assertEquals(expSize, checkbook.size());
301 367
     }
302 368
 
303 369
     @Test
304 370
     public void testClear() {
371
+        int expSize = 0;
372
+
373
+        checkbook.clear();
374
+        checkbookWithDefault.clear();
375
+        checkbookWithOwner.clear();
305 376
 
377
+        assertEquals(expSize, checkbook.size());
378
+        assertEquals(expSize, checkbookWithDefault.size());
379
+        assertEquals(expSize, checkbookWithOwner.size());
306 380
     }
307 381
 
308 382
     @Test
309 383
     public void testClearEmpty() {
384
+        int expSize = 0;
385
+        Transaction t = checkbookWithDefault.getCheckbook().get(0);
386
+        checkbookWithDefault.remove(t);
310 387
 
388
+        checkbookWithDefault.clear();
389
+        assertEquals(expSize, checkbookWithDefault.size());
311 390
     }
312 391
 
313 392
     @Test
314 393
     public void testClearAddAndRemove() {
394
+        int expSize = 0;
395
+        checkbookWithOwner.add(t4);
396
+        checkbookWithOwner.clear();
315 397
 
398
+        assertEquals(expSize, checkbookWithOwner.size());
316 399
     }
317 400
 
318 401
     @Test
@@ -322,11 +405,11 @@ public class CheckbookTest {
322 405
 
323 406
         Transaction[] expArr =  {d1, d2};
324 407
         checkbookWithDefault.add(d2);
325
-        assertEquals(expArr, checkbookWithDefault.getSpecificTransactions("typee", TransactionType.DEBIT));
408
+        assertEquals(expArr, checkbookWithDefault.getAllDebitTransactions());
326 409
 
327 410
         Transaction[] expArr2 = {d2, d2};
328 411
         checkbookWithOwner.add(d2);
329
-        assertEquals(expArr2, checkbookWithOwner.getSpecificTransactions("typee", TransactionType.DEBIT));
412
+        assertEquals(expArr2, checkbookWithOwner.getAllDebitTransactions());
330 413
     }
331 414
 
332 415
     @Test
@@ -335,7 +418,7 @@ public class CheckbookTest {
335 418
 
336 419
         checkbook.remove(t2);
337 420
 
338
-        assertEquals(arr, checkbook.getSpecificTransactions("typee", TransactionType.DEBIT));
421
+        assertEquals(arr, checkbook.getAllDebitTransactions());
339 422
     }
340 423
 
341 424
     @Test
@@ -345,20 +428,20 @@ public class CheckbookTest {
345 428
         checkbook.remove(t2);
346 429
         checkbook.add(t);
347 430
 
348
-        assertEquals(arr, checkbook.getSpecificTransactions("typee", TransactionType.DEBIT));
431
+        assertEquals(arr, checkbook.getAllDebitTransactions());
349 432
     }
350 433
 
351 434
     @Test
352 435
     public void testGetCredits() {
353 436
         Transaction[] expArr = {t1, t3};
354
-        assertEquals(expArr, checkbook.getSpecificTransactions("typee", TransactionType.CREDIT));
437
+        assertEquals(expArr, checkbook.getAllCreditTransactions());
355 438
     }
356 439
 
357 440
     @Test
358 441
     public void testGetCreditsNone() {
359 442
         Transaction[] expArr = {};
360
-        assertEquals(expArr, checkbookWithDefault.getSpecificTransactions("typee", TransactionType.CREDIT));
361
-        assertEquals(expArr, checkbookWithOwner.getSpecificTransactions("typee", TransactionType.CREDIT));
443
+        assertEquals(expArr, checkbookWithDefault.getAllCreditTransactions());
444
+        assertEquals(expArr, checkbookWithOwner.getAllCreditTransactions());
362 445
     }
363 446
 
364 447
     @Test
@@ -367,6 +450,6 @@ public class CheckbookTest {
367 450
         Transaction[] arr = {t};
368 451
 
369 452
         checkbookWithOwner.add(t);
370
-        assertEquals(arr, checkbookWithOwner.getSpecificTransactions("typee", TransactionType.CREDIT));
453
+        assertEquals(arr, checkbookWithOwner.getAllCreditTransactions());
371 454
     }
372 455
 }