#14 rcchung

Open
rcchung wants to merge 1 commits from rcchung/ZCW-Lambdas:master into master

+ 6
- 0
.idea/misc.xml View File

@@ -0,0 +1,6 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<project version="4">
3
+  <component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="1.8" project-jdk-type="JavaSDK">
4
+    <output url="file://$PROJECT_DIR$/out" />
5
+  </component>
6
+</project>

+ 8
- 0
.idea/modules.xml View File

@@ -0,0 +1,8 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<project version="4">
3
+  <component name="ProjectModuleManager">
4
+    <modules>
5
+      <module fileurl="file://$PROJECT_DIR$/src/ZCW-Lambdas.iml" filepath="$PROJECT_DIR$/src/ZCW-Lambdas.iml" />
6
+    </modules>
7
+  </component>
8
+</project>

+ 406
- 0
.idea/workspace.xml View File

@@ -0,0 +1,406 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<project version="4">
3
+  <component name="ChangeListManager">
4
+    <list default="true" id="b6decf93-79c7-44f4-ac2c-179ca6ccbbf9" name="Default" comment="" />
5
+    <ignored path="$PROJECT_DIR$/out/" />
6
+    <option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
7
+    <option name="TRACKING_ENABLED" value="true" />
8
+    <option name="SHOW_DIALOG" value="false" />
9
+    <option name="HIGHLIGHT_CONFLICTS" value="true" />
10
+    <option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
11
+    <option name="LAST_RESOLUTION" value="IGNORE" />
12
+  </component>
13
+  <component name="FileEditorManager">
14
+    <splitter split-orientation="horizontal" split-proportion="0.5">
15
+      <split-first>
16
+        <leaf>
17
+          <file leaf-file-name="Person.java" pinned="false" current-in-tab="true">
18
+            <entry file="file://$PROJECT_DIR$/src/main/Person.java">
19
+              <provider selected="true" editor-type-id="text-editor">
20
+                <state relative-caret-position="1335">
21
+                  <caret line="93" column="15" selection-start-line="93" selection-start-column="15" selection-end-line="93" selection-end-column="15" />
22
+                </state>
23
+              </provider>
24
+            </entry>
25
+          </file>
26
+          <file leaf-file-name="PersonTest.java" pinned="false" current-in-tab="false">
27
+            <entry file="file://$PROJECT_DIR$/src/test/PersonTest.java">
28
+              <provider selected="true" editor-type-id="text-editor">
29
+                <state relative-caret-position="30">
30
+                  <caret line="7" column="24" selection-start-line="7" selection-start-column="24" selection-end-line="7" selection-end-column="24" />
31
+                </state>
32
+              </provider>
33
+            </entry>
34
+          </file>
35
+        </leaf>
36
+      </split-first>
37
+      <split-second>
38
+        <leaf>
39
+          <file leaf-file-name="PersonTest.java" pinned="false" current-in-tab="true">
40
+            <entry file="file://$PROJECT_DIR$/src/test/PersonTest.java">
41
+              <provider selected="true" editor-type-id="text-editor">
42
+                <state relative-caret-position="1440">
43
+                  <caret line="96" column="31" selection-start-line="96" selection-start-column="31" selection-end-line="96" selection-end-column="31" />
44
+                  <folding>
45
+                    <element signature="imports" expanded="true" />
46
+                  </folding>
47
+                </state>
48
+              </provider>
49
+            </entry>
50
+          </file>
51
+        </leaf>
52
+      </split-second>
53
+    </splitter>
54
+  </component>
55
+  <component name="FindInProjectRecents">
56
+    <findStrings>
57
+      <find>roster</find>
58
+    </findStrings>
59
+  </component>
60
+  <component name="IdeDocumentHistory">
61
+    <option name="CHANGED_PATHS">
62
+      <list>
63
+        <option value="$PROJECT_DIR$/src/main/Person.java" />
64
+        <option value="$PROJECT_DIR$/src/test/PersonTest.java" />
65
+      </list>
66
+    </option>
67
+  </component>
68
+  <component name="JsBuildToolGruntFileManager" detection-done="true" sorting="DEFINITION_ORDER" />
69
+  <component name="JsBuildToolPackageJson" detection-done="true" sorting="DEFINITION_ORDER" />
70
+  <component name="JsGulpfileManager">
71
+    <detection-done>true</detection-done>
72
+    <sorting>DEFINITION_ORDER</sorting>
73
+  </component>
74
+  <component name="NodePackageJsonFileManager">
75
+    <packageJsonPaths />
76
+  </component>
77
+  <component name="ProjectFrameBounds">
78
+    <option name="x" value="-319" />
79
+    <option name="y" value="-1057" />
80
+    <option name="width" value="1920" />
81
+    <option name="height" value="1057" />
82
+  </component>
83
+  <component name="ProjectView">
84
+    <navigator proportions="" version="1">
85
+      <foldersAlwaysOnTop value="true" />
86
+    </navigator>
87
+    <panes>
88
+      <pane id="Scope" />
89
+      <pane id="AndroidView" />
90
+      <pane id="ProjectPane">
91
+        <subPane>
92
+          <expand>
93
+            <path>
94
+              <item name="ZCW-Lambdas" type="b2602c69:ProjectViewProjectNode" />
95
+              <item name="src" type="462c0819:PsiDirectoryNode" />
96
+            </path>
97
+            <path>
98
+              <item name="ZCW-Lambdas" type="b2602c69:ProjectViewProjectNode" />
99
+              <item name="src" type="462c0819:PsiDirectoryNode" />
100
+              <item name="main" type="462c0819:PsiDirectoryNode" />
101
+            </path>
102
+            <path>
103
+              <item name="ZCW-Lambdas" type="b2602c69:ProjectViewProjectNode" />
104
+              <item name="src" type="462c0819:PsiDirectoryNode" />
105
+              <item name="test" type="462c0819:PsiDirectoryNode" />
106
+            </path>
107
+          </expand>
108
+          <select />
109
+        </subPane>
110
+      </pane>
111
+      <pane id="PackagesPane" />
112
+    </panes>
113
+  </component>
114
+  <component name="PropertiesComponent">
115
+    <property name="WebServerToolWindowFactoryState" value="false" />
116
+    <property name="aspect.path.notification.shown" value="true" />
117
+    <property name="nodejs_interpreter_path.stuck_in_default_project" value="undefined stuck path" />
118
+    <property name="nodejs_npm_path_reset_for_default_project" value="true" />
119
+    <property name="settings.editor.selected.configurable" value="configurable.group.appearance" />
120
+  </component>
121
+  <component name="RunDashboard">
122
+    <option name="ruleStates">
123
+      <list>
124
+        <RuleState>
125
+          <option name="name" value="ConfigurationTypeDashboardGroupingRule" />
126
+        </RuleState>
127
+        <RuleState>
128
+          <option name="name" value="StatusDashboardGroupingRule" />
129
+        </RuleState>
130
+      </list>
131
+    </option>
132
+  </component>
133
+  <component name="RunManager" selected="JUnit.PersonTest">
134
+    <configuration default="true" type="Application" factoryName="Application">
135
+      <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
136
+    </configuration>
137
+    <configuration name="PersonTest" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
138
+      <module name="ZCW-Lambdas" />
139
+      <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
140
+      <option name="ALTERNATIVE_JRE_PATH" />
141
+      <option name="PACKAGE_NAME" value="" />
142
+      <option name="MAIN_CLASS_NAME" value="PersonTest" />
143
+      <option name="METHOD_NAME" />
144
+      <option name="TEST_OBJECT" value="class" />
145
+      <option name="VM_PARAMETERS" value="-ea" />
146
+      <option name="PARAMETERS" />
147
+      <option name="WORKING_DIRECTORY" value="%MODULE_WORKING_DIR%" />
148
+      <option name="PASS_PARENT_ENVS" value="true" />
149
+      <option name="TEST_SEARCH_SCOPE">
150
+        <value defaultName="singleModule" />
151
+      </option>
152
+      <patterns />
153
+    </configuration>
154
+    <configuration name="PersonTest.printPersonsEligibleForSelectiveServiceAnonymousClass" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
155
+      <module name="ZCW-Lambdas" />
156
+      <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
157
+      <option name="ALTERNATIVE_JRE_PATH" />
158
+      <option name="PACKAGE_NAME" value="" />
159
+      <option name="MAIN_CLASS_NAME" value="PersonTest" />
160
+      <option name="METHOD_NAME" value="printPersonsEligibleForSelectiveServiceAnonymousClass" />
161
+      <option name="TEST_OBJECT" value="method" />
162
+      <option name="VM_PARAMETERS" value="-ea" />
163
+      <option name="PARAMETERS" />
164
+      <option name="WORKING_DIRECTORY" value="%MODULE_WORKING_DIR%" />
165
+      <option name="PASS_PARENT_ENVS" value="true" />
166
+      <option name="TEST_SEARCH_SCOPE">
167
+        <value defaultName="singleModule" />
168
+      </option>
169
+      <patterns />
170
+    </configuration>
171
+    <configuration name="PersonTest.printPersonsEligibleForSelectiveServiceLambda" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
172
+      <module name="ZCW-Lambdas" />
173
+      <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
174
+      <option name="ALTERNATIVE_JRE_PATH" />
175
+      <option name="PACKAGE_NAME" value="" />
176
+      <option name="MAIN_CLASS_NAME" value="PersonTest" />
177
+      <option name="METHOD_NAME" value="printPersonsEligibleForSelectiveServiceLambda" />
178
+      <option name="TEST_OBJECT" value="method" />
179
+      <option name="VM_PARAMETERS" value="-ea" />
180
+      <option name="PARAMETERS" />
181
+      <option name="WORKING_DIRECTORY" value="%MODULE_WORKING_DIR%" />
182
+      <option name="PASS_PARENT_ENVS" value="true" />
183
+      <option name="TEST_SEARCH_SCOPE">
184
+        <value defaultName="singleModule" />
185
+      </option>
186
+      <patterns />
187
+    </configuration>
188
+    <configuration name="PersonTest.printPersonsEligibleForSelectiveServiceLocalClass" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
189
+      <module name="ZCW-Lambdas" />
190
+      <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
191
+      <option name="ALTERNATIVE_JRE_PATH" />
192
+      <option name="PACKAGE_NAME" value="" />
193
+      <option name="MAIN_CLASS_NAME" value="PersonTest" />
194
+      <option name="METHOD_NAME" value="printPersonsEligibleForSelectiveServiceLocalClass" />
195
+      <option name="TEST_OBJECT" value="method" />
196
+      <option name="VM_PARAMETERS" value="-ea" />
197
+      <option name="PARAMETERS" />
198
+      <option name="WORKING_DIRECTORY" value="%MODULE_WORKING_DIR%" />
199
+      <option name="PASS_PARENT_ENVS" value="true" />
200
+      <option name="TEST_SEARCH_SCOPE">
201
+        <value defaultName="singleModule" />
202
+      </option>
203
+      <patterns />
204
+    </configuration>
205
+    <configuration name="PersonTest.printPersonsWithinAgeRangeTest" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
206
+      <module name="ZCW-Lambdas" />
207
+      <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
208
+      <option name="ALTERNATIVE_JRE_PATH" />
209
+      <option name="PACKAGE_NAME" value="" />
210
+      <option name="MAIN_CLASS_NAME" value="PersonTest" />
211
+      <option name="METHOD_NAME" value="printPersonsWithinAgeRangeTest" />
212
+      <option name="TEST_OBJECT" value="method" />
213
+      <option name="VM_PARAMETERS" value="-ea" />
214
+      <option name="PARAMETERS" />
215
+      <option name="WORKING_DIRECTORY" value="%MODULE_WORKING_DIR%" />
216
+      <option name="PASS_PARENT_ENVS" value="true" />
217
+      <option name="TEST_SEARCH_SCOPE">
218
+        <value defaultName="singleModule" />
219
+      </option>
220
+      <patterns />
221
+    </configuration>
222
+    <configuration default="true" type="JUnit" factoryName="JUnit">
223
+      <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
224
+      <option name="ALTERNATIVE_JRE_PATH" />
225
+      <option name="PACKAGE_NAME" />
226
+      <option name="MAIN_CLASS_NAME" />
227
+      <option name="METHOD_NAME" />
228
+      <option name="TEST_OBJECT" value="class" />
229
+      <option name="VM_PARAMETERS" value="-ea" />
230
+      <option name="PARAMETERS" />
231
+      <option name="WORKING_DIRECTORY" value="%MODULE_WORKING_DIR%" />
232
+      <option name="PASS_PARENT_ENVS" value="true" />
233
+      <option name="TEST_SEARCH_SCOPE">
234
+        <value defaultName="singleModule" />
235
+      </option>
236
+      <patterns />
237
+    </configuration>
238
+    <configuration default="true" type="TestNG" factoryName="TestNG">
239
+      <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
240
+      <option name="ALTERNATIVE_JRE_PATH" />
241
+      <option name="SUITE_NAME" />
242
+      <option name="PACKAGE_NAME" />
243
+      <option name="MAIN_CLASS_NAME" />
244
+      <option name="METHOD_NAME" />
245
+      <option name="GROUP_NAME" />
246
+      <option name="TEST_OBJECT" value="CLASS" />
247
+      <option name="VM_PARAMETERS" value="-ea" />
248
+      <option name="PARAMETERS" />
249
+      <option name="WORKING_DIRECTORY" value="%MODULE_WORKING_DIR%" />
250
+      <option name="OUTPUT_DIRECTORY" />
251
+      <option name="PASS_PARENT_ENVS" value="true" />
252
+      <option name="TEST_SEARCH_SCOPE">
253
+        <value defaultName="singleModule" />
254
+      </option>
255
+      <option name="USE_DEFAULT_REPORTERS" value="false" />
256
+      <option name="PROPERTIES_FILE" />
257
+      <properties />
258
+      <listeners />
259
+    </configuration>
260
+    <list>
261
+      <item itemvalue="JUnit.PersonTest.printPersonsWithinAgeRangeTest" />
262
+      <item itemvalue="JUnit.PersonTest.printPersonsEligibleForSelectiveServiceLocalClass" />
263
+      <item itemvalue="JUnit.PersonTest.printPersonsEligibleForSelectiveServiceAnonymousClass" />
264
+      <item itemvalue="JUnit.PersonTest.printPersonsEligibleForSelectiveServiceLambda" />
265
+      <item itemvalue="JUnit.PersonTest" />
266
+    </list>
267
+    <recent_temporary>
268
+      <list>
269
+        <item itemvalue="JUnit.PersonTest" />
270
+        <item itemvalue="JUnit.PersonTest.printPersonsEligibleForSelectiveServiceLambda" />
271
+        <item itemvalue="JUnit.PersonTest.printPersonsEligibleForSelectiveServiceAnonymousClass" />
272
+        <item itemvalue="JUnit.PersonTest.printPersonsEligibleForSelectiveServiceLocalClass" />
273
+        <item itemvalue="JUnit.PersonTest.printPersonsWithinAgeRangeTest" />
274
+      </list>
275
+    </recent_temporary>
276
+  </component>
277
+  <component name="SvnConfiguration">
278
+    <configuration />
279
+  </component>
280
+  <component name="TaskManager">
281
+    <task active="true" id="Default" summary="Default task">
282
+      <changelist id="b6decf93-79c7-44f4-ac2c-179ca6ccbbf9" name="Default" comment="" />
283
+      <created>1530298554480</created>
284
+      <option name="number" value="Default" />
285
+      <option name="presentableId" value="Default" />
286
+      <updated>1530298554480</updated>
287
+      <workItem from="1530298556046" duration="3240000" />
288
+    </task>
289
+    <servers />
290
+  </component>
291
+  <component name="TestHistory">
292
+    <history-entry file="PersonTest_printPersonsOlderThanTest - 2018.06.29 at 15h 40m 07s.xml">
293
+      <configuration name="PersonTest.printPersonsOlderThanTest" configurationId="JUnit" />
294
+    </history-entry>
295
+    <history-entry file="PersonTest_printPersonsOlderThanTest - 2018.06.29 at 15h 44m 45s.xml">
296
+      <configuration name="PersonTest.printPersonsOlderThanTest" configurationId="JUnit" />
297
+    </history-entry>
298
+    <history-entry file="PersonTest_printPersonsOlderThanTest - 2018.06.29 at 15h 46m 44s.xml">
299
+      <configuration name="PersonTest.printPersonsOlderThanTest" configurationId="JUnit" />
300
+    </history-entry>
301
+    <history-entry file="PersonTest_printPersonsOlderThanTest - 2018.06.29 at 15h 47m 52s.xml">
302
+      <configuration name="PersonTest.printPersonsOlderThanTest" configurationId="JUnit" />
303
+    </history-entry>
304
+    <history-entry file="PersonTest_printPersonsOlderThanTest - 2018.06.29 at 15h 49m 42s.xml">
305
+      <configuration name="PersonTest.printPersonsOlderThanTest" configurationId="JUnit" />
306
+    </history-entry>
307
+    <history-entry file="PersonTest_printPersonsWithinAgeRangeTest - 2018.06.29 at 15h 51m 36s.xml">
308
+      <configuration name="PersonTest.printPersonsWithinAgeRangeTest" configurationId="JUnit" />
309
+    </history-entry>
310
+    <history-entry file="PersonTest_printPersonsEligibleForSelectiveServiceLocalClass - 2018.06.29 at 15h 55m 26s.xml">
311
+      <configuration name="PersonTest.printPersonsEligibleForSelectiveServiceLocalClass" configurationId="JUnit" />
312
+    </history-entry>
313
+    <history-entry file="PersonTest_printPersonsEligibleForSelectiveServiceAnonymousClass - 2018.06.29 at 15h 56m 03s.xml">
314
+      <configuration name="PersonTest.printPersonsEligibleForSelectiveServiceAnonymousClass" configurationId="JUnit" />
315
+    </history-entry>
316
+    <history-entry file="PersonTest_printPersonsEligibleForSelectiveServiceLambda - 2018.06.29 at 15h 56m 27s.xml">
317
+      <configuration name="PersonTest.printPersonsEligibleForSelectiveServiceLambda" configurationId="JUnit" />
318
+    </history-entry>
319
+    <history-entry file="PersonTest - 2018.06.29 at 15h 57m 21s.xml">
320
+      <configuration name="PersonTest" configurationId="JUnit" />
321
+    </history-entry>
322
+  </component>
323
+  <component name="TimeTrackingManager">
324
+    <option name="totallyTimeSpent" value="3240000" />
325
+  </component>
326
+  <component name="ToolWindowManager">
327
+    <frame x="-319" y="-1057" width="1920" height="1057" extended-state="6" />
328
+    <editor active="true" />
329
+    <layout>
330
+      <window_info anchor="right" id="Palette" />
331
+      <window_info anchor="bottom" id="TODO" order="6" />
332
+      <window_info anchor="bottom" id="Messages" weight="0.32960325" />
333
+      <window_info anchor="right" id="Palette&#9;" />
334
+      <window_info id="Image Layers" />
335
+      <window_info anchor="right" id="Capture Analysis" />
336
+      <window_info anchor="bottom" id="Event Log" side_tool="true" />
337
+      <window_info anchor="right" id="Maven Projects" />
338
+      <window_info anchor="bottom" id="Database Changes" show_stripe_button="false" />
339
+      <window_info anchor="bottom" id="Run" order="2" weight="0.32960325" />
340
+      <window_info anchor="bottom" id="Version Control" show_stripe_button="false" />
341
+      <window_info anchor="bottom" id="Terminal" />
342
+      <window_info id="Capture Tool" />
343
+      <window_info id="Designer" />
344
+      <window_info content_ui="combo" id="Project" order="0" visible="true" weight="0.25" />
345
+      <window_info anchor="right" id="Database" />
346
+      <window_info id="Structure" order="1" side_tool="true" weight="0.25" />
347
+      <window_info anchor="right" id="Ant Build" order="1" weight="0.25" />
348
+      <window_info id="UI Designer" />
349
+      <window_info anchor="right" id="Theme Preview" />
350
+      <window_info anchor="bottom" id="Debug" order="3" weight="0.4" />
351
+      <window_info id="Favorites" side_tool="true" />
352
+      <window_info anchor="bottom" id="Find" order="1" />
353
+      <window_info anchor="right" id="Commander" internal_type="SLIDING" order="0" type="SLIDING" weight="0.4" />
354
+      <window_info anchor="right" content_ui="combo" id="Hierarchy" order="2" weight="0.25" />
355
+      <window_info anchor="bottom" id="Inspection" order="5" weight="0.4" />
356
+      <window_info anchor="bottom" id="Message" order="0" />
357
+      <window_info anchor="bottom" id="Cvs" order="4" weight="0.25" />
358
+    </layout>
359
+  </component>
360
+  <component name="TypeScriptGeneratedFilesManager">
361
+    <option name="version" value="1" />
362
+  </component>
363
+  <component name="VcsContentAnnotationSettings">
364
+    <option name="myLimit" value="2678400000" />
365
+  </component>
366
+  <component name="XDebuggerManager">
367
+    <breakpoint-manager>
368
+      <option name="time" value="3" />
369
+    </breakpoint-manager>
370
+  </component>
371
+  <component name="editorHistoryManager">
372
+    <entry file="file://$PROJECT_DIR$/src/main/Person.java">
373
+      <provider selected="true" editor-type-id="text-editor">
374
+        <state relative-caret-position="1335">
375
+          <caret line="93" column="15" selection-start-line="93" selection-start-column="15" selection-end-line="93" selection-end-column="15" />
376
+        </state>
377
+      </provider>
378
+    </entry>
379
+    <entry file="file://$PROJECT_DIR$/src/test/PersonTest.java">
380
+      <provider selected="true" editor-type-id="text-editor">
381
+        <state relative-caret-position="1440">
382
+          <caret line="96" column="31" selection-start-line="96" selection-start-column="31" selection-end-line="96" selection-end-column="31" />
383
+          <folding>
384
+            <element signature="imports" expanded="true" />
385
+          </folding>
386
+        </state>
387
+      </provider>
388
+    </entry>
389
+  </component>
390
+  <component name="masterDetails">
391
+    <states>
392
+      <state key="ProjectJDKs.UI">
393
+        <settings>
394
+          <last-edited>1.8</last-edited>
395
+          <splitter-proportions>
396
+            <option name="proportions">
397
+              <list>
398
+                <option value="0.2" />
399
+              </list>
400
+            </option>
401
+          </splitter-proportions>
402
+        </settings>
403
+      </state>
404
+    </states>
405
+  </component>
406
+</project>

