Bladeren bron

made my life easier with 1 method

Trinh Tong 6 jaren geleden
bovenliggende
commit
ee93666adc

+ 133
- 92
.idea/workspace.xml Bestand weergeven

@@ -2,14 +2,10 @@
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 afterPath="$PROJECT_DIR$/Checkbook/src/main/java/Account.java" afterDir="false" />
6
-      <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
7
-      <change beforePath="$PROJECT_DIR$/Checkbook/src/main/java/AccountBook.java" beforeDir="false" afterPath="$PROJECT_DIR$/Checkbook/src/main/java/AccountBook.java" afterDir="false" />
8 5
       <change beforePath="$PROJECT_DIR$/Checkbook/src/main/java/Checkbook.java" beforeDir="false" afterPath="$PROJECT_DIR$/Checkbook/src/main/java/Checkbook.java" afterDir="false" />
9 6
       <change beforePath="$PROJECT_DIR$/Checkbook/src/main/java/Payee.java" beforeDir="false" afterPath="$PROJECT_DIR$/Checkbook/src/main/java/Payee.java" afterDir="false" />
10 7
       <change beforePath="$PROJECT_DIR$/Checkbook/src/main/java/Transaction.java" beforeDir="false" afterPath="$PROJECT_DIR$/Checkbook/src/main/java/Transaction.java" afterDir="false" />
11 8
       <change beforePath="$PROJECT_DIR$/Checkbook/src/test/java/CheckbookTest.java" beforeDir="false" afterPath="$PROJECT_DIR$/Checkbook/src/test/java/CheckbookTest.java" afterDir="false" />
12
-      <change beforePath="$PROJECT_DIR$/README.md" beforeDir="false" afterPath="$PROJECT_DIR$/README.md" afterDir="false" />
13 9
     </list>
14 10
     <ignored path="$PROJECT_DIR$/Checkbook/target/" />
15 11
     <option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
@@ -28,14 +24,14 @@
28 24
       </usages-collector>
29 25
       <usages-collector id="statistics.file.types.open">
30 26
         <counts>
31
-          <entry key="CLASS" value="5" />
32
-          <entry key="JAVA" value="39" />
27
+          <entry key="CLASS" value="6" />
28
+          <entry key="JAVA" value="43" />
33 29
           <entry key="Markdown" value="1" />
34 30
         </counts>
35 31
       </usages-collector>
36 32
       <usages-collector id="statistics.file.types.edit">
37 33
         <counts>
38
-          <entry key="JAVA" value="7473" />
34
+          <entry key="JAVA" value="8937" />
39 35
           <entry key="Markdown" value="11" />
40 36
         </counts>
41 37
       </usages-collector>
@@ -47,7 +43,7 @@
47 43
         <entry file="file://$PROJECT_DIR$/README.md">
48 44
           <provider selected="true" editor-type-id="split-provider[text-editor;markdown-preview-editor]">
49 45
             <state split_layout="FIRST">
50
-              <first_editor relative-caret-position="1104">
46
+              <first_editor relative-caret-position="765">
51 47
                 <caret line="48" lean-forward="true" selection-start-line="48" selection-end-line="48" />
52 48
               </first_editor>
53 49
               <second_editor />
@@ -56,10 +52,13 @@
56 52
         </entry>
57 53
       </file>
58 54
       <file pinned="false" current-in-tab="false">
59
-        <entry file="file://$PROJECT_DIR$/Checkbook/src/test/java/CheckbookTest.java">
55
+        <entry file="file://$PROJECT_DIR$/Checkbook/src/main/java/Transaction.java">
60 56
           <provider selected="true" editor-type-id="text-editor">
61
-            <state relative-caret-position="46">
62
-              <caret line="2" column="27" selection-start-line="2" selection-start-column="27" selection-end-line="2" selection-end-column="27" />
57
+            <state relative-caret-position="185">
58
+              <caret line="12" column="26" lean-forward="true" selection-start-line="12" selection-start-column="26" selection-end-line="12" selection-end-column="26" />
59
+              <folding>
60
+                <element signature="imports" expanded="true" />
61
+              </folding>
63 62
             </state>
64 63
           </provider>
65 64
         </entry>
@@ -67,28 +66,52 @@
67 66
       <file pinned="false" current-in-tab="false">
68 67
         <entry file="file://$PROJECT_DIR$/Checkbook/src/main/java/Checkbook.java">
69 68
           <provider selected="true" editor-type-id="text-editor">
70
-            <state relative-caret-position="1012">
71
-              <caret line="54" column="5" lean-forward="true" selection-start-line="54" selection-start-column="5" selection-end-line="54" selection-end-column="5" />
69
+            <state relative-caret-position="279">
70
+              <caret line="83" column="16" selection-start-line="83" selection-start-column="16" selection-end-line="83" selection-end-column="16" />
72 71
               <folding>
73 72
                 <element signature="imports" expanded="true" />
