瀏覽代碼

tests and methods

mpierse 6 年之前
父節點
當前提交
d01c266ccd
共有 3 個文件被更改,包括 633 次插入196 次删除
  1. 407
    195
      .idea/workspace.xml
  2. 84
    1
      Checkbook/src/main/java/Checkbook.java
  3. 142
    0
      Checkbook/src/test/java/CheckbookTest.java

+ 407
- 195
.idea/workspace.xml 查看文件

@@ -2,32 +2,153 @@
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$/README.md" afterPath="$PROJECT_DIR$/README.md" />
5
+      <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" 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" />
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/" />
8 10
     <option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
9
-    <option name="TRACKING_ENABLED" value="true" />
10 11
     <option name="SHOW_DIALOG" value="false" />
11 12
     <option name="HIGHLIGHT_CONFLICTS" value="true" />
12 13
     <option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
13 14
     <option name="LAST_RESOLUTION" value="IGNORE" />
14 15
   </component>
16
+  <component name="FUSProjectUsageTrigger">
17
+    <session id="-1553006135">
18
+      <usages-collector id="statistics.lifecycle.project">
19
+        <counts>
20
+          <entry key="project.open.time.1" value="1" />
21
+          <entry key="project.opened" value="1" />
22
+        </counts>
23
+      </usages-collector>
24
+      <usages-collector id="statistics.file.extensions.open">
25
+        <counts>
26
+          <entry key="iml" value="1" />
27
+          <entry key="java" value="10" />
28
+          <entry key="md" value="1" />
29
+        </counts>
30
+      </usages-collector>
31
+      <usages-collector id="statistics.file.types.open">
32
+        <counts>
33
+          <entry key="IDEA_MODULE" value="1" />
34
+          <entry key="JAVA" value="10" />
35
+          <entry key="Markdown" value="1" />
36
+        </counts>
37
+      </usages-collector>
38
+      <usages-collector id="statistics.file.extensions.edit">
39
+        <counts>
40
+          <entry key="java" value="1550" />
41
+        </counts>
42
+      </usages-collector>
43
+      <usages-collector id="statistics.file.types.edit">
44
+        <counts>
45
+          <entry key="JAVA" value="1550" />
46
+        </counts>
47
+      </usages-collector>
48
+    </session>
49
+  </component>
15 50
   <component name="FileEditorManager">
16
-    <leaf>
17
-      <file leaf-file-name="README.md" pinned="false" current-in-tab="true">
18
-        <entry file="file://$PROJECT_DIR$/README.md">
19
-          <provider selected="true" editor-type-id="split-provider[text-editor;markdown-preview-editor]">
20
-            <state split_layout="SPLIT">
21
-              <first_editor relative-caret-position="588">
22
-                <caret line="39" column="0" lean-forward="false" selection-start-line="39" selection-start-column="0" selection-end-line="39" selection-end-column="0" />
23
-                <folding />
24
-              </first_editor>
25
-              <second_editor />
26
-            </state>
27
-          </provider>
28
-        </entry>
29
-      </file>
30
-    </leaf>
51
+    <splitter split-orientation="horizontal" split-proportion="0.60658085">
52
+      <split-first>
53
+        <leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
54
+          <file pinned="false" current-in-tab="false">
55
+            <entry file="file://$PROJECT_DIR$/Checkbook/src/main/java/Transaction.java">
56
+              <provider selected="true" editor-type-id="text-editor">
57
+                <state relative-caret-position="240">
58
+                  <caret line="16" column="5" lean-forward="true" selection-start-line="16" selection-start-column="5" selection-end-line="16" selection-end-column="5" />
59
+                  <folding>
60
+                    <element signature="imports" expanded="true" />
61
+                    <element signature="e#175#184#0" expanded="true" />
62
+                    <element signature="e#259#270#0" expanded="true" />
63
+                    <element signature="e#689#690#0" expanded="true" />
64
+                    <element signature="e#720#721#0" expanded="true" />
65
+                    <element signature="e#754#755#0" expanded="true" />
66
+                    <element signature="e#787#788#0" expanded="true" />
67
+                    <element signature="e#827#828#0" expanded="true" />
68
+                    <element signature="e#855#856#0" expanded="true" />
69
+                    <element signature="e#886#887#0" expanded="true" />
70
+                    <element signature="e#913#914#0" expanded="true" />
71
+                    <element signature="e#953#954#0" expanded="true" />
72
+                    <element signature="e#985#986#0" expanded="true" />
73
+                    <element signature="e#1016#1017#0" expanded="true" />
74
+                    <element signature="e#1044#1045#0" expanded="true" />
75
+                    <element signature="e#1085#1086#0" expanded="true" />
76
+                    <element signature="e#1119#1120#0" expanded="true" />
77
+                  </folding>
78
+                </state>
79
+              </provider>
80
+            </entry>
81
+          </file>
82
+          <file pinned="false" current-in-tab="false">
83
+            <entry file="file://$PROJECT_DIR$/Checkbook/src/main/java/Checkbook.java">
84
+              <provider selected="true" editor-type-id="text-editor">
85
+                <state relative-caret-position="1215">
86
+                  <caret line="81" column="4" selection-start-line="81" selection-start-column="4" selection-end-line="81" selection-end-column="4" />
87
+                  <folding>
88
+                    <element signature="imports" expanded="true" />
89
+                    <element signature="e#185#186#0" expanded="true" />
90
+                    <element signature="e#239#240#0" expanded="true" />
91
+                    <element signature="e#141#142#0" expanded="true" />
92
+                    <element signature="e#170#171#0" expanded="true" />
93
+                    <element signature="e#205#206#0" expanded="true" />
94
+                    <element signature="e#234#235#0" expanded="true" />
95
+                    <element signature="e#296#297#0" expanded="true" />
96
+                    <element signature="e#318#319#0" expanded="true" />
97
+                    <element signature="e#394#395#0" expanded="true" />
98
+                    <element signature="e#416#417#0" expanded="true" />
99
+                    <element signature="e#668#669#0" expanded="true" />
100
+                    <element signature="e#698#699#0" expanded="true" />
101
+                    <element signature="e#780#781#0" expanded="true" />
102
+                    <element signature="e#817#818#0" expanded="true" />
103
+                  </folding>
104
+                </state>
105
+              </provider>
106
+            </entry>
107
+          </file>
108
+          <file pinned="false" current-in-tab="true">
109
+            <entry file="file://$PROJECT_DIR$/Checkbook/src/test/java/CheckbookTest.java">
110
+              <provider selected="true" editor-type-id="text-editor">
111
+                <state relative-caret-position="2235">
112
+                  <caret line="149" column="49" lean-forward="true" selection-start-line="149" selection-start-column="49" selection-end-line="149" selection-end-column="49" />
113
+                  <folding>
114
+                    <element signature="imports" expanded="true" />
115
+                    <element signature="e#1385#1386#0" expanded="true" />
116
+                    <element signature="e#1406#1407#0" expanded="true" />
117
+                    <element signature="e#2852#2853#0" expanded="true" />
118
+                    <element signature="e#2932#2933#0" expanded="true" />
119
+                  </folding>
120
+                </state>
121
+              </provider>
122
+            </entry>
123
+          </file>
124
+          <file pinned="false" current-in-tab="false">
125
+            <entry file="file://$PROJECT_DIR$/Checkbook/src/main/java/AccountBook.java">
126
+              <provider selected="true" editor-type-id="text-editor">
127
+                <state relative-caret-position="30">
128
+                  <caret line="2" column="17" selection-start-line="2" selection-start-column="17" selection-end-line="2" selection-end-column="17" />
129
+                </state>
130
+              </provider>
131
+            </entry>
132
+          </file>
133
+        </leaf>
134
+      </split-first>
135
+      <split-second>
136
+        <leaf>
137
+          <file pinned="false" current-in-tab="true">
138
+            <entry file="file://$PROJECT_DIR$/README.md">
139
+              <provider selected="true" editor-type-id="split-provider[text-editor;markdown-preview-editor]">
140
+                <state split_layout="SECOND">
141
+                  <first_editor>
142
+                    <caret line="39" selection-start-line="39" selection-end-line="39" />
143
+                  </first_editor>
144
+                  <second_editor />
145
+                </state>
146
+              </provider>
147
+            </entry>
148
+          </file>
149
+        </leaf>
150
+      </split-second>
151
+    </splitter>
31 152
   </component>