BIN
out/production/ZCW-Lambdas/Person$1.class View File


BIN
out/production/ZCW-Lambdas/Person$1CheckPersonEligibleForSelectiveService.class View File


BIN
out/production/ZCW-Lambdas/Person$CheckPerson.class View File


BIN
out/production/ZCW-Lambdas/Person$Sex.class View File


BIN
out/production/ZCW-Lambdas/Person.class View File


BIN
out/test/ZCW-Lambdas/PersonTest.class View File


+ 22
- 0
src/ZCW-Lambdas.iml View File

@@ -0,0 +1,22 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<module type="JAVA_MODULE" version="4">
3
+  <component name="NewModuleRootManager" inherit-compiler-output="true">
4
+    <exclude-output />
5
+    <content url="file://$MODULE_DIR$">
6
+      <sourceFolder url="file://$MODULE_DIR$/main" isTestSource="false" />
7
+      <sourceFolder url="file://$MODULE_DIR$/test" isTestSource="true" />
8
+    </content>
9
+    <orderEntry type="inheritedJdk" />
10
+    <orderEntry type="sourceFolder" forTests="false" />
11
+    <orderEntry type="module-library" scope="TEST">
12
+      <library name="JUnit4">
13
+        <CLASSES>
14
+          <root url="jar://$APPLICATION_HOME_DIR$/lib/junit-4.12.jar!/" />
15
+          <root url="jar://$APPLICATION_HOME_DIR$/lib/hamcrest-core-1.3.jar!/" />
16
+        </CLASSES>
17
+        <JAVADOC />
18
+        <SOURCES />
19
+      </library>
20
+    </orderEntry>
21
+  </component>
22
+</module>