73
+                <element signature="e#1262#1263#0" expanded="true" />
74
+                <element signature="e#1316#1317#0" expanded="true" />
75
+                <element signature="e#1584#1585#0" expanded="true" />
76
+                <element signature="e#1641#1642#0" expanded="true" />
77
+                <element signature="e#2881#2882#0" expanded="true" />
78
+                <element signature="e#2928#2929#0" expanded="true" />
79
+                <element signature="e#2977#2978#0" expanded="true" />
80
+                <element signature="e#3019#3020#0" expanded="true" />
81
+                <element signature="e#3071#3072#0" expanded="true" />
82
+                <element signature="e#3116#3117#0" expanded="true" />
83
+                <element signature="e#3136#3137#0" expanded="true" />
84
+                <element signature="e#3169#3170#0" expanded="true" />
85
+                <element signature="e#3541#3542#0" expanded="true" />
86
+                <element signature="e#3610#3611#0" expanded="true" />
87
+                <element signature="e#3665#3666#0" expanded="true" />
88
+                <element signature="e#3735#3736#0" expanded="true" />
74 89
               </folding>
75 90
             </state>
76 91
           </provider>
77 92
         </entry>
78 93
       </file>
79 94
       <file pinned="false" current-in-tab="true">
80
-        <entry file="file://$PROJECT_DIR$/Checkbook/src/main/java/Transaction.java">
95
+        <entry file="file://$PROJECT_DIR$/Checkbook/src/test/java/CheckbookTest.java">
81 96
           <provider selected="true" editor-type-id="text-editor">
82
-            <state relative-caret-position="138">
83
-              <caret line="6" column="53" lean-forward="true" selection-start-line="6" selection-start-column="53" selection-end-line="6" selection-end-column="53" />
97
+            <state relative-caret-position="-209">
98
+              <caret line="228" column="5" selection-start-line="228" selection-start-column="5" selection-end-line="228" selection-end-column="5" />
84 99
               <folding>
85 100
                 <element signature="imports" expanded="true" />
86
-                <element signature="e#380#389#0" expanded="true" />
87 101
               </folding>
88 102
             </state>
89 103
           </provider>
90 104
         </entry>
91 105
       </file>
106
+      <file pinned="false" current-in-tab="false">
107
+        <entry file="file://$PROJECT_DIR$/Checkbook/src/main/java/Payee.java">
108
+          <provider selected="true" editor-type-id="text-editor">
109
+            <state relative-caret-position="241">
110
+              <caret line="40" lean-forward="true" selection-start-line="40" selection-end-line="40" />
111
+            </state>
112
+          </provider>
113
+        </entry>
114
+      </file>
92 115
     </leaf>
93 116
   </component>
94 117
   <component name="FileTemplateManagerImpl">
@@ -127,12 +150,12 @@
127 150
         <option value="$PROJECT_DIR$/Checkbook/src/main/java/GenericAccount.java" />
128 151
         <option value="$PROJECT_DIR$/Checkbook/src/main/java/TransactionType.java" />
129 152
         <option value="$PROJECT_DIR$/Checkbook/src/main/java/AccountBook.java" />
130
-        <option value="$PROJECT_DIR$/Checkbook/src/main/java/Payee.java" />
131 153
         <option value="$PROJECT_DIR$/README.md" />
132 154
         <option value="$PROJECT_DIR$/Checkbook/src/main/java/Account.java" />
133 155
         <option value="$PROJECT_DIR$/Checkbook/src/main/java/Transaction.java" />
134
-        <option value="$PROJECT_DIR$/Checkbook/src/main/java/Checkbook.java" />
156
+        <option value="$PROJECT_DIR$/Checkbook/src/main/java/Payee.java" />
135 157
         <option value="$PROJECT_DIR$/Checkbook/src/test/java/CheckbookTest.java" />
158
+        <option value="$PROJECT_DIR$/Checkbook/src/main/java/Checkbook.java" />
136 159
       </list>
137 160
     </option>
138 161
   </component>
@@ -218,8 +241,9 @@
218 241
   <component name="PropertiesComponent">
219 242
     <property name="WebServerToolWindowFactoryState" value="false" />
220 243
     <property name="aspect.path.notification.shown" value="true" />
221
-    <property name="com.android.tools.idea.instantapp.provision.ProvisionBeforeRunTaskProvider.myTimeStamp" value="1544104481965" />
244
+    <property name="com.android.tools.idea.instantapp.provision.ProvisionBeforeRunTaskProvider.myTimeStamp" value="1544124424998" />
222 245
     <property name="com.intellij.testIntegration.createTest.CreateTestDialog.defaultLibrary" value="JUnit4" />
246
+    <property name="extract.method.default.visibility" value="private" />
223 247
     <property name="jdk.selected.JAVA_MODULE" value="1.8" />
224 248
     <property name="last_opened_file_path" value="$PROJECT_DIR$" />
225 249
     <property name="nodejs_interpreter_path.stuck_in_default_project" value="undefined stuck path" />
@@ -272,44 +296,44 @@
272 296
         <option name="Make" enabled="true" />
273 297
       </method>
274 298
     </configuration>