32 153
   <component name="FileTemplateManagerImpl">
33 154
     <option name="RECENT_TEMPLATES">
@@ -42,9 +163,6 @@
42 163
     <option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
43 164
   </component>
44 165
   <component name="GradleLocalSettings">
45
-    <option name="externalProjectsViewState">
46
-      <projects_view />
47
-    </option>
48 166
     <option name="projectSyncType">
49 167
       <map>
50 168
         <entry key="$USER_HOME$/GitHub/gs-gradle/initial" value="PREVIEW" />
@@ -54,14 +172,14 @@
54 172
   <component name="IdeDocumentHistory">
55 173
     <option name="CHANGED_PATHS">
56 174
       <list>
57
-        <option value="$PROJECT_DIR$/Checkbook/src/test/java/CheckbookTest.java" />
58 175
         <option value="$PROJECT_DIR$/Checkbook/src/main/java/Payee.java" />
59 176
         <option value="$PROJECT_DIR$/Checkbook/src/main/java/Transaction.java" />
60 177
         <option value="$PROJECT_DIR$/Checkbook/src/main/java/AccountBook.java" />
61
-        <option value="$PROJECT_DIR$/Checkbook/src/main/java/Checkbook.java" />
62 178
         <option value="$PROJECT_DIR$/Checkbook/src/main/java/GenericAccount.java" />
63 179
         <option value="$PROJECT_DIR$/Checkbook/src/main/java/TransactionType.java" />
64 180
         <option value="$PROJECT_DIR$/README.md" />
181
+        <option value="$PROJECT_DIR$/Checkbook/src/test/java/CheckbookTest.java" />
182
+        <option value="$PROJECT_DIR$/Checkbook/src/main/java/Checkbook.java" />
65 183
       </list>
66 184
     </option>
67 185
   </component>
@@ -72,29 +190,15 @@
72 190
     <sorting>DEFINITION_ORDER</sorting>
73 191
   </component>
74 192
   <component name="ProjectFrameBounds">
75
-    <option name="x" value="115" />
76
-    <option name="y" value="45" />
77
-    <option name="width" value="1538" />
78
-    <option name="height" value="962" />
193
+    <option name="y" value="23" />
194
+    <option name="width" value="1440" />
195
+    <option name="height" value="805" />
79 196
   </component>
80 197
   <component name="ProjectView">
81
-    <navigator currentView="ProjectPane" proportions="" version="1">
82
-      <flattenPackages />
83
-      <showMembers />
84
-      <showModules />
85
-      <showLibraryContents />
86
-      <hideEmptyPackages />
87
-      <abbreviatePackageNames />
88
-      <autoscrollToSource />
89
-      <autoscrollFromSource />
90
-      <sortByType />
91
-      <manualOrder />
198
+    <navigator proportions="" version="1">
92 199
       <foldersAlwaysOnTop value="true" />
93 200
     </navigator>
94 201
     <panes>
95
-      <pane id="Scope" />
96
-      <pane id="Scratches" />
97
-      <pane id="AndroidView" />
98 202
       <pane id="PackagesPane" />
99 203
       <pane id="ProjectPane">
100 204
         <subPane>
@@ -129,23 +233,40 @@
129 233
               <item name="main" type="462c0819:PsiDirectoryNode" />
130 234
               <item name="java" type="462c0819:PsiDirectoryNode" />
131 235
             </path>
236
+            <path>
237
+              <item name="Checkbook-OldStyle" type="b2602c69:ProjectViewProjectNode" />
238
+              <item name="Checkbook-OldStyle" type="462c0819:PsiDirectoryNode" />
239
+              <item name="Checkbook" type="462c0819:PsiDirectoryNode" />
240
+              <item name="src" type="462c0819:PsiDirectoryNode" />
241
+              <item name="test" type="462c0819:PsiDirectoryNode" />
242
+            </path>
243
+            <path>
244
+              <item name="Checkbook-OldStyle" type="b2602c69:ProjectViewProjectNode" />
245
+              <item name="Checkbook-OldStyle" type="462c0819:PsiDirectoryNode" />
246
+              <item name="Checkbook" type="462c0819:PsiDirectoryNode" />
247
+              <item name="src" type="462c0819:PsiDirectoryNode" />
248
+              <item name="test" type="462c0819:PsiDirectoryNode" />
249
+              <item name="java" type="462c0819:PsiDirectoryNode" />
250
+            </path>
132 251
           </expand>