+ 102
- 0
src/main/Person.java View File

@@ -0,0 +1,102 @@
1
+import java.time.LocalDate;
2
+import java.time.LocalDateTime;
3
+import java.time.Period;
4
+import java.util.ArrayList;
5
+import java.util.List;
6
+
7
+public class Person {
8
+
9
+    public enum Sex {
10
+        MALE, FEMALE
11
+    }
12
+
13
+    String name;
14
+    LocalDate birthday;
15
+    Sex gender;
16
+    String emailAddress;
17
+
18
+    public Person(String name, LocalDate birthday, Sex gender, String emailAddress){
19
+        this.name = name;
20
+        this.birthday = birthday;
21
+        this.gender = gender;
22
+        this.emailAddress = emailAddress;
23
+    }
24
+
25
+    public int getAge() { return Period.between(birthday, LocalDate.now()).getYears();
26
+    }
27
+
28
+    public Sex getGender() {return this.gender;}
29
+
30
+    public String printPerson() {
31
+        return ("Name: " + name + "\nAge: " + getAge() + "\nGender: " + gender + "\nEmail: " + emailAddress);
32
+    }
33
+
34
+    public String printPersonsOlderThan(List<Person> people, int age) {
35
+        StringBuilder sb = new StringBuilder();
36
+        for (Person p : people) {
37
+            if (p.getAge() >= age) {
38
+                sb.append( p.printPerson() + "\n");
39
+            }
40
+        }
41
+        return sb.toString();
42
+    }
43
+
44
+    public String printPersonsWithinAgeRange(List<Person> people, int low, int high) {
45
+        StringBuilder sb = new StringBuilder();
46
+        for (Person p : people) {
47
+            if (low <= p.getAge() && p.getAge() < high) {
48
+                sb.append( p.printPerson() + "\n");
49
+            }
50
+        }
51
+        return sb.toString();
52
+    }
53
+
54
+    public String printPersons(List<Person> people, CheckPerson tester) {
55
+        StringBuilder sb = new StringBuilder();
56
+        for (Person p : people) {
57
+            if (tester.test(p)) {
58
+                sb.append( p.printPerson() + "\n");
59
+            }
60
+        }
61
+        return sb.toString();
62
+    }
63
+
64
+    interface CheckPerson {
65
+        boolean test(Person p);
66
+    }
67
+
68
+    public String printPersonsEligibleForSelectiveServiceLocalClass(List<Person> people) {
69
+
70
+        class CheckPersonEligibleForSelectiveService implements CheckPerson {
71
+            public boolean test(Person p) {
72
+                return p.gender == Person.Sex.MALE &&
73
+                        p.getAge() >= 18 &&
74
+                        p.getAge() <= 25;
75
+            }
76
+
77
+        }
78
+        return printPersons(people, new CheckPersonEligibleForSelectiveService());
79
+    }
80
+
81
+    public String printPersonsEligibleForSelectiveServiceAnonymousClass(List<Person> people) {
82
+        return printPersons(people,
83
+                new CheckPerson() {
84
+                    public boolean test(Person p) {
85
+                        return p.getGender() == Person.Sex.MALE
86
+                                && p.getAge() >= 18
87
+                                && p.getAge() <= 25;
88
+                    }
89
+                }
90
+        );
91
+    }
92
+
93
+    public String printPersonsEligibleForSelectiveServiceLambda(List<Person> people){
94
+        return printPersons(people,
95
+                (Person p) -> p.getGender() == Person.Sex.MALE
96
+                        && p.getAge() >= 18
97
+                        && p.getAge() <= 25
98
+        );
99
+    }
100
+
101
+
102
+}