275
-    <configuration name="CheckbookTest.getTransactionsForDate" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
299
+    <configuration name="CheckbookTest.getTransactionsForPayeeExists" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
276 300
       <module name="Checkbook" />
277 301
       <option name="PACKAGE_NAME" value="" />
278 302
       <option name="MAIN_CLASS_NAME" value="CheckbookTest" />
279
-      <option name="METHOD_NAME" value="getTransactionsForDate" />
303
+      <option name="METHOD_NAME" value="getTransactionsForPayeeExists" />
280 304
       <option name="TEST_OBJECT" value="method" />
281 305
       <option name="WORKING_DIRECTORY" value="%MODULE_WORKING_DIR%" />
282 306
       <method v="2">
283 307
         <option name="Make" enabled="true" />
284 308
       </method>
285 309
     </configuration>
286
-    <configuration name="CheckbookTest.getTransactionsForDateNull" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
310
+    <configuration name="CheckbookTest.getTransactionsForPayeeExists2" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
287 311
       <module name="Checkbook" />
288 312
       <option name="PACKAGE_NAME" value="" />
289 313
       <option name="MAIN_CLASS_NAME" value="CheckbookTest" />
290
-      <option name="METHOD_NAME" value="getTransactionsForDateNull" />
314
+      <option name="METHOD_NAME" value="getTransactionsForPayeeExists2" />
291 315
       <option name="TEST_OBJECT" value="method" />
292 316
       <option name="WORKING_DIRECTORY" value="%MODULE_WORKING_DIR%" />
293 317
       <method v="2">
294 318
         <option name="Make" enabled="true" />
295 319
       </method>
296 320
     </configuration>
297
-    <configuration name="CheckbookTest.getTransactionsForPayeeExists" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
321
+    <configuration name="CheckbookTest.getTransactionsForPayeeExistsAfterAdd" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
298 322
       <module name="Checkbook" />
299 323
       <option name="PACKAGE_NAME" value="" />
300 324
       <option name="MAIN_CLASS_NAME" value="CheckbookTest" />
301
-      <option name="METHOD_NAME" value="getTransactionsForPayeeExists" />
325
+      <option name="METHOD_NAME" value="getTransactionsForPayeeExistsAfterAdd" />
302 326
       <option name="TEST_OBJECT" value="method" />
303 327
       <option name="WORKING_DIRECTORY" value="%MODULE_WORKING_DIR%" />
304 328
       <method v="2">
305 329
         <option name="Make" enabled="true" />
306 330
       </method>
307 331
     </configuration>
308
-    <configuration name="CheckbookTest.testToArray" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
332
+    <configuration name="CheckbookTest.getTransactionsForPayeeNotExists" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
309 333
       <module name="Checkbook" />
310 334
       <option name="PACKAGE_NAME" value="" />
311 335
       <option name="MAIN_CLASS_NAME" value="CheckbookTest" />
312
-      <option name="METHOD_NAME" value="testToArray" />
336
+      <option name="METHOD_NAME" value="getTransactionsForPayeeNotExists" />
313 337
       <option name="TEST_OBJECT" value="method" />
314 338
       <option name="WORKING_DIRECTORY" value="%MODULE_WORKING_DIR%" />
315 339
       <method v="2">
@@ -340,19 +364,19 @@
340 364
       </method>
341 365
     </configuration>
342 366
     <list>
343
-      <item itemvalue="JUnit.CheckbookTest.getTransactionsForDate" />
344
-      <item itemvalue="JUnit.CheckbookTest.getTransactionsForDateNull" />
345
-      <item itemvalue="JUnit.CheckbookTest.getTransactionAddingNewTForDateA" />
346 367
       <item itemvalue="JUnit.CheckbookTest.getTransactionsForPayeeExists" />
347
-      <item itemvalue="JUnit.CheckbookTest.testToArray" />
368
+      <item itemvalue="JUnit.CheckbookTest.getTransactionsForPayeeExists2" />
369
+      <item itemvalue="JUnit.CheckbookTest.getTransactionsForPayeeNotExists" />
370
+      <item itemvalue="JUnit.CheckbookTest.getTransactionsForPayeeExistsAfterAdd" />
371
+      <item itemvalue="JUnit.CheckbookTest.getTransactionAddingNewTForDateA" />
348 372
     </list>
349 373
     <recent_temporary>
350 374
       <list>
351 375
         <item itemvalue="JUnit.CheckbookTest.getTransactionsForPayeeExists" />
352
-        <item itemvalue="JUnit.CheckbookTest.testToArray" />
353 376
         <item itemvalue="JUnit.CheckbookTest.getTransactionAddingNewTForDateA" />
354
-        <item itemvalue="JUnit.CheckbookTest.getTransactionsForDateNull" />
355
-        <item itemvalue="JUnit.CheckbookTest.getTransactionsForDate" />
377
+        <item itemvalue="JUnit.CheckbookTest.getTransactionsForPayeeExistsAfterAdd" />
378
+        <item itemvalue="JUnit.CheckbookTest.getTransactionsForPayeeNotExists" />
379
+        <item itemvalue="JUnit.CheckbookTest.getTransactionsForPayeeExists2" />
356 380
       </list>