133 252
           <select />
134 253
         </subPane>
135 254
       </pane>
255
+      <pane id="Scope" />
136 256
     </panes>
137 257
   </component>
138 258
   <component name="PropertiesComponent">
139
-    <property name="nodejs_interpreter_path.stuck_in_default_project" value="undefined stuck path" />
140
-    <property name="settings.editor.selected.configurable" value="configurable.group.appearance" />
141 259
     <property name="WebServerToolWindowFactoryState" value="false" />
142 260
     <property name="aspect.path.notification.shown" value="true" />
143
-    <property name="last_opened_file_path" value="$PROJECT_DIR$" />
261
+    <property name="com.android.tools.idea.instantapp.provision.ProvisionBeforeRunTaskProvider.myTimeStamp" value="1544292738352" />
262
+    <property name="com.intellij.testIntegration.createTest.CreateTestDialog.defaultLibrary" value="JUnit4" />
144 263
     <property name="jdk.selected.JAVA_MODULE" value="1.8" />
264
+    <property name="last_opened_file_path" value="$PROJECT_DIR$" />
265
+    <property name="nodejs_interpreter_path.stuck_in_default_project" value="undefined stuck path" />
145 266
     <property name="project.structure.last.edited" value="Modules" />
146 267
     <property name="project.structure.proportion" value="0.0" />
147 268
     <property name="project.structure.side.proportion" value="0.0" />
148
-    <property name="com.intellij.testIntegration.createTest.CreateTestDialog.defaultLibrary" value="JUnit4" />
269
+    <property name="settings.editor.selected.configurable" value="configurable.group.appearance" />
149 270
   </component>
150 271
   <component name="RecentsManager">
151 272
     <key name="CreateTestDialog.RecentsKey">
@@ -167,90 +288,113 @@
167 288
       </list>
168 289
     </option>
169 290
   </component>
170
-  <component name="RunManager">
291
+  <component name="RunManager" selected="JUnit.CheckbookTest.getAllDebitTest">
171 292
     <configuration default="true" type="Applet" factoryName="Applet">
172
-      <option name="WIDTH" value="400" />
173
-      <option name="HEIGHT" value="300" />
174 293
       <option name="POLICY_FILE" value="$APPLICATION_HOME_DIR$/bin/appletviewer.policy" />
175
-      <module />
294
+      <method v="2">
295
+        <option name="Make" enabled="true" />
296
+      </method>
176 297
     </configuration>
177 298
     <configuration default="true" type="Application" factoryName="Application">
178
-      <extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
179
-      <option name="MAIN_CLASS_NAME" />
180
-      <option name="VM_PARAMETERS" />
181
-      <option name="PROGRAM_PARAMETERS" />
182 299
       <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
183
-      <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
184
-      <option name="ALTERNATIVE_JRE_PATH" />
185
-      <option name="ENABLE_SWING_INSPECTOR" value="false" />
186
-      <option name="ENV_VARIABLES" />
187
-      <option name="PASS_PARENT_ENVS" value="true" />
188
-      <module name="" />
189
-      <envs />
300
+      <method v="2">
301
+        <option name="Make" enabled="true" />
302
+      </method>
190 303
     </configuration>
191
-    <configuration default="true" type="JUnit" factoryName="JUnit">
192
-      <extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
193
-      <module name="" />
194
-      <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
195
-      <option name="ALTERNATIVE_JRE_PATH" />
196
-      <option name="PACKAGE_NAME" />
197
-      <option name="MAIN_CLASS_NAME" />
198
-      <option name="METHOD_NAME" />
199
-      <option name="TEST_OBJECT" value="class" />
200
-      <option name="VM_PARAMETERS" value="-ea" />
201
-      <option name="PARAMETERS" />
304
+    <configuration name="CheckbookTest.checkbookValue" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
305
+      <module name="Checkbook" />
306
+      <option name="PACKAGE_NAME" value="" />
307
+      <option name="MAIN_CLASS_NAME" value="CheckbookTest" />
308
+      <option name="METHOD_NAME" value="checkbookValue" />
309
+      <option name="TEST_OBJECT" value="method" />
310
+      <option name="WORKING_DIRECTORY" value="%MODULE_WORKING_DIR%" />
311
+      <method v="2">
312
+        <option name="Make" enabled="true" />
313
+      </method>
314
+    </configuration>
315
+    <configuration name="CheckbookTest.getAllDebitTest" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
316
+      <module name="Checkbook" />
317
+      <option name="PACKAGE_NAME" value="" />
318
+      <option name="MAIN_CLASS_NAME" value="CheckbookTest" />
319
+      <option name="METHOD_NAME" value="getAllDebitTest" />
320
+      <option name="TEST_OBJECT" value="method" />
321
+      <option name="WORKING_DIRECTORY" value="%MODULE_WORKING_DIR%" />
322
+      <method v="2">
323
+        <option name="Make" enabled="true" />
324
+      </method>
325
+    </configuration>
326
+    <configuration name="CheckbookTest.getTransactionForPayee" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
327
+      <module name="Checkbook" />
328
+      <option name="PACKAGE_NAME" value="" />
329
+      <option name="MAIN_CLASS_NAME" value="CheckbookTest" />
330
+      <option name="METHOD_NAME" value="getTransactionForPayee" />
331
+      <option name="TEST_OBJECT" value="method" />
202 332
       <option name="WORKING_DIRECTORY" value="%MODULE_WORKING_DIR%" />
203
-      <option name="ENV_VARIABLES" />
204
-      <option name="PASS_PARENT_ENVS" value="true" />
205
-      <option name="TEST_SEARCH_SCOPE">
206
-        <value defaultName="singleModule" />
207
-      </option>
208
-      <envs />
209
-      <patterns />
333
+      <method v="2">
334
+        <option name="Make" enabled="true" />
335
+      </method>
210 336
     </configuration>