+ 101
- 0
src/test/PersonTest.java View File

@@ -0,0 +1,101 @@
1
+import org.junit.Assert;
2
+import org.junit.Test;
3
+
4
+import java.time.LocalDate;
5
+import java.util.ArrayList;
6
+import java.util.List;
7
+
8
+public class PersonTest{
9
+
10
+    @Test
11
+    public void getAgeTest(){
12
+        Person person = new Person("John Jacob", LocalDate.of(1950,1,1), Person.Sex.MALE,"fake@email.com");
13
+
14
+        int expected = 68;
15
+
16
+        Assert.assertEquals(expected, person.getAge());
17
+    }
18
+
19
+    @Test
20
+    public void getGenderTest(){
21
+        Person person = new Person("John Jacob", LocalDate.of(1950,1,1), Person.Sex.MALE,"fake@email.com");
22
+
23
+        Person.Sex expected = Person.Sex.MALE;
24
+
25
+        Assert.assertEquals(expected, person.getGender());
26
+    }
27
+
28
+    @Test
29
+    public void printPersonTest(){
30
+        Person person = new Person("John Jacob", LocalDate.of(1950,1,1), Person.Sex.MALE,"fake@email.com");
31
+
32
+        String expected = "Name: John Jacob\nAge: 68\nGender: MALE\nEmail: fake@email.com";
33
+
34
+        Assert.assertTrue(expected.equals(person.printPerson()));
35
+    }
36
+
37
+    @Test
38
+    public void printPersonsOlderThanTest() {
39
+        Person person1 = new Person("John Jacob", LocalDate.of(1950, 1, 1), Person.Sex.MALE, "fake@email.com");
40
+        Person person2 = new Person("Jingleheimer Schmidt", LocalDate.of(1994, 1, 1), Person.Sex.MALE, "fake2@email.com");
41
+        List<Person> people = new ArrayList<>();
42
+        people.add(person1);
43
+        people.add(person2);
44
+
45
+        String expected = "Name: John Jacob\nAge: 68\nGender: MALE\nEmail: fake@email.com\n";
46
+
47
+        Assert.assertTrue(expected.equals(person1.printPersonsOlderThan(people, 30)));
48
+    }
49
+
50
+    @Test
51
+    public void printPersonsWithinAgeRangeTest() {
52
+        Person person1 = new Person("John Jacob", LocalDate.of(1950, 1, 1), Person.Sex.MALE, "fake@email.com");
53
+        Person person2 = new Person("Jingleheimer Schmidt", LocalDate.of(1994, 1, 1), Person.Sex.MALE, "fake2@email.com");
54
+        List<Person> people = new ArrayList<>();
55
+        people.add(person1);
56
+        people.add(person2);
57
+
58
+        String expected = "Name: John Jacob\nAge: 68\nGender: MALE\nEmail: fake@email.com\n";
59
+
60
+        Assert.assertTrue(expected.equals(person1.printPersonsWithinAgeRange(people, 30,  70)));
61
+    }
62
+
63
+    @Test
64
+    public void printPersonsEligibleForSelectiveServiceLocalClass(){
65
+        Person person1 = new Person("John Jacob", LocalDate.of(1950, 1, 1), Person.Sex.MALE, "fake@email.com");
66
+        Person person2 = new Person("Jingleheimer Schmidt", LocalDate.of(1994, 1, 1), Person.Sex.MALE, "fake2@email.com");
67
+        List<Person> people = new ArrayList<>();
68
+        people.add(person1);
69
+        people.add(person2);
70
+
71
+        String expected = "Name: Jingleheimer Schmidt\nAge: 24\nGender: MALE\nEmail: fake2@email.com\n";
72
+
73
+        Assert.assertTrue(expected.equals(person1.printPersonsEligibleForSelectiveServiceLocalClass(people)));
74
+    }
75
+
76
+    @Test
77
+    public void printPersonsEligibleForSelectiveServiceAnonymousClass(){
78
+        Person person1 = new Person("John Jacob", LocalDate.of(1950, 1, 1), Person.Sex.MALE, "fake@email.com");
79
+        Person person2 = new Person("Jingleheimer Schmidt", LocalDate.of(1994, 1, 1), Person.Sex.MALE, "fake2@email.com");
80
+        List<Person> people = new ArrayList<>();
81
+        people.add(person1);
82
+        people.add(person2);
83
+
84
+        String expected = "Name: Jingleheimer Schmidt\nAge: 24\nGender: MALE\nEmail: fake2@email.com\n";
85
+
86
+        Assert.assertTrue(expected.equals(person1.printPersonsEligibleForSelectiveServiceAnonymousClass(people)));
87
+    }
88
+
89
+    @Test
90
+    public void printPersonsEligibleForSelectiveServiceLambda(){
91
+        Person person1 = new Person("John Jacob", LocalDate.of(1950, 1, 1), Person.Sex.MALE, "fake@email.com");
92
+        Person person2 = new Person("Jingleheimer Schmidt", LocalDate.of(1994, 1, 1), Person.Sex.MALE, "fake2@email.com");
93
+        List<Person> people = new ArrayList<>();
94
+        people.add(person1);
95
+        people.add(person2);
96
+
97
+        String expected = "Name: Jingleheimer Schmidt\nAge: 24\nGender: MALE\nEmail: fake2@email.com\n";
98
+
99
+        Assert.assertTrue(expected.equals(person1.printPersonsEligibleForSelectiveServiceLambda(people)));
100
+    }
101
+}