357 381
     </recent_temporary>
358 382
   </component>
@@ -367,44 +391,44 @@
367 391
       <option name="presentableId" value="Default" />
368 392
       <updated>1543958631974</updated>
369 393
       <workItem from="1543958633447" duration="3259000" />
370
-      <workItem from="1544046850600" duration="18617000" />
394
+      <workItem from="1544046850600" duration="23473000" />
371 395
     </task>
372 396
     <servers />
373 397
   </component>
374 398
   <component name="TestHistory">
375
-    <history-entry file="CheckbookTest_getTransactionsForPayeeExists - 2018.12.05 at 22h 10m 55s.xml">
376
-      <configuration name="CheckbookTest.getTransactionsForPayeeExists" configurationId="JUnit" />
399
+    <history-entry file="CheckbookTest_getTransactionsForPayeeExists2 - 2018.12.06 at 13h 20m 20s.xml">
400
+      <configuration name="CheckbookTest.getTransactionsForPayeeExists2" configurationId="JUnit" />
377 401
     </history-entry>
378
-    <history-entry file="CheckbookTest_testToArray - 2018.12.05 at 22h 42m 04s.xml">
379
-      <configuration name="CheckbookTest.testToArray" configurationId="JUnit" />
402
+    <history-entry file="CheckbookTest_getTransactionsForPayeeExists2 - 2018.12.06 at 13h 20m 40s.xml">
403
+      <configuration name="CheckbookTest.getTransactionsForPayeeExists2" configurationId="JUnit" />
380 404
     </history-entry>
381
-    <history-entry file="CheckbookTest_getTransactionsForPayeeExists - 2018.12.06 at 08h 30m 49s.xml">
382
-      <configuration name="CheckbookTest.getTransactionsForPayeeExists" configurationId="JUnit" />
405
+    <history-entry file="CheckbookTest_getTransactionsForPayeeExists2 - 2018.12.06 at 13h 20m 56s.xml">
406
+      <configuration name="CheckbookTest.getTransactionsForPayeeExists2" configurationId="JUnit" />
383 407
     </history-entry>
384
-    <history-entry file="CheckbookTest_getTransactionsForPayeeExists - 2018.12.06 at 08h 38m 43s.xml">
385
-      <configuration name="CheckbookTest.getTransactionsForPayeeExists" configurationId="JUnit" />
408
+    <history-entry file="CheckbookTest_getTransactionsForPayeeNotExists - 2018.12.06 at 13h 24m 02s.xml">
409
+      <configuration name="CheckbookTest.getTransactionsForPayeeNotExists" configurationId="JUnit" />
386 410
     </history-entry>
387
-    <history-entry file="CheckbookTest_getTransactionsForPayeeExists - 2018.12.06 at 08h 40m 02s.xml">
388
-      <configuration name="CheckbookTest.getTransactionsForPayeeExists" configurationId="JUnit" />
411
+    <history-entry file="CheckbookTest_getTransactionsForPayeeNotExists - 2018.12.06 at 13h 24m 22s.xml">
412
+      <configuration name="CheckbookTest.getTransactionsForPayeeNotExists" configurationId="JUnit" />
389 413
     </history-entry>
390
-    <history-entry file="CheckbookTest_getTransactionsForPayeeExists - 2018.12.06 at 08h 40m 22s.xml">
391
-      <configuration name="CheckbookTest.getTransactionsForPayeeExists" configurationId="JUnit" />
414
+    <history-entry file="CheckbookTest_getTransactionsForPayeeExistsAfterAdd - 2018.12.06 at 13h 26m 25s.xml">
415
+      <configuration name="CheckbookTest.getTransactionsForPayeeExistsAfterAdd" configurationId="JUnit" />
392 416
     </history-entry>
393
-    <history-entry file="CheckbookTest_getTransactionsForPayeeExists - 2018.12.06 at 08h 40m 25s.xml">
394
-      <configuration name="CheckbookTest.getTransactionsForPayeeExists" configurationId="JUnit" />
417
+    <history-entry file="CheckbookTest_getTransactionsForPayeeExistsAfterAdd - 2018.12.06 at 13h 26m 55s.xml">
418
+      <configuration name="CheckbookTest.getTransactionsForPayeeExistsAfterAdd" configurationId="JUnit" />
395 419
     </history-entry>
396
-    <history-entry file="CheckbookTest_getTransactionsForPayeeExists - 2018.12.06 at 08h 46m 02s.xml">
397
-      <configuration name="CheckbookTest.getTransactionsForPayeeExists" configurationId="JUnit" />
420
+    <history-entry file="CheckbookTest_getTransactionsForPayeeExistsAfterAdd - 2018.12.06 at 14h 24m 20s.xml">
421
+      <configuration name="CheckbookTest.getTransactionsForPayeeExistsAfterAdd" configurationId="JUnit" />
398 422
     </history-entry>