211
-    <configuration default="true" type="Remote" factoryName="Remote">
212
-      <option name="USE_SOCKET_TRANSPORT" value="true" />
213
-      <option name="SERVER_MODE" value="false" />
214
-      <option name="SHMEM_ADDRESS" value="javadebug" />
215
-      <option name="HOST" value="localhost" />
216
-      <option name="PORT" value="5005" />
337
+    <configuration name="CheckbookTest.getTransactionsForDateTest" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
338
+      <module name="Checkbook" />
339
+      <option name="PACKAGE_NAME" value="" />
340
+      <option name="MAIN_CLASS_NAME" value="CheckbookTest" />
341
+      <option name="METHOD_NAME" value="getTransactionsForDateTest" />
342
+      <option name="TEST_OBJECT" value="method" />
343
+      <option name="WORKING_DIRECTORY" value="%MODULE_WORKING_DIR%" />
344
+      <method v="2">
345
+        <option name="Make" enabled="true" />
346
+      </method>
347
+    </configuration>
348
+    <configuration name="CheckbookTest.toArrayparam2test" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
349
+      <module name="Checkbook" />
350
+      <option name="PACKAGE_NAME" value="" />
351
+      <option name="MAIN_CLASS_NAME" value="CheckbookTest" />
352
+      <option name="METHOD_NAME" value="toArrayparam2test" />
353
+      <option name="TEST_OBJECT" value="method" />
354
+      <option name="WORKING_DIRECTORY" value="%MODULE_WORKING_DIR%" />
355
+      <method v="2">
356
+        <option name="Make" enabled="true" />
357
+      </method>
358
+    </configuration>
359
+    <configuration default="true" type="JUnit" factoryName="JUnit">
360
+      <option name="WORKING_DIRECTORY" value="%MODULE_WORKING_DIR%" />
361
+      <method v="2">
362
+        <option name="Make" enabled="true" />
363
+      </method>
217 364
     </configuration>
218 365
     <configuration default="true" type="TestNG" factoryName="TestNG">
219
-      <extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
220
-      <module name="" />
221
-      <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
222
-      <option name="ALTERNATIVE_JRE_PATH" />
223
-      <option name="SUITE_NAME" />
224
-      <option name="PACKAGE_NAME" />
225
-      <option name="MAIN_CLASS_NAME" />
226
-      <option name="METHOD_NAME" />
227
-      <option name="GROUP_NAME" />
228
-      <option name="TEST_OBJECT" value="CLASS" />
229
-      <option name="VM_PARAMETERS" value="-ea" />
230
-      <option name="PARAMETERS" />
231 366
       <option name="WORKING_DIRECTORY" value="%MODULE_WORKING_DIR%" />
232
-      <option name="OUTPUT_DIRECTORY" />
233
-      <option name="ANNOTATION_TYPE" />
234
-      <option name="ENV_VARIABLES" />
235
-      <option name="PASS_PARENT_ENVS" value="true" />
236
-      <option name="TEST_SEARCH_SCOPE">
237
-        <value defaultName="singleModule" />
238
-      </option>
239
-      <option name="USE_DEFAULT_REPORTERS" value="false" />
240
-      <option name="PROPERTIES_FILE" />
241
-      <envs />
242 367
       <properties />
243 368
       <listeners />
369
+      <method v="2">
370
+        <option name="Make" enabled="true" />
371
+      </method>
244 372
     </configuration>
245 373
     <configuration default="true" type="#org.jetbrains.idea.devkit.run.PluginConfigurationType" factoryName="Plugin">
246 374
       <module name="" />
247 375
       <option name="VM_PARAMETERS" value="-Xmx512m -Xms256m -XX:MaxPermSize=250m -ea" />
248 376
       <option name="PROGRAM_PARAMETERS" />
249 377
       <predefined_log_file id="idea.log" enabled="true" />
378
+      <method v="2">
379
+        <option name="Make" enabled="true" />
380
+      </method>
250 381
     </configuration>
251
-  </component>
252
-  <component name="ShelveChangesManager" show_recycled="false">
253
-    <option name="remove_strategy" value="false" />
382
+    <list>
383
+      <item itemvalue="JUnit.CheckbookTest.toArrayparam2test" />
384
+      <item itemvalue="JUnit.CheckbookTest.checkbookValue" />
385
+      <item itemvalue="JUnit.CheckbookTest.getTransactionsForDateTest" />
386
+      <item itemvalue="JUnit.CheckbookTest.getTransactionForPayee" />
387
+      <item itemvalue="JUnit.CheckbookTest.getAllDebitTest" />
388
+    </list>
389
+    <recent_temporary>
390
+      <list>
391
+        <item itemvalue="JUnit.CheckbookTest.getAllDebitTest" />
392
+        <item itemvalue="JUnit.CheckbookTest.getTransactionForPayee" />
393
+        <item itemvalue="JUnit.CheckbookTest.getTransactionsForDateTest" />
394
+        <item itemvalue="JUnit.CheckbookTest.checkbookValue" />
395
+        <item itemvalue="JUnit.CheckbookTest.toArrayparam2test" />
396
+      </list>
397
+    </recent_temporary>
254 398
   </component>
255 399
   <component name="SvnConfiguration">
256 400
     <configuration />
@@ -263,43 +407,106 @@
263 407
       <option name="presentableId" value="Default" />
264 408
       <updated>1543958631974</updated>
265 409
       <workItem from="1543958633447" duration="3259000" />
410
+      <workItem from="1544205488920" duration="9178000" />
266 411
     </task>
267 412
     <servers />
268 413
   </component>
414
+  <component name="TestHistory">
415
+    <history-entry file="CheckbookTest_toArrayparam2test - 2018.12.07 at 16h 06m 47s.xml">
416
+      <configuration name="CheckbookTest.toArrayparam2test" configurationId="JUnit" />
417
+    </history-entry>
418
+    <history-entry file="CheckbookTest_checkbookValue - 2018.12.07 at 16h 16m 13s.xml">
419
+      <configuration name="CheckbookTest.checkbookValue" configurationId="JUnit" />
420
+    </history-entry>
421
+    <history-entry file="CheckbookTest_checkbookValue - 2018.12.07 at 16h 17m 33s.xml">
422
+      <configuration name="CheckbookTest.checkbookValue" configurationId="JUnit" />
423
+    </history-entry>
424
+    <history-entry file="CheckbookTest_getTransactionsForDateTest - 2018.12.07 at 18h 17m 48s.xml">
425
+      <configuration name="CheckbookTest.getTransactionsForDateTest" configurationId="JUnit" />
426
+    </history-entry>
427
+    <history-entry file="CheckbookTest_getTransactionForPayee - 2018.12.07 at 18h 20m 02s.xml">
428
+      <configuration name="CheckbookTest.getTransactionForPayee" configurationId="JUnit" />
429
+    </history-entry>
430
+    <history-entry file="CheckbookTest_getTransactionForPayee - 2018.12.07 at 18h 20m 08s.xml">
431
+      <configuration name="CheckbookTest.getTransactionForPayee" configurationId="JUnit" />
432
+    </history-entry>
433
+    <history-entry file="CheckbookTest_getTransactionForPayee - 2018.12.07 at 18h 25m 55s.xml">
434
+      <configuration name="CheckbookTest.getTransactionForPayee" configurationId="JUnit" />
435
+    </history-entry>
436
+    <history-entry file="CheckbookTest_getTransactionForPayee - 2018.12.07 at 18h 27m 14s.xml">
437
+      <configuration name="CheckbookTest.getTransactionForPayee" configurationId="JUnit" />
438
+    </history-entry>
439
+    <history-entry file="CheckbookTest_getTransactionForPayee - 2018.12.07 at 18h 27m 48s.xml">
440
+      <configuration name="CheckbookTest.getTransactionForPayee" configurationId="JUnit" />
441
+    </history-entry>
442
+    <history-entry file="CheckbookTest_getAllDebitTest - 2018.12.07 at 18h 30m 33s.xml">
443
+      <configuration name="CheckbookTest.getAllDebitTest" configurationId="JUnit" />
444
+    </history-entry>
445
+  </component>
269 446
   <component name="TimeTrackingManager">
270
-    <option name="totallyTimeSpent" value="3259000" />
447
+    <option name="totallyTimeSpent" value="12437000" />
271 448
   </component>
272 449
   <component name="ToolWindowManager">
273
-    <frame x="115" y="45" width="1538" height="962" extended-state="0" />
274
-    <editor active="true" />
450
+    <frame x="0" y="23" width="1440" height="805" extended-state="0" />
275 451
     <layout>
276
-      <window_info id="Palette" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
277
-      <window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
278
-      <window_info id="Palette&#9;" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
279
-      <window_info id="Image Layers" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
280
-      <window_info id="Capture Analysis" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
281
-      <window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="-1" side_tool="true" content_ui="tabs" />
282
-      <window_info id="Maven Projects" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
283
-      <window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
284
-      <window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
285
-      <window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
286
-      <window_info id="Capture Tool" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
287
-      <window_info id="Designer" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
288
-      <window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.24966353" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
289
-      <window_info id="Database" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
290
-      <window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
291
-      <window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
292
-      <window_info id="UI Designer" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
293
-      <window_info id="Theme Preview" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
294
-      <window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
295
-      <window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="-1" side_tool="true" content_ui="tabs" />
296
-      <window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
297
-      <window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="2" side_tool="false" content_ui="combo" />
298
-      <window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
299
-      <window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
300
-      <window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
301
-      <window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
452
+      <window_info content_ui="combo" id="Project" order="0" weight="0.2532189" />
453
+      <window_info id="Structure" order="1" weight="0.25" />
454
+      <window_info id="Image Layers" order="2" />
455
+      <window_info id="Designer" order="3" />
456
+      <window_info id="UI Designer" order="4" />
457
+      <window_info id="Capture Tool" order="5" />
458
+      <window_info id="Favorites" order="6" side_tool="true" />
459
+      <window_info anchor="bottom" id="Database Changes" show_stripe_button="false" />
460
+      <window_info anchor="bottom" id="Messages" weight="0.32959327" />
461
+      <window_info anchor="bottom" id="Message" order="0" />
462
+      <window_info anchor="bottom" id="Find" order="1" />
463
+      <window_info active="true" anchor="bottom" id="Run" order="2" visible="true" weight="0.32959327" />
464
+      <window_info anchor="bottom" id="Debug" order="3" weight="0.4" />
465
+      <window_info anchor="bottom" id="Cvs" order="4" weight="0.25" />
466
+      <window_info anchor="bottom" id="Inspection" order="5" weight="0.4" />
467
+      <window_info anchor="bottom" id="TODO" order="6" />
468
+      <window_info anchor="bottom" id="Terminal" order="7" />
469
+      <window_info anchor="bottom" id="Event Log" order="8" side_tool="true" />
470
+      <window_info anchor="bottom" id="Version Control" order="9" />
471
+      <window_info anchor="right" id="Commander" order="0" weight="0.4" />
472
+      <window_info anchor="right" id="Ant Build" order="1" weight="0.25" />
473
+      <window_info anchor="right" content_ui="combo" id="Hierarchy" order="2" weight="0.25" />
474
+      <window_info anchor="right" id="Palette" order="3" />
475
+      <window_info anchor="right" id="Capture Analysis" order="4" />
476
+      <window_info anchor="right" id="Theme Preview" order="5" />
477
+      <window_info anchor="right" id="Database" order="6" />
478
+      <window_info anchor="right" id="Palette&#9;" order="7" />
479
+      <window_info anchor="right" id="Maven Projects" order="8" />
302 480
     </layout>
481
+    <layout-to-restore>
482
+      <window_info active="true" content_ui="combo" id="Project" order="0" visible="true" weight="0.2532189" />
483
+      <window_info id="Structure" order="1" weight="0.25" />
484
+      <window_info id="Image Layers" order="2" />
485
+      <window_info id="Designer" order="3" />
486
+      <window_info id="UI Designer" order="4" />
487
+      <window_info id="Capture Tool" order="5" />
488
+      <window_info id="Favorites" order="6" side_tool="true" />
489
+      <window_info anchor="bottom" id="Database Changes" order="0" show_stripe_button="false" />
490
+      <window_info anchor="bottom" id="Message" order="1" />
491
+      <window_info anchor="bottom" id="Find" order="2" />
492
+      <window_info anchor="bottom" id="Run" order="3" />
493
+      <window_info anchor="bottom" id="Debug" order="4" weight="0.4" />
494
+      <window_info anchor="bottom" id="Cvs" order="5" weight="0.25" />
495
+      <window_info anchor="bottom" id="Inspection" order="6" weight="0.4" />
496
+      <window_info anchor="bottom" id="TODO" order="7" />
497
+      <window_info anchor="bottom" id="Terminal" order="8" />
498
+      <window_info anchor="bottom" id="Event Log" order="9" side_tool="true" />
499
+      <window_info anchor="bottom" id="Version Control" order="10" />
500
+      <window_info anchor="right" id="Commander" order="0" weight="0.4" />
501
+      <window_info anchor="right" id="Ant Build" order="1" weight="0.25" />
502
+      <window_info anchor="right" content_ui="combo" id="Hierarchy" order="2" weight="0.25" />
503
+      <window_info anchor="right" id="Palette" order="3" />
504
+      <window_info anchor="right" id="Capture Analysis" order="4" />
505
+      <window_info anchor="right" id="Theme Preview" order="5" />
506
+      <window_info anchor="right" id="Database" order="6" />
507
+      <window_info anchor="right" id="Palette&#9;" order="7" />
508
+      <window_info anchor="right" id="Maven Projects" order="8" />
509
+    </layout-to-restore>
303 510
   </component>