399
-    <history-entry file="CheckbookTest_getTransactionsForPayeeExists - 2018.12.06 at 08h 46m 13s.xml">
400
-      <configuration name="CheckbookTest.getTransactionsForPayeeExists" configurationId="JUnit" />
423
+    <history-entry file="CheckbookTest_getTransactionsForPayeeExistsAfterAdd - 2018.12.06 at 14h 24m 50s.xml">
424
+      <configuration name="CheckbookTest.getTransactionsForPayeeExistsAfterAdd" configurationId="JUnit" />
401 425
     </history-entry>
402
-    <history-entry file="CheckbookTest_getTransactionsForPayeeExists - 2018.12.06 at 08h 49m 15s.xml">
403
-      <configuration name="CheckbookTest.getTransactionsForPayeeExists" configurationId="JUnit" />
426
+    <history-entry file="CheckbookTest_getTransactionAddingNewTForDateA - 2018.12.06 at 14h 27m 07s.xml">
427
+      <configuration name="CheckbookTest.getTransactionAddingNewTForDateA" configurationId="JUnit" />
404 428
     </history-entry>
405 429
   </component>
406 430
   <component name="TimeTrackingManager">
407
-    <option name="totallyTimeSpent" value="21876000" />
431
+    <option name="totallyTimeSpent" value="26732000" />
408 432
   </component>
409 433
   <component name="ToolWindowManager">
410 434
     <frame x="0" y="23" width="1440" height="877" extended-state="0" />
@@ -421,12 +445,12 @@
421 445
       <window_info anchor="bottom" id="Messages" weight="0.32769832" />
422 446
       <window_info anchor="bottom" id="Message" order="0" />
423 447
       <window_info anchor="bottom" id="Find" order="1" />
424
-      <window_info anchor="bottom" id="Run" order="2" sideWeight="0.49928468" visible="true" weight="0.32769832" />
448
+      <window_info active="true" anchor="bottom" id="Run" order="2" sideWeight="0.49928468" visible="true" weight="0.32769832" />
425 449
       <window_info anchor="bottom" id="Debug" order="3" weight="0.39921975" />
426 450
       <window_info anchor="bottom" id="Cvs" order="4" weight="0.25" />
427 451
       <window_info anchor="bottom" id="Inspection" order="5" weight="0.4" />
428 452
       <window_info anchor="bottom" id="TODO" order="6" />
429
-      <window_info anchor="bottom" id="Terminal" order="7" />
453
+      <window_info anchor="bottom" id="Terminal" order="7" weight="0.32899868" />
430 454
       <window_info anchor="bottom" id="Event Log" order="8" sideWeight="0.5007153" side_tool="true" weight="0.32769832" />
431 455
       <window_info anchor="bottom" id="Version Control" order="9" />
432 456
       <window_info anchor="right" id="Commander" order="0" weight="0.4" />
@@ -494,25 +518,6 @@
494 518
         </state>
495 519
       </provider>
496 520
     </entry>
497
-    <entry file="jar://$MAVEN_REPOSITORY$/junit/junit/4.0/junit-4.0.jar!/org/junit/Assert.class">
498
-      <provider selected="true" editor-type-id="text-editor">
499
-        <state relative-caret-position="124">
500
-          <caret line="31" selection-start-line="31" selection-end-line="31" />
501
-          <folding>
502
-            <element signature="e#375#376#0" expanded="true" />
503
-            <element signature="e#426#427#0" expanded="true" />
504
-            <element signature="e#751#752#0" expanded="true" />
505
-          </folding>
506
-        </state>
507
-      </provider>
508
-    </entry>
509
-    <entry file="file://$PROJECT_DIR$/Checkbook/src/main/java/Payee.java">
510
-      <provider selected="true" editor-type-id="text-editor">
511
-        <state relative-caret-position="333">
512
-          <caret line="44" column="68" selection-start-line="44" selection-start-column="68" selection-end-line="44" selection-end-column="68" />
513
-        </state>
514
-      </provider>
515
-    </entry>
516 521
     <entry file="jar:///Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home/src.zip!/java/util/concurrent/atomic/AtomicReference.java">
517 522
       <provider selected="true" editor-type-id="text-editor">
518 523
         <state relative-caret-position="168">
@@ -572,47 +577,83 @@
572 577
         </state>
573 578
       </provider>
574 579
     </entry>
580
+    <entry file="jar:///Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home/src.zip!/java/util/concurrent/ThreadLocalRandom.java">
581
+      <provider selected="true" editor-type-id="text-editor">
582
+        <state relative-caret-position="-3060">
583
+          <caret line="82" column="13" selection-start-line="82" selection-start-column="13" selection-end-line="82" selection-end-column="13" />
584
+        </state>
585
+      </provider>
586
+    </entry>
575 587
     <entry file="file://$PROJECT_DIR$/README.md">
576 588
       <provider selected="true" editor-type-id="split-provider[text-editor;markdown-preview-editor]">
577 589
         <state split_layout="FIRST">
578
-          <first_editor relative-caret-position="1104">
590
+          <first_editor relative-caret-position="765">
579 591
             <caret line="48" lean-forward="true" selection-start-line="48" selection-end-line="48" />