304 511
   <component name="TypeScriptGeneratedFilesManager">
305 512
     <option name="version" value="1" />
@@ -307,23 +514,42 @@
307 514
   <component name="VcsContentAnnotationSettings">
308 515
     <option name="myLimit" value="2678400000" />
309 516
   </component>
310
-  <component name="XDebuggerManager">
311
-    <breakpoint-manager />
312
-    <watches-manager />
313
-  </component>
314 517
   <component name="editorHistoryManager">
315
-    <entry file="file://$PROJECT_DIR$/Checkbook/src/test/java/CheckbookTest.java">
518
+    <entry file="jar:///Library/Java/JavaVirtualMachines/jdk1.8.0_161.jdk/Contents/Home/src.zip!/java/util/concurrent/atomic/AtomicReference.java" />
519
+    <entry file="file://$PROJECT_DIR$/Checkbook/pom.xml">
520
+      <provider selected="true" editor-type-id="text-editor" />
521
+    </entry>
522
+    <entry file="file://$PROJECT_DIR$/README.md">
523
+      <provider selected="true" editor-type-id="split-provider[text-editor;markdown-preview-editor]">
524
+        <state split_layout="SECOND">
525
+          <first_editor>
526
+            <caret line="39" selection-start-line="39" selection-end-line="39" />
527
+          </first_editor>
528
+          <second_editor />
529
+        </state>
530
+      </provider>
531
+    </entry>
532
+    <entry file="file://$PROJECT_DIR$/Checkbook/src/main/java/GenericAccount.java">
316 533
       <provider selected="true" editor-type-id="text-editor">
317
-        <state relative-caret-position="170">
318
-          <caret line="10" column="5" lean-forward="false" selection-start-line="10" selection-start-column="5" selection-end-line="10" selection-end-column="5" />
319
-          <folding />
534
+        <state relative-caret-position="15">
535
+          <caret line="1" column="28" selection-start-line="1" selection-start-column="28" selection-end-line="1" selection-end-column="28" />
320 536
         </state>
321 537
       </provider>
322 538
     </entry>
539
+    <entry file="file://$PROJECT_DIR$/Checkbook/src/main/java/TransactionType.java">
540
+      <provider selected="true" editor-type-id="text-editor">
541
+        <state>
542
+          <caret lean-forward="true" />
543
+        </state>
544
+      </provider>
545
+    </entry>
546
+    <entry file="file://$PROJECT_DIR$/Checkbook/Checkbook.iml">
547
+      <provider selected="true" editor-type-id="text-editor" />
548
+    </entry>
323 549
     <entry file="file://$PROJECT_DIR$/Checkbook/src/main/java/Payee.java">
324 550
       <provider selected="true" editor-type-id="text-editor">
325
-        <state relative-caret-position="357">
326
-          <caret line="21" column="0" lean-forward="false" selection-start-line="21" selection-start-column="0" selection-end-line="21" selection-end-column="0" />
551
+        <state relative-caret-position="315">
552
+          <caret line="21" selection-start-line="21" selection-end-line="21" />
327 553
           <folding>
328 554
             <element signature="e#151#152#0" expanded="true" />
329 555
             <element signature="e#184#185#0" expanded="true" />
@@ -341,34 +567,17 @@
341 567
         </state>
342 568
       </provider>
343 569
     </entry>
344
-    <entry file="jar:///Library/Java/JavaVirtualMachines/jdk1.8.0_161.jdk/Contents/Home/src.zip!/java/util/concurrent/atomic/AtomicReference.java">
345
-      <provider selected="true" editor-type-id="text-editor">
346
-        <state relative-caret-position="134">
347
-          <caret line="47" column="3" lean-forward="true" selection-start-line="47" selection-start-column="3" selection-end-line="47" selection-end-column="3" />
348
-          <folding />
349
-        </state>
350
-      </provider>
351
-    </entry>
352
-    <entry file="file://$PROJECT_DIR$/Checkbook/src/main/java/GenericAccount.java">
353
-      <provider selected="true" editor-type-id="text-editor">
354
-        <state relative-caret-position="17">
355
-          <caret line="1" column="0" lean-forward="false" selection-start-line="1" selection-start-column="0" selection-end-line="1" selection-end-column="0" />
356
-          <folding />
357
-        </state>
358
-      </provider>
359
-    </entry>
360
-    <entry file="file://$PROJECT_DIR$/Checkbook/src/main/java/TransactionType.java">
570
+    <entry file="file://$PROJECT_DIR$/Checkbook/src/main/java/AccountBook.java">
361 571
       <provider selected="true" editor-type-id="text-editor">
362
-        <state relative-caret-position="17">
363
-          <caret line="1" column="0" lean-forward="false" selection-start-line="1" selection-start-column="0" selection-end-line="1" selection-end-column="0" />
364
-          <folding />
572
+        <state relative-caret-position="30">
573
+          <caret line="2" column="17" selection-start-line="2" selection-start-column="17" selection-end-line="2" selection-end-column="17" />
365 574
         </state>
366 575
       </provider>
367 576
     </entry>
368 577
     <entry file="file://$PROJECT_DIR$/Checkbook/src/main/java/Transaction.java">
369 578
       <provider selected="true" editor-type-id="text-editor">
370
-        <state relative-caret-position="442">
371
-          <caret line="26" column="18" lean-forward="true" selection-start-line="26" selection-start-column="0" selection-end-line="27" selection-end-column="0" />
579
+        <state relative-caret-position="240">
580
+          <caret line="16" column="5" lean-forward="true" selection-start-line="16" selection-start-column="5" selection-end-line="16" selection-end-column="5" />
372 581
           <folding>
373 582
             <element signature="imports" expanded="true" />