580 592
           </first_editor>
581 593
           <second_editor />
582 594
         </state>
583 595
       </provider>
584 596
     </entry>
585
-    <entry file="file://$PROJECT_DIR$/Checkbook/src/test/java/CheckbookTest.java">
597
+    <entry file="jar://$MAVEN_REPOSITORY$/junit/junit/4.0/junit-4.0.jar!/org/junit/Assert.class">
586 598
       <provider selected="true" editor-type-id="text-editor">
587
-        <state relative-caret-position="46">
588
-          <caret line="2" column="27" selection-start-line="2" selection-start-column="27" selection-end-line="2" selection-end-column="27" />
599
+        <state relative-caret-position="124">
600
+          <caret line="170" selection-start-line="170" selection-end-line="170" />
601
+          <folding>
602
+            <element signature="e#702#703#0" expanded="true" />
603
+            <element signature="e#751#752#0" expanded="true" />
604
+          </folding>
589 605
         </state>
590 606
       </provider>
591 607
     </entry>
592
-    <entry file="file://$PROJECT_DIR$/Checkbook/src/main/java/Checkbook.java">
608
+    <entry file="file://$PROJECT_DIR$/Checkbook/src/main/java/Payee.java">
609
+      <provider selected="true" editor-type-id="text-editor">
610
+        <state relative-caret-position="241">
611
+          <caret line="40" lean-forward="true" selection-start-line="40" selection-end-line="40" />
612
+        </state>
613
+      </provider>
614
+    </entry>
615
+    <entry file="file://$PROJECT_DIR$/Checkbook/src/main/java/Transaction.java">
593 616
       <provider selected="true" editor-type-id="text-editor">
594
-        <state relative-caret-position="1012">
595
-          <caret line="54" column="5" lean-forward="true" selection-start-line="54" selection-start-column="5" selection-end-line="54" selection-end-column="5" />
617
+        <state relative-caret-position="185">
618
+          <caret line="12" column="26" lean-forward="true" selection-start-line="12" selection-start-column="26" selection-end-line="12" selection-end-column="26" />
596 619
           <folding>
597 620
             <element signature="imports" expanded="true" />
598 621
           </folding>
599 622
         </state>
600 623
       </provider>
601 624
     </entry>
602
-    <entry file="jar:///Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home/src.zip!/java/util/concurrent/ThreadLocalRandom.java">
625
+    <entry file="file://$PROJECT_DIR$/Checkbook/src/main/java/Checkbook.java">
603 626
       <provider selected="true" editor-type-id="text-editor">
604
-        <state relative-caret-position="-3060">
605
-          <caret line="82" column="13" selection-start-line="82" selection-start-column="13" selection-end-line="82" selection-end-column="13" />
627
+        <state relative-caret-position="279">
628
+          <caret line="83" column="16" selection-start-line="83" selection-start-column="16" selection-end-line="83" selection-end-column="16" />
629
+          <folding>
630
+            <element signature="imports" expanded="true" />
631
+            <element signature="e#1262#1263#0" expanded="true" />
632
+            <element signature="e#1316#1317#0" expanded="true" />
633
+            <element signature="e#1584#1585#0" expanded="true" />
634
+            <element signature="e#1641#1642#0" expanded="true" />
635
+            <element signature="e#2881#2882#0" expanded="true" />
636
+            <element signature="e#2928#2929#0" expanded="true" />
637
+            <element signature="e#2977#2978#0" expanded="true" />
638
+            <element signature="e#3019#3020#0" expanded="true" />
639
+            <element signature="e#3071#3072#0" expanded="true" />
640
+            <element signature="e#3116#3117#0" expanded="true" />
641
+            <element signature="e#3136#3137#0" expanded="true" />
642
+            <element signature="e#3169#3170#0" expanded="true" />
643
+            <element signature="e#3541#3542#0" expanded="true" />
644
+            <element signature="e#3610#3611#0" expanded="true" />
645
+            <element signature="e#3665#3666#0" expanded="true" />
646
+            <element signature="e#3735#3736#0" expanded="true" />
647
+          </folding>
606 648
         </state>
607 649
       </provider>
608 650
     </entry>
609
-    <entry file="file://$PROJECT_DIR$/Checkbook/src/main/java/Transaction.java">
651
+    <entry file="file://$PROJECT_DIR$/Checkbook/src/test/java/CheckbookTest.java">
610 652
       <provider selected="true" editor-type-id="text-editor">
611
-        <state relative-caret-position="138">
612
-          <caret line="6" column="53" lean-forward="true" selection-start-line="6" selection-start-column="53" selection-end-line="6" selection-end-column="53" />
653
+        <state relative-caret-position="-209">
654
+          <caret line="228" column="5" selection-start-line="228" selection-start-column="5" selection-end-line="228" selection-end-column="5" />
613 655
           <folding>
614 656
             <element signature="imports" expanded="true" />
615
-            <element signature="e#380#389#0" expanded="true" />
616 657
           </folding>