374 583
             <element signature="e#175#184#0" expanded="true" />
@@ -391,38 +600,41 @@
391 600
         </state>
392 601
       </provider>
393 602
     </entry>
394
-    <entry file="file://$PROJECT_DIR$/Checkbook/src/main/java/AccountBook.java">
395
-      <provider selected="true" editor-type-id="text-editor">
396
-        <state relative-caret-position="204">
397
-          <caret line="12" column="0" lean-forward="true" selection-start-line="12" selection-start-column="0" selection-end-line="12" selection-end-column="0" />
398
-          <folding />
399
-        </state>
400
-      </provider>
401
-    </entry>
402 603
     <entry file="file://$PROJECT_DIR$/Checkbook/src/main/java/Checkbook.java">
403 604
       <provider selected="true" editor-type-id="text-editor">
404
-        <state relative-caret-position="51">
405
-          <caret line="3" column="0" lean-forward="false" selection-start-line="3" selection-start-column="0" selection-end-line="3" selection-end-column="0" />
406
-          <folding />
605
+        <state relative-caret-position="1215">
606
+          <caret line="81" column="4" selection-start-line="81" selection-start-column="4" selection-end-line="81" selection-end-column="4" />
607
+          <folding>
608
+            <element signature="imports" expanded="true" />
609
+            <element signature="e#185#186#0" expanded="true" />
610
+            <element signature="e#239#240#0" expanded="true" />
611
+            <element signature="e#141#142#0" expanded="true" />
612
+            <element signature="e#170#171#0" expanded="true" />
613
+            <element signature="e#205#206#0" expanded="true" />
614
+            <element signature="e#234#235#0" expanded="true" />
615
+            <element signature="e#296#297#0" expanded="true" />
616
+            <element signature="e#318#319#0" expanded="true" />
617
+            <element signature="e#394#395#0" expanded="true" />
618
+            <element signature="e#416#417#0" expanded="true" />
619
+            <element signature="e#668#669#0" expanded="true" />
620
+            <element signature="e#698#699#0" expanded="true" />
621
+            <element signature="e#780#781#0" expanded="true" />
622
+            <element signature="e#817#818#0" expanded="true" />
623
+          </folding>
407 624
         </state>
408 625
       </provider>
409 626
     </entry>
410
-    <entry file="file://$PROJECT_DIR$/Checkbook/pom.xml">
627
+    <entry file="file://$PROJECT_DIR$/Checkbook/src/test/java/CheckbookTest.java">
411 628
       <provider selected="true" editor-type-id="text-editor">
412
-        <state relative-caret-position="0">
413
-          <caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
414
-          <folding />
415
-        </state>
416
-      </provider>
417
-    </entry>
418
-    <entry file="file://$PROJECT_DIR$/README.md">
419
-      <provider selected="true" editor-type-id="split-provider[text-editor;markdown-preview-editor]">
420
-        <state split_layout="SPLIT">
421
-          <first_editor relative-caret-position="588">
422
-            <caret line="39" column="0" lean-forward="false" selection-start-line="39" selection-start-column="0" selection-end-line="39" selection-end-column="0" />
423
-            <folding />
424
-          </first_editor>
425
-          <second_editor />
629
+        <state relative-caret-position="2235">
630
+          <caret line="149" column="49" lean-forward="true" selection-start-line="149" selection-start-column="49" selection-end-line="149" selection-end-column="49" />
631
+          <folding>
632
+            <element signature="imports" expanded="true" />
633
+            <element signature="e#1385#1386#0" expanded="true" />
634
+            <element signature="e#1406#1407#0" expanded="true" />
635
+            <element signature="e#2852#2853#0" expanded="true" />
636
+            <element signature="e#2932#2933#0" expanded="true" />
637
+          </folding>
426 638
         </state>
427 639
       </provider>
428 640
     </entry>

+ 84
- 1
Checkbook/src/main/java/Checkbook.java 查看文件

@@ -1,5 +1,88 @@
1
+import java.time.LocalDate;
2
+import java.util.ArrayList;
3
+import java.util.Arrays;
4
+import java.util.Iterator;
5
+
1 6
 public class Checkbook {
2 7
 
3
-    //blind us with your Java eloquence....
8
+private ArrayList<Transaction> transactionList = new ArrayList<>();
9
+
10
+    public Checkbook(){}
11
+
12
+    public Checkbook(ArrayList<Transaction> transactionList) {
13
+        this.transactionList = transactionList;
14
+    }
15
+
16
+    public int size(){
17
+    return transactionList.size();
18
+    }
19
+
20
+    public boolean isEmpty(){
21
+    return transactionList.isEmpty();
22
+    }
23
+
24
+    public boolean contains(Transaction transaction){
25
+    return transactionList.contains(transaction);
26
+    }
27
+
28
+    public boolean add(Transaction transaction){
29
+    return transactionList.add(transaction);
30
+    }
31
+
32
+    public void remove(Transaction transaction) {
33
+        transactionList.remove(transaction);
34
+    }
35
+
36
+    public Iterator iterator() {
37
+        return transactionList.iterator();
38
+    }
39
+
40
+    public Transaction[] toArray() {
41
+        Transaction[] arr = transactionList.toArray(new Transaction[0]);
42
+        return arr;
43
+    }
44
+
45
+    public Transaction[] toArray(Transaction[] input) {
46
+        Transaction[] arr = transactionList.toArray(input);
47
+        return arr;
48
+    }
49
+
50
+    public double checkbookValue() {
51
+        double result = 0.0;
52
+        for (Transaction t: transactionList ){
53
+            result += t.getAmount();
54
+        }
55
+        return result;
56
+    }
57
+
58
+    public Transaction getTransactionsForDate(LocalDate date) {
59
+        for (Transaction t: transactionList) {
60
+            if(t.getDate()==date) return t;
61
+        }
62
+        return null;
63
+    }
64
+
65
+    public Transaction[] getTransactionsForPayee(Payee payee) {
66
+        ArrayList<Transaction> list = new ArrayList<>();
67
+        for (Transaction t: transactionList) {
68
+            if(t.getPayee()==payee) list.add(t);
69
+        }
70
+        return list.toArray(new Transaction[0]);
71
+    }
72
+
73
+    public Transaction[] getAllDebit() {
74
+        ArrayList<Transaction> list = new ArrayList<>();
75
+        for (Transaction t: transactionList) {
76
+            if(t.getType()==TransactionType.DEBIT) list.add(t);
77
+        }
78
+        return list.toArray(new Transaction[0]);
79
+    }
4 80
 
81
+    public Transaction[] getAllCredit() {
82
+        ArrayList<Transaction> list = new ArrayList<>();
83
+        for (Transaction t: transactionList) {
84
+            if(t.getType()==TransactionType.DEBIT) list.add(t);
85
+        }
86
+        return list.toArray(new Transaction[0]);
87
+    }
5 88
 }

+ 142
- 0
Checkbook/src/test/java/CheckbookTest.java 查看文件

@@ -1,12 +1,154 @@
1
+import org.junit.Assert;
2
+import org.junit.Test;
3
+
4
+import java.util.ArrayList;
5
+import java.util.Iterator;
6
+
1 7
 import static org.junit.Assert.*;
2 8
 
3 9
 public class CheckbookTest {
4 10
 
11
+    Checkbook checkbook;
12
+    Checkbook checkbook2;
13
+    ArrayList<Transaction> list;
14
+    Transaction transaction = new Transaction("",new Payee(), TransactionType.DEBIT,1.50);
15
+    Transaction transaction2 =new Transaction("test", new Payee(), TransactionType.CREDIT, 50.50);
16
+    Checkbook checkbookOneParam,
17
+
5 18
     @org.junit.Before
6 19
     public void setUp() throws Exception {
20
+        list = new ArrayList<>();
21
+        list.add(transaction);
22
+        list.add(transaction2);
23
+        checkbook = new Checkbook(list);
24
+        checkbook2 = new Checkbook();
7 25
     }
8 26
 
9 27
     @org.junit.After
10 28
     public void tearDown() throws Exception {
11 29
     }
30
+
31
+    @Test
32
+    public void add1Test(){
33
+    Transaction toAdd = new Transaction("addThis", new Payee(), TransactionType.DEBIT, 40.5);
34
+    checkbook.add(toAdd);
35
+    Assert.assertEquals(3,checkbook.size());
36
+    }
37
+
38
+    @Test
39
+    public void add2Test(){
40
+        Transaction toAdd = new Transaction("addThis", new Payee(), TransactionType.DEBIT, 40.5);
41
+        checkbook.add(toAdd);
42
+        Assert.assertTrue(checkbook.contains(toAdd));
43
+    }
44
+
45
+    @Test
46
+    public void add3Test(){
47
+        Transaction toAdd = new Transaction("addThis", new Payee(), TransactionType.DEBIT, 40.5);
48
+        checkbook2.add(toAdd);
49
+        Assert.assertFalse(checkbook2.isEmpty());
50
+    }
51
+
52
+    @Test
53
+    public void emptytest(){
54
+        Assert.assertTrue(checkbook2.isEmpty());
55
+    }
56
+
57
+    @Test
58
+    public void remove1Test(){
59
+        checkbook.remove(transaction);
60
+        Assert.assertEquals(1,checkbook.size());
61
+    }
62
+
63
+    @Test
64
+    public void remove2Test(){
65
+        checkbook.remove(transaction);
66
+        Assert.assertFalse(checkbook.contains(transaction));
67
+    }
68
+
69
+    @Test
70
+    public void remove3Test(){
71
+        checkbook2.add(new Transaction("", new Payee(), TransactionType.DEBIT,2.00));
72
+        checkbook2.remove(transaction);
73
+        Assert.assertFalse(checkbook2.contains(transaction));
74
+    }
75
+
76
+    @Test
77
+    public void iterator1Test(){
78
+        Iterator actual = checkbook.iterator();
79
+        Assert.assertEquals(list.iterator().getClass(), actual.getClass());
80
+    }
81
+
82
+    @Test
83
+    public void iterator2test(){
84
+        Iterator actual = checkbook.iterator();
85
+        Assert.assertTrue(actual.hasNext());
86
+    }
87
+
88
+    @Test
89
+    public void iterator3test(){
90
+        Iterator actual = checkbook.iterator();
91
+        Assert.assertEquals(transaction,actual.next());
92
+    }
93
+
94
+    @Test
95
+    public void toArray1test(){
96
+        Transaction[] actual = checkbook.toArray();
97
+        Assert.assertEquals(Transaction[].class, actual.getClass());
98
+    }
99
+
100
+    @Test
101
+    public void toArray2test(){
102
+        Transaction[] actual = checkbook2.toArray();
103
+        Assert.assertEquals(Transaction[].class, actual.getClass());
104
+    }
105
+
106
+    @Test
107
+    public void toArray3test(){
108
+        Assert.assertNotSame(Transaction[].class, checkbook2.getClass());
109
+    }
110
+
111
+    @Test
112
+    public void toArrayparam1test(){
113
+        Transaction[] arr = new Transaction[0];
114
+        Transaction[] actual = checkbook.toArray(arr);
115
+        Assert.assertEquals(Transaction[].class, actual.getClass());
116
+    }
117
+
118
+    @Test
119
+    public void toArrayparam2test(){
120
+        Transaction[] arr = new Transaction[0];
121
+        Transaction[] actual = checkbook2.toArray(arr);
122
+        Assert.assertEquals(Transaction[].class, actual.getClass());
123
+    }
124
+
125
+    @Test
126
+    public void checkbookValue(){
127
+       double actual = checkbook.checkbookValue();
128
+    Assert.assertEquals(-52.0, actual);
129
+    }
130
+
131
+    @Test
132
+    public void getTransactionsForDateTest(){
133
+        Assert.assertEquals(checkbook.getTransactionsForDate(transaction.getDate()),transaction);
134
+    }
135
+
136
+    @Test
137
+    public void getTransactionForPayeeTest(){
138
+        Transaction [] arr = new Transaction[]{transaction};
139
+        Assert.assertEquals(arr, checkbook.getTransactionsForPayee(transaction.getPayee()));
140
+    }
141
+
142
+    @Test
143
+    public void getAllDebitTest(){
144
+        Transaction [] arr = new Transaction[]{transaction};
145
+        Assert.assertEquals(arr, checkbook.getAllDebit());
146
+    }
147
+
148
+    @Test
149
+    public void getAllCreditTest(){
150
+        Transaction [] arr = new Transaction[]{transaction2};
151
+        Assert.assertEquals(arr, checkbook.getAllCredit());
152
+    }
153
+
12 154
 }