617 658
         </state>
618 659
       </provider>

+ 36
- 30
Checkbook/src/main/java/Checkbook.java Bestand weergeven

@@ -1,12 +1,12 @@
1
+
2
+import java.lang.reflect.Field;
1 3
 import java.time.LocalDate;
2 4
 import java.util.*;
3 5
 
4 6
 public class Checkbook {
5 7
     // Checkbook is a list of Transactions
6
-    // Gotta do something to set the ID of the transactions?
7
-    private ArrayList<Transaction> checkbook;
8
-    private ArrayList<Transaction> debits = new ArrayList<>();
9
-    private ArrayList<Transaction> credits = new ArrayList<>();;
8
+
9
+    private List<Transaction> checkbook;
10 10
 
11 11
     public Checkbook(Transaction ... t) {
12 12
         this.checkbook = new ArrayList<>(Arrays.asList(t));
@@ -18,16 +18,12 @@ public class Checkbook {
18 18
 
19 19
     public Checkbook(double cashAmount) {
20 20
         this();
21
-        Transaction t = new Transaction("owner", new Payee(), TransactionType.DEBIT, cashAmount);
22
-        checkbook.add(t);
23
-        debits.add(t);
21
+        checkbook.add(new Transaction("Default", new Payee(), TransactionType.DEBIT, cashAmount ));
24 22
     }
25 23
 
26 24
     public Checkbook(Payee owner, double cashAmount) {
27 25
         this();
28
-        Transaction t = new Transaction("owner", owner, TransactionType.DEBIT, cashAmount);
29
-        checkbook.add(t);
30
-        debits.add(t);
26
+        checkbook.add(new Transaction("Transaction", owner, TransactionType.DEBIT, cashAmount));
31 27
     }
32 28
 
33 29
     //blind us with your Java eloquence....
@@ -45,12 +41,6 @@ public class Checkbook {
45 41
     }
46 42
 
47 43
     public boolean add(Transaction transaction) {
48
-        if (transaction.getType().equals(TransactionType.DEBIT)) {
49
-            debits.add(transaction);
50
-        } else {
51
-            credits.add(transaction);
52
-        }
53
-
54 44
         return this.checkbook.add(transaction);
55 45
     }
56 46
 
@@ -86,27 +76,32 @@ public class Checkbook {
86 76
         return checkbook;
87 77
     }
88 78
 
89
-    public Transaction[] getTransactionsForDate(LocalDate aDate) {
90
-        ArrayList<Transaction> arr = new ArrayList<>();
79
+    public Transaction[] getSpecificTransactions(String fieldName, Object value) {
91 80
 
92
-        for (Transaction t: this.checkbook) {
93
-            if (t.getDate().equals(aDate)) {
94
-                arr.add(t);
81
+        List<Transaction> arr = new ArrayList<>();
82
+        for (Transaction ts : this.checkbook) {
83
+            Object valueToCheck = getObject(fieldName, ts);
84
+            if (valueToCheck.equals(value)) {
85
+                arr.add(ts);
95 86
             }
96 87
         }
97 88
         return this.toArrayFromList(arr);
98 89
     }
99 90
 
100
-    public Transaction[] getAllTransactionsForPayee(Payee p) {
101
-        ArrayList<Transaction> arr = new ArrayList<>();
102
-        for (Transaction t: this.checkbook) {
103
-            if (t.getPayee().equals(p)) {
104
-                arr.add(t);
105
-            }
91
+    private Object getObject(String fieldName, Transaction ts) {
92
+        try {
93
+            Class<Transaction> t = Transaction.class;
94
+            Field f = t.getDeclaredField(fieldName);
95
+            f.setAccessible(true);
96
+            return f.get(ts);
97
+        } catch (NoSuchFieldException | IllegalAccessException noField) {
98
+            noField.printStackTrace();
106 99
         }
107
-        return this.toArrayFromList(arr);
100
+
101
+        return null;
108 102
     }
109 103
 
104
+
110 105
     public boolean containsAll(Collection<Transaction> c) {
111 106
         return checkbook.containsAll(c);
112 107
     }
@@ -123,11 +118,22 @@ public class Checkbook {
123 118
         checkbook.clear();
124 119
     }
125 120
 
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
+
126 132
     public Transaction[] getAllDebitTransactions() {
127
-        return this.toArrayFromList(debits);
133
+        return getAllTransactionByType(TransactionType.DEBIT);
128 134
     }
129 135
 
130 136
     public Transaction[] getAllCreditTransactions() {
131
-        return this.toArrayFromList(credits);
137
+        return getAllTransactionByType(TransactionType.CREDIT);
132 138
     }
133 139
 }

+ 5
- 5
Checkbook/src/main/java/Payee.java Bestand weergeven

@@ -39,9 +39,9 @@ public class Payee {
39 39
     // ... and a bunch more hidden stuff: for testing purposes only
40 40
 
41 41
 
42
-    @Override
43
-    public boolean equals(Object obj) {
44
-        Payee p = (Payee) obj;
45
-        return (this.emailAddress.equalsIgnoreCase(p.emailAddress));
46
-    }
42
+//    @Override
43
+//    public boolean equals(Object obj) {
44
+//        Payee p = (Payee) obj;
45
+//        return (this.emailAddress.equalsIgnoreCase(p.emailAddress));
46
+//    }
47 47
 }

+ 9
- 4
Checkbook/src/main/java/Transaction.java Bestand weergeven

@@ -4,10 +4,9 @@ import java.util.concurrent.ThreadLocalRandom;
4 4
 import java.util.concurrent.atomic.AtomicReference;
5 5
 
6 6
 public class Transaction {
7
-//    private final AtomicReference<Integer> id = new AtomicReference<Integer>
8
-//            (this.id.getAndAccumulate(1, (previous, x) -> (previous + x)));
9
-    private final AtomicReference<Integer> id = new AtomicReference<Integer>(ThreadLocalRandom.current().nextInt(Integer.MAX_VALUE));
10
-    private final AtomicReference<LocalDate> date = new AtomicReference<LocalDate>(LocalDate.now());
7
+
8
+    private final AtomicReference<Integer> id = new AtomicReference<>(ThreadLocalRandom.current().nextInt(0, Integer.MAX_VALUE));
9
+    private final AtomicReference<LocalDate> date = new AtomicReference<>(LocalDate.now());
11 10
     private String memo;
12 11
     private Payee payee;
13 12
     private TransactionType typee; // Credit (reduces the checkbook), Debit (increases the checkbook)
@@ -54,4 +53,10 @@ public class Transaction {
54 53
         }
55 54
         return (-1.0 * amount);
56 55
     }
56
+
57
+    @Override /* this assumes that id's are unique.. make them so?*/
58
+    public boolean equals(Object obj) {
59
+        Transaction t2 = (Transaction) obj;
60
+        return this.getId().equals(t2.getId());
61
+    }
57 62
 }

+ 15
- 29
Checkbook/src/test/java/CheckbookTest.java Bestand weergeven

@@ -1,3 +1,4 @@
1
+import org.junit.Assert;
1 2
 import org.junit.Test;
2 3
 
3 4
 import java.time.LocalDate;
@@ -228,46 +229,31 @@ public class CheckbookTest {
228 229
     }
229 230
 
230 231
     @Test
231
-    public void getTransactionsForDate() {
232
-        LocalDate date = LocalDate.of(2018, 12, 5);
233
-        String expDate = date.toString();
234
-        for (Transaction t:checkbook.getTransactionsForDate(date)
235
-             ) {
236
-            assertEquals(expDate, t.getDate().toString());
237
-        }
238
-    }
239
-
240
-    @Test
241
-    public void getTransactionsForDateNull() {
242
-        for (Transaction t:checkbook.getTransactionsForDate(LocalDate.of(2017, 8, 10))
243
-        ) {
244
-            assertNull(t);
245
-        }
246
-    }
247
-
248
-    @Test
249 232
     public void getTransactionAddingNewTForDateA() {
250 233
         LocalDate a = LocalDate.of(2018, 12, 05);
251 234
         Transaction t = new Transaction("foo", p1, TransactionType.DEBIT, 2.00);
252 235
 
253 236
         checkbookWithDefault.add(t);
254 237
 
255
-        for (Transaction ta: checkbookWithDefault.getTransactionsForDate(a)) {
238
+        for (Transaction ta: checkbookWithDefault.getSpecificTransactions("date", a)) {
256 239
             assertEquals(a, ta.getDate());
257 240
         }
258 241
     }
259 242
 
260 243
     @Test
261 244
     public void getTransactionsForPayeeExists() {
262
-//        Transaction[] arr = {t1};
263
-//        assertEquals(arr, checkbook.getAllTransactionsForPayee(p1));
264
-//
265
-//        Transaction[] arr2 = {checkbookWithOwner.getCheckbook().get(0)};
266
-//
267
-//        System.out.println(checkbookWithOwner.getCheckbook().get(0).getPayee().getEmailAddress());
268
-//        assertEquals(arr, checkbookWithOwner.getAllTransactionsForPayee(p1));
269
-
270
-        checkbook.getCheckbook().forEach(i -> System.out.println("Transaction id: " + i.getId()));
271
-        checkbook.getCheckbook().forEach(i -> System.out.println("Repeat Transaction id: " + i.getId()));
245
+        Payee payee = new Payee();
246
+        Transaction t = new Transaction("test", payee, TransactionType.DEBIT, 10.00);
247
+        Transaction[] expArr = {t};
248
+
249
+        checkbook.add(t);
250
+        checkbookWithDefault.add(t);
251
+        checkbookWithOwner.add(t);
252
+
253
+        assertEquals(expArr, checkbook.getSpecificTransactions("payee", payee));
254
+        assertEquals(expArr, checkbookWithDefault.getSpecificTransactions("payee", payee));
255
+        assertEquals(expArr, checkbookWithOwner.getSpecificTransactions("payee", payee));
272 256
     }
257
+
258
+    // Contains all,
273 259
 }