Przeglądaj źródła

Refactored for use with MockDao

Nick Satinover 6 lat temu
rodzic
commit
5a06593bde

+ 1
- 1
.idea/compiler.xml Wyświetl plik

@@ -10,7 +10,7 @@
10 10
       </profile>
11 11
     </annotationProcessing>
12 12
     <bytecodeTargetLevel>
13
-      <module name="ZCW-ORM-SimpleAccount" target="1.5" />
13
+      <module name="ZCW-ORM-SimpleAccount" target="8" />
14 14
     </bytecodeTargetLevel>
15 15
   </component>
16 16
 </project>

+ 230
- 84
.idea/workspace.xml Wyświetl plik

@@ -2,14 +2,14 @@
2 2
 <project version="4">
3 3
   <component name="ChangeListManager">
4 4
     <list default="true" id="a5077242-19cb-4de8-ab86-b2f20184190b" name="Default Changelist" comment="">
5
-      <change afterPath="$PROJECT_DIR$/.idea/libraries/Maven__junit_junit_4_12.xml" afterDir="false" />
6
-      <change afterPath="$PROJECT_DIR$/.idea/libraries/Maven__org_hamcrest_hamcrest_core_1_3.xml" afterDir="false" />
7
-      <change beforePath="$PROJECT_DIR$/.idea/uiDesigner.xml" beforeDir="false" />
8 5
       <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
6
+      <change beforePath="$PROJECT_DIR$/pom.xml" beforeDir="false" afterPath="$PROJECT_DIR$/pom.xml" afterDir="false" />
9 7
       <change beforePath="$PROJECT_DIR$/src/main/java/AccountApp.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/AccountApp.java" afterDir="false" />
10
-      <change beforePath="$PROJECT_DIR$/src/main/java/AccountService.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/AccountService.java" afterDir="false" />
11 8
       <change beforePath="$PROJECT_DIR$/src/main/java/MockDao.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/MockDao.java" afterDir="false" />
12 9
       <change beforePath="$PROJECT_DIR$/src/test/java/AccountServiceTest.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/test/java/AccountServiceTest.java" afterDir="false" />
10
+      <change beforePath="$PROJECT_DIR$/target/classes/AccountApp.class" beforeDir="false" afterPath="$PROJECT_DIR$/target/classes/AccountApp.class" afterDir="false" />
11
+      <change beforePath="$PROJECT_DIR$/target/classes/AccountService.class" beforeDir="false" afterPath="$PROJECT_DIR$/target/classes/AccountService.class" afterDir="false" />
12
+      <change beforePath="$PROJECT_DIR$/target/classes/MockDao.class" beforeDir="false" />
13 13
     </list>
14 14
     <ignored path="$PROJECT_DIR$/target/" />
15 15
     <option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
@@ -18,6 +18,28 @@
18 18
     <option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
19 19
     <option name="LAST_RESOLUTION" value="IGNORE" />
20 20
   </component>
21
+  <component name="DockManager">
22
+    <window id="1">
23
+      <content type="file-editors">
24
+        <state>
25
+          <leaf>
26
+            <file pinned="false" current-in-tab="true">
27
+              <entry file="file://$PROJECT_DIR$/src/test/java/AccountServiceTest.java">
28
+                <provider selected="true" editor-type-id="text-editor">
29
+                  <state relative-caret-position="375">
30
+                    <caret line="25" column="48" selection-start-line="25" selection-start-column="48" selection-end-line="25" selection-end-column="48" />
31
+                    <folding>
32
+                      <element signature="imports" expanded="true" />
33
+                    </folding>
34
+                  </state>
35
+                </provider>
36
+              </entry>
37
+            </file>
38
+          </leaf>
39
+        </state>
40
+      </content>
41
+    </window>
42
+  </component>
21 43
   <component name="FUSProjectUsageTrigger">
22 44
     <session id="-448911281">
23 45
       <usages-collector id="statistics.lifecycle.project">
@@ -28,37 +50,43 @@
28 50
       </usages-collector>
29 51
       <usages-collector id="statistics.file.extensions.open">
30 52
         <counts>
31
-          <entry key="class" value="2" />
32
-          <entry key="java" value="11" />
53
+          <entry key="class" value="7" />
54
+          <entry key="iml" value="1" />
55
+          <entry key="java" value="19" />
56
+          <entry key="xml" value="2" />
33 57
         </counts>
34 58
       </usages-collector>
35 59
       <usages-collector id="statistics.file.types.open">
36 60
         <counts>
37
-          <entry key="CLASS" value="2" />
38
-          <entry key="JAVA" value="11" />
61
+          <entry key="CLASS" value="7" />
62
+          <entry key="IDEA_MODULE" value="1" />
63
+          <entry key="JAVA" value="19" />
64
+          <entry key="XML" value="2" />
39 65
         </counts>
40 66
       </usages-collector>
41 67
       <usages-collector id="statistics.file.extensions.edit">
42 68
         <counts>
43
-          <entry key="java" value="188" />
69
+          <entry key="java" value="836" />
70
+          <entry key="txt" value="34" />
44 71
         </counts>
45 72
       </usages-collector>
46 73
       <usages-collector id="statistics.file.types.edit">
47 74
         <counts>
48
-          <entry key="JAVA" value="188" />
75
+          <entry key="JAVA" value="836" />
76
+          <entry key="PLAIN_TEXT" value="34" />
49 77
         </counts>
50 78
       </usages-collector>
51 79
     </session>
52 80
   </component>
53 81
   <component name="FileEditorManager">
54
-    <splitter split-orientation="horizontal" split-proportion="0.4789984">
82
+    <splitter split-orientation="horizontal" split-proportion="0.5111821">
55 83
       <split-first>
56 84
         <leaf>
57
-          <file pinned="false" current-in-tab="true">
85
+          <file pinned="false" current-in-tab="false">
58 86
             <entry file="file://$PROJECT_DIR$/src/main/java/AccountApp.java">
59 87
               <provider selected="true" editor-type-id="text-editor">
60
-                <state relative-caret-position="1290">
61
-                  <caret line="93" column="8" selection-start-line="93" selection-start-column="8" selection-end-line="93" selection-end-column="8" />
88
+                <state relative-caret-position="1065">
89
+                  <caret line="78" column="45" selection-start-line="78" selection-start-column="45" selection-end-line="78" selection-end-column="45" />
62 90
                   <folding>
63 91
                     <element signature="e#761#762#0" expanded="true" />
64 92
                     <element signature="e#800#801#0" expanded="true" />
@@ -69,38 +97,23 @@
69 97
               </provider>
70 98
             </entry>
71 99
           </file>
72
-          <file pinned="false" current-in-tab="false">
73
-            <entry file="file://$PROJECT_DIR$/src/test/java/AccountServiceTest.java">
74
-              <provider selected="true" editor-type-id="text-editor">
75
-                <state relative-caret-position="165">
76
-                  <caret line="12" lean-forward="true" selection-start-line="12" selection-end-line="12" />
77
-                </state>
78
-              </provider>
79
-            </entry>
80
-          </file>
81
-          <file pinned="false" current-in-tab="false">
100
+          <file pinned="false" current-in-tab="true">
82 101
             <entry file="file://$PROJECT_DIR$/src/main/java/MockDao.java">
83 102
               <provider selected="true" editor-type-id="text-editor">
84
-                <state relative-caret-position="90">
85
-                  <caret line="19" lean-forward="true" selection-start-line="19" selection-end-line="19" />
86
-                </state>
87
-              </provider>
88
-            </entry>
89
-          </file>
90
-          <file pinned="false" current-in-tab="false">
91
-            <entry file="file://$PROJECT_DIR$/src/main/java/AccountService.java">
92
-              <provider selected="true" editor-type-id="text-editor">
93
-                <state relative-caret-position="30">
94
-                  <caret line="12" column="28" selection-start-line="12" selection-start-column="28" selection-end-line="12" selection-end-column="28" />
103
+                <state relative-caret-position="765">
104
+                  <caret line="69" column="26" selection-start-line="69" selection-start-column="26" selection-end-line="69" selection-end-column="26" />
105
+                  <folding>
106
+                    <element signature="imports" expanded="true" />
107
+                  </folding>
95 108
                 </state>
96 109
               </provider>
97 110
             </entry>
98 111
           </file>
99 112
           <file pinned="false" current-in-tab="false">
100
-            <entry file="file://$PROJECT_DIR$/src/main/java/Console.java">
113
+            <entry file="jar:///Library/Java/JavaVirtualMachines/jdk1.8.0_191.jdk/Contents/Home/src.zip!/java/util/List.java">
101 114
               <provider selected="true" editor-type-id="text-editor">
102
-                <state relative-caret-position="-312">
103
-                  <caret line="3" column="13" selection-start-line="3" selection-start-column="13" selection-end-line="3" selection-end-column="13" />
115
+                <state relative-caret-position="313">
116
+                  <caret line="110" column="17" selection-start-line="110" selection-start-column="17" selection-end-line="110" selection-end-column="17" />
104 117
                 </state>
105 118
               </provider>
106 119
             </entry>
@@ -112,8 +125,17 @@
112 125
           <file pinned="false" current-in-tab="true">
113 126
             <entry file="file://$PROJECT_DIR$/src/main/java/AccountService.java">
114 127
               <provider selected="true" editor-type-id="text-editor">
115
-                <state relative-caret-position="765">
116
-                  <caret line="61" column="42" selection-start-line="61" selection-start-column="42" selection-end-line="61" selection-end-column="42" />
128
+                <state relative-caret-position="-109">
129
+                  <caret line="17" selection-start-line="17" selection-end-line="26" selection-end-column="9" />
130
+                </state>
131
+              </provider>
132
+            </entry>
133
+          </file>
134
+          <file pinned="false" current-in-tab="false">
135
+            <entry file="file://$PROJECT_DIR$/src/main/java/Account.java">
136
+              <provider selected="true" editor-type-id="text-editor">
137
+                <state relative-caret-position="123">
138
+                  <caret line="21" column="16" selection-start-line="21" selection-start-column="16" selection-end-line="21" selection-end-column="16" />
117 139
                 </state>
118 140
               </provider>
119 141
             </entry>
@@ -122,16 +144,22 @@
122 144
       </split-second>
123 145
     </splitter>
124 146
   </component>
147
+  <component name="FindInProjectRecents">
148
+    <findStrings>
149
+      <find>queryforAll</find>
150
+      <find>create</find>
151
+    </findStrings>
152
+  </component>
125 153
   <component name="Git.Settings">
126 154
     <option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
127 155
   </component>
128 156
   <component name="IdeDocumentHistory">
129 157
     <option name="CHANGED_PATHS">
130 158
       <list>
159
+        <option value="$PROJECT_DIR$/src/main/java/AccountService.java" />
160
+        <option value="$PROJECT_DIR$/src/main/java/AccountApp.java" />
131 161
         <option value="$PROJECT_DIR$/src/main/java/MockDao.java" />
132 162
         <option value="$PROJECT_DIR$/src/test/java/AccountServiceTest.java" />
133
-        <option value="$PROJECT_DIR$/src/main/java/AccountApp.java" />
134
-        <option value="$PROJECT_DIR$/src/main/java/AccountService.java" />
135 163
       </list>
136 164
     </option>
137 165
   </component>
@@ -142,10 +170,10 @@
142 170
     <sorting>DEFINITION_ORDER</sorting>
143 171
   </component>
144 172
   <component name="ProjectFrameBounds" extendedState="6">
145
-    <option name="x" value="-309" />
146
-    <option name="y" value="-1057" />
147
-    <option name="width" value="1920" />
148
-    <option name="height" value="1057" />
173
+    <option name="x" value="-1345" />
174
+    <option name="y" value="-1053" />
175
+    <option name="width" value="1895" />
176
+    <option name="height" value="1043" />
149 177
   </component>
150 178
   <component name="ProjectLevelVcsManager" settingsEditedManually="true" />
151 179
   <component name="ProjectView">
@@ -191,6 +219,11 @@
191 219
               <item name="test" type="462c0819:PsiDirectoryNode" />
192 220
               <item name="java" type="462c0819:PsiDirectoryNode" />
193 221
             </path>
222
+            <path>
223
+              <item name="ZCW-ORM-SimpleAccount" type="b2602c69:ProjectViewProjectNode" />
224
+              <item name="ZCW-ORM-SimpleAccount" type="462c0819:PsiDirectoryNode" />
225
+              <item name="target" type="462c0819:PsiDirectoryNode" />
226
+            </path>
194 227
           </expand>
195 228
           <select />
196 229
         </subPane>
@@ -202,7 +235,7 @@
202 235
   <component name="PropertiesComponent">
203 236
     <property name="WebServerToolWindowFactoryState" value="false" />
204 237
     <property name="aspect.path.notification.shown" value="true" />
205
-    <property name="com.android.tools.idea.instantapp.provision.ProvisionBeforeRunTaskProvider.myTimeStamp" value="1542817574542" />
238
+    <property name="com.android.tools.idea.instantapp.provision.ProvisionBeforeRunTaskProvider.myTimeStamp" value="1543075080387" />
206 239
     <property name="last_opened_file_path" value="$PROJECT_DIR$/pom.xml" />
207 240
     <property name="nodejs_interpreter_path.stuck_in_default_project" value="undefined stuck path" />
208 241
     <property name="nodejs_npm_path_reset_for_default_project" value="true" />
@@ -222,7 +255,7 @@
222 255
       </list>
223 256
     </option>
224 257
   </component>
225
-  <component name="RunManager">
258
+  <component name="RunManager" selected="JUnit.AccountServiceTest.createTest">
226 259
     <configuration name="AccountApp" type="Application" factoryName="Application" temporary="true" nameIsGenerated="true">
227 260
       <option name="MAIN_CLASS_NAME" value="AccountApp" />
228 261
       <module name="ZCW-ORM-SimpleAccount" />
@@ -230,8 +263,35 @@
230 263
         <option name="Make" enabled="true" />
231 264
       </method>
232 265
     </configuration>
266
+    <configuration name="AccountServiceTest.createTest" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
267
+      <module name="ZCW-ORM-SimpleAccount" />
268
+      <option name="PACKAGE_NAME" value="" />
269
+      <option name="MAIN_CLASS_NAME" value="AccountServiceTest" />
270
+      <option name="METHOD_NAME" value="createTest" />
271
+      <option name="TEST_OBJECT" value="method" />
272
+      <method v="2">
273
+        <option name="Make" enabled="true" />
274
+      </method>
275
+    </configuration>
276
+    <configuration name="AccountServiceTest.queryForIdTest" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
277
+      <module name="ZCW-ORM-SimpleAccount" />
278
+      <option name="PACKAGE_NAME" value="" />
279
+      <option name="MAIN_CLASS_NAME" value="AccountServiceTest" />
280
+      <option name="METHOD_NAME" value="queryForIdTest" />
281
+      <option name="TEST_OBJECT" value="method" />
282
+      <method v="2">
283
+        <option name="Make" enabled="true" />
284
+      </method>
285
+    </configuration>
286
+    <list>
287
+      <item itemvalue="Application.AccountApp" />
288
+      <item itemvalue="JUnit.AccountServiceTest.queryForIdTest" />
289
+      <item itemvalue="JUnit.AccountServiceTest.createTest" />
290
+    </list>
233 291
     <recent_temporary>
234 292
       <list>
293
+        <item itemvalue="JUnit.AccountServiceTest.createTest" />
294
+        <item itemvalue="JUnit.AccountServiceTest.queryForIdTest" />
235 295
         <item itemvalue="Application.AccountApp" />
236 296
       </list>
237 297
     </recent_temporary>
@@ -246,15 +306,40 @@
246 306
       <option name="number" value="Default" />
247 307
       <option name="presentableId" value="Default" />
248 308
       <updated>1542746487090</updated>
249
-      <workItem from="1542746488527" duration="5829000" />
309
+      <workItem from="1542746488527" duration="13677000" />
310
+    </task>
311
+    <task id="LOCAL-00001" summary="Refactored for use with MockDao">
312
+      <created>1542817617312</created>
313
+      <option name="number" value="00001" />
314
+      <option name="presentableId" value="LOCAL-00001" />
315
+      <option name="project" value="LOCAL" />
316
+      <updated>1542817617312</updated>
250 317
     </task>
318
+    <option name="localTasksCounter" value="2" />
251 319
     <servers />
252 320
   </component>
321
+  <component name="TestHistory">
322
+    <history-entry file="AccountServiceTest_queryForIdTest - 2018.11.21 at 11h 45m 59s.xml">
323
+      <configuration name="AccountServiceTest.queryForIdTest" configurationId="JUnit" />
324
+    </history-entry>
325
+    <history-entry file="AccountServiceTest_queryForIdTest - 2018.11.21 at 11h 49m 13s.xml">
326
+      <configuration name="AccountServiceTest.queryForIdTest" configurationId="JUnit" />
327
+    </history-entry>
328
+    <history-entry file="AccountServiceTest_queryForIdTest - 2018.11.21 at 11h 50m 16s.xml">
329
+      <configuration name="AccountServiceTest.queryForIdTest" configurationId="JUnit" />
330
+    </history-entry>
331
+    <history-entry file="AccountServiceTest_queryForIdTest - 2018.11.21 at 11h 50m 37s.xml">
332
+      <configuration name="AccountServiceTest.queryForIdTest" configurationId="JUnit" />
333
+    </history-entry>
334
+    <history-entry file="AccountServiceTest_queryForIdTest - 2018.11.21 at 11h 50m 43s.xml">
335
+      <configuration name="AccountServiceTest.queryForIdTest" configurationId="JUnit" />
336
+    </history-entry>
337
+  </component>
253 338
   <component name="TimeTrackingManager">
254
-    <option name="totallyTimeSpent" value="5829000" />
339
+    <option name="totallyTimeSpent" value="13677000" />
255 340
   </component>
256 341
   <component name="ToolWindowManager">
257
-    <frame x="-309" y="-1057" width="1920" height="1057" extended-state="6" />
342
+    <frame x="-1362" y="-1057" width="1920" height="1057" extended-state="6" />
258 343
     <editor active="true" />
259 344
     <layout>
260 345
       <window_info id="Image Layers" />
@@ -262,7 +347,7 @@
262 347
       <window_info id="UI Designer" />
263 348
       <window_info id="Capture Tool" />
264 349
       <window_info id="Favorites" side_tool="true" />
265
-      <window_info content_ui="combo" id="Project" order="0" weight="0.24959612" />
350
+      <window_info content_ui="combo" id="Project" order="0" weight="0.24920128" />
266 351
       <window_info id="Structure" order="1" side_tool="true" weight="0.25" />
267 352
       <window_info anchor="bottom" id="Messages" weight="0.3284974" />
268 353
       <window_info anchor="bottom" id="Database Changes" show_stripe_button="false" />
@@ -270,9 +355,9 @@
270 355
       <window_info anchor="bottom" id="Terminal" />
271 356
       <window_info anchor="bottom" id="Event Log" side_tool="true" />
272 357
       <window_info anchor="bottom" id="Message" order="0" />
273
-      <window_info anchor="bottom" id="Find" order="1" />
358
+      <window_info anchor="bottom" id="Find" order="1" weight="0.32953367" />
274 359
       <window_info anchor="bottom" id="Run" order="2" weight="0.21036269" />
275
-      <window_info active="true" anchor="bottom" id="Debug" order="3" visible="true" weight="0.17823835" />
360
+      <window_info anchor="bottom" id="Debug" order="3" weight="0.32746115" />
276 361
       <window_info anchor="bottom" id="Cvs" order="4" weight="0.25" />
277 362
       <window_info anchor="bottom" id="Inspection" order="5" weight="0.4" />
278 363
       <window_info anchor="bottom" id="TODO" order="6" />
@@ -293,65 +378,103 @@
293 378
   <component name="VcsContentAnnotationSettings">
294 379
     <option name="myLimit" value="2678400000" />
295 380
   </component>
296
-  <component name="XDebuggerManager">
297
-    <breakpoint-manager>
298
-      <breakpoints>
299
-        <line-breakpoint enabled="true" type="java-line">
300
-          <url>file://$PROJECT_DIR$/src/main/java/AccountApp.java</url>
301
-          <line>67</line>
302
-          <properties />
303
-          <option name="timeStamp" value="2" />
304
-        </line-breakpoint>
305
-      </breakpoints>
306
-    </breakpoint-manager>
381
+  <component name="VcsManagerConfiguration">
382
+    <MESSAGE value="Refactored for use with MockDao" />
383
+    <option name="LAST_COMMIT_MESSAGE" value="Refactored for use with MockDao" />
307 384
   </component>
308 385
   <component name="editorHistoryManager">
309
-    <entry file="file://$PROJECT_DIR$/src/main/java/Account.java">
386
+    <entry file="jar://$MAVEN_REPOSITORY$/com/j256/ormlite/ormlite-jdbc/4.48/ormlite-jdbc-4.48.jar!/com/j256/ormlite/jdbc/JdbcConnectionSource.class">
310 387
       <provider selected="true" editor-type-id="text-editor">
311
-        <state relative-caret-position="75">
312
-          <caret line="6" column="13" selection-start-line="6" selection-start-column="13" selection-end-line="6" selection-end-column="13" />
388
+        <state relative-caret-position="163">
389
+          <caret line="81" selection-start-line="81" selection-end-line="81" />
313 390
         </state>
314 391
       </provider>
315 392
     </entry>
316
-    <entry file="file://$PROJECT_DIR$/src/main/java/Console.java">
393
+    <entry file="file://$PROJECT_DIR$/ZCW-ORM-SimpleAccount.iml">
394
+      <provider selected="true" editor-type-id="text-editor" />
395
+    </entry>
396
+    <entry file="jar://$MAVEN_REPOSITORY$/junit/junit/4.12/junit-4.12.jar!/org/junit/internal/runners/model/EachTestNotifier.class">
317 397
       <provider selected="true" editor-type-id="text-editor">
318
-        <state relative-caret-position="-312">
319
-          <caret line="3" column="13" selection-start-line="3" selection-start-column="13" selection-end-line="3" selection-end-column="13" />
398
+        <state relative-caret-position="240">
399
+          <caret line="24" selection-start-line="24" selection-end-line="24" />
320 400
         </state>
321 401
       </provider>
322 402
     </entry>
323
-    <entry file="file://$PROJECT_DIR$/src/main/java/MockDao.java">
403
+    <entry file="jar://$MAVEN_REPOSITORY$/junit/junit/4.12/junit-4.12.jar!/org/junit/runners/BlockJUnit4ClassRunner.class">
324 404
       <provider selected="true" editor-type-id="text-editor">
325
-        <state relative-caret-position="90">
326
-          <caret line="19" lean-forward="true" selection-start-line="19" selection-end-line="19" />
405
+        <state relative-caret-position="315">
406
+          <caret line="49" selection-start-line="49" selection-end-line="49" />
327 407
         </state>
328 408
       </provider>
329 409
     </entry>
330
-    <entry file="jar://$MAVEN_REPOSITORY$/com/j256/ormlite/ormlite-jdbc/4.48/ormlite-jdbc-4.48.jar!/com/j256/ormlite/jdbc/JdbcConnectionSource.class">
410
+    <entry file="jar://$MAVEN_REPOSITORY$/junit/junit/4.12/junit-4.12.jar!/org/junit/runner/JUnitCore.class">
331 411
       <provider selected="true" editor-type-id="text-editor">
332
-        <state relative-caret-position="163">
333
-          <caret line="81" selection-start-line="81" selection-end-line="81" />
412
+        <state relative-caret-position="310">
413
+          <caret line="71" selection-start-line="71" selection-end-line="71" />
334 414
         </state>
335 415
       </provider>
336 416
     </entry>
337
-    <entry file="file://$PROJECT_DIR$/src/test/java/AccountServiceTest.java">
417
+    <entry file="jar://$MAVEN_REPOSITORY$/junit/junit/4.12/junit-4.12.jar!/org/junit/runners/ParentRunner.class">
418
+      <provider selected="true" editor-type-id="text-editor">
419
+        <state relative-caret-position="187">
420
+          <caret line="226" column="16" selection-start-line="226" selection-start-column="16" selection-end-line="226" selection-end-column="16" />
421
+          <folding>
422
+            <element signature="e#2111#2112#0" expanded="true" />
423
+            <element signature="e#2155#2156#0" expanded="true" />
424
+            <element signature="e#5951#6086#0" expanded="true" />
425
+            <element signature="e#6085#6086#0" expanded="true" />
426
+            <element signature="e#6484#6648#0" expanded="true" />
427
+            <element signature="e#6647#6648#0" expanded="true" />
428
+          </folding>
429
+        </state>
430
+      </provider>
431
+    </entry>
432
+    <entry file="jar://$MAVEN_REPOSITORY$/junit/junit/4.12/junit-4.12.jar!/org/junit/internal/runners/model/ReflectiveCallable.class">
433
+      <provider selected="true" editor-type-id="text-editor">
434
+        <state relative-caret-position="210">
435
+          <caret line="17" selection-start-line="17" selection-end-line="17" />
436
+        </state>
437
+      </provider>
438
+    </entry>
439
+    <entry file="file://$PROJECT_DIR$/src/main/java/Account.java">
440
+      <provider selected="true" editor-type-id="text-editor">
441
+        <state relative-caret-position="123">
442
+          <caret line="21" column="16" selection-start-line="21" selection-start-column="16" selection-end-line="21" selection-end-column="16" />
443
+        </state>
444
+      </provider>
445
+    </entry>
446
+    <entry file="file://$PROJECT_DIR$/src/main/java/Printer.java">
338 447
       <provider selected="true" editor-type-id="text-editor">
339
-        <state relative-caret-position="165">
340
-          <caret line="12" lean-forward="true" selection-start-line="12" selection-end-line="12" />
448
+        <state>
449
+          <caret column="13" selection-start-column="13" selection-end-column="13" />
450
+        </state>
451
+      </provider>
452
+    </entry>
453
+    <entry file="file://$PROJECT_DIR$/src/main/java/Console.java">
454
+      <provider selected="true" editor-type-id="text-editor">
455
+        <state relative-caret-position="180">
456
+          <caret line="13" column="16" lean-forward="true" selection-start-line="13" selection-start-column="16" selection-end-line="13" selection-end-column="16" />
341 457
         </state>
342 458
       </provider>
343 459
     </entry>
344 460
     <entry file="file://$PROJECT_DIR$/src/main/java/AccountService.java">
345 461
       <provider selected="true" editor-type-id="text-editor">
346
-        <state relative-caret-position="30">
347
-          <caret line="12" column="28" selection-start-line="12" selection-start-column="28" selection-end-line="12" selection-end-column="28" />
462
+        <state relative-caret-position="-109">
463
+          <caret line="17" selection-start-line="17" selection-end-line="26" selection-end-column="9" />
464
+        </state>
465
+      </provider>
466
+    </entry>
467
+    <entry file="jar:///Library/Java/JavaVirtualMachines/jdk1.8.0_191.jdk/Contents/Home/src.zip!/java/util/List.java">
468
+      <provider selected="true" editor-type-id="text-editor">
469
+        <state relative-caret-position="313">
470
+          <caret line="110" column="17" selection-start-line="110" selection-start-column="17" selection-end-line="110" selection-end-column="17" />
348 471
         </state>
349 472
       </provider>
350 473
     </entry>
351 474
     <entry file="file://$PROJECT_DIR$/src/main/java/AccountApp.java">
352 475
       <provider selected="true" editor-type-id="text-editor">
353
-        <state relative-caret-position="1290">
354
-          <caret line="93" column="8" selection-start-line="93" selection-start-column="8" selection-end-line="93" selection-end-column="8" />
476
+        <state relative-caret-position="1065">
477
+          <caret line="78" column="45" selection-start-line="78" selection-start-column="45" selection-end-line="78" selection-end-column="45" />
355 478
           <folding>
356 479
             <element signature="e#761#762#0" expanded="true" />
357 480
             <element signature="e#800#801#0" expanded="true" />
@@ -361,6 +484,29 @@
361 484
         </state>
362 485
       </provider>
363 486
     </entry>
487
+    <entry file="file://$PROJECT_DIR$/pom.xml">
488
+      <provider selected="true" editor-type-id="text-editor" />
489
+    </entry>
490
+    <entry file="file://$PROJECT_DIR$/src/main/java/MockDao.java">
491
+      <provider selected="true" editor-type-id="text-editor">
492
+        <state relative-caret-position="765">
493
+          <caret line="69" column="26" selection-start-line="69" selection-start-column="26" selection-end-line="69" selection-end-column="26" />
494
+          <folding>
495
+            <element signature="imports" expanded="true" />
496
+          </folding>
497
+        </state>
498
+      </provider>
499
+    </entry>
500
+    <entry file="file://$PROJECT_DIR$/src/test/java/AccountServiceTest.java">
501
+      <provider selected="true" editor-type-id="text-editor">
502
+        <state relative-caret-position="375">
503
+          <caret line="25" column="48" selection-start-line="25" selection-start-column="48" selection-end-line="25" selection-end-column="48" />
504
+          <folding>
505
+            <element signature="imports" expanded="true" />
506
+          </folding>
507
+        </state>
508
+      </provider>
509
+    </entry>
364 510
   </component>
365 511
   <component name="masterDetails">
366 512
     <states>

+ 1
- 1
ZCW-ORM-SimpleAccount.iml Wyświetl plik

@@ -1,6 +1,6 @@
1 1
 <?xml version="1.0" encoding="UTF-8"?>
2 2
 <module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
3
-  <component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_5">
3
+  <component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
4 4
     <output url="file://$MODULE_DIR$/target/classes" />
5 5
     <output-test url="file://$MODULE_DIR$/target/test-classes" />
6 6
     <content url="file://$MODULE_DIR$">

+ 12
- 0
pom.xml Wyświetl plik

@@ -7,6 +7,18 @@
7 7
     <groupId>NickSatinover</groupId>
8 8
     <artifactId>ZCW-ORM-SimpleAccount</artifactId>
9 9
     <version>1.0-SNAPSHOT</version>
10
+    <build>
11
+        <plugins>
12
+            <plugin>
13
+                <groupId>org.apache.maven.plugins</groupId>
14
+                <artifactId>maven-compiler-plugin</artifactId>
15
+                <configuration>
16
+                    <source>8</source>
17
+                    <target>8</target>
18
+                </configuration>
19
+            </plugin>
20
+        </plugins>
21
+    </build>
10 22
 
11 23
     <dependencies>
12 24
         <!-- https://mvnrepository.com/artifact/com.j256.ormlite/ormlite-core -->

+ 3
- 3
src/main/java/AccountApp.java Wyświetl plik

@@ -16,7 +16,7 @@ public class AccountApp {
16 16
     private final static String YOURPASSWORD = "cddvdmp9";
17 17
 
18 18
     private Dao<Account, Integer> accountDao;
19
-    private RuntimeExceptionDao<Account, Integer> accountRuntimeDao = null;
19
+    // private RuntimeExceptionDao<Account, Integer> accountRuntimeDao = null;
20 20
 
21 21
     AccountApp(){
22 22
         console = new Console();
@@ -79,7 +79,7 @@ public class AccountApp {
79 79
                     int idToDelete = console.getIdToDelete();
80 80
                     accountService.deleteId(getAccountDao(), idToDelete);
81 81
                     break;
82
-                case 5 :
82
+                case 5 : //quit application
83 83
                     Printer.printMessage("Connection is now closed.");
84 84
                     connectionOpen = false;
85 85
             }
@@ -88,7 +88,7 @@ public class AccountApp {
88 88
     }
89 89
 
90 90
     /**
91
-     * Setup our  DAOs
91
+     * Setup our DAOs
92 92
      */
93 93
     private void setupDao(ConnectionSource connectionSource) throws Exception {
94 94
         accountDao = DaoManager.createDao(connectionSource, Account.class);

+ 16
- 6
src/main/java/MockDao.java Wyświetl plik

@@ -8,12 +8,16 @@ import com.j256.ormlite.support.DatabaseResults;
8 8
 import com.j256.ormlite.table.ObjectFactory;
9 9
 
10 10
 import java.sql.SQLException;
11
-import java.util.Collection;
12
-import java.util.List;
13
-import java.util.Map;
11
+import java.util.*;
14 12
 import java.util.concurrent.Callable;
15 13
 
16
-public class MockDao<Account, Integer> implements Dao {
14
+public class MockDao implements Dao {
15
+    ArrayList<Integer> ids = new ArrayList<>();
16
+    List<Account> accounts = new ArrayList<>();
17
+
18
+    int id = 0;
19
+
20
+
17 21
     public Object queryForId(Object o) throws SQLException {
18 22
         return null;
19 23
     }
@@ -23,7 +27,7 @@ public class MockDao<Account, Integer> implements Dao {
23 27
     }
24 28
 
25 29
     public List queryForAll() throws SQLException {
26
-        return null;
30
+        return accounts;
27 31
     }
28 32
 
29 33
     public List queryForEq(String s, Object o) throws SQLException {
@@ -59,7 +63,13 @@ public class MockDao<Account, Integer> implements Dao {
59 63
     }
60 64
 
61 65
     public int create(Object o) throws SQLException {
62
-        return 0;
66
+        try {
67
+            accounts.add((Account)o);
68
+            return 1;
69
+        }
70
+        catch (Exception e){
71
+            return -1;
72
+        }
63 73
     }
64 74
 
65 75
     public Object createIfNotExists(Object o) throws SQLException {

+ 20
- 5
src/test/java/AccountServiceTest.java Wyświetl plik

@@ -1,18 +1,33 @@
1
+import static org.junit.Assert.*;
1 2
 import com.j256.ormlite.dao.Dao;
2 3
 import org.junit.Before;
4
+import org.junit.Test;
5
+import java.sql.SQLException;
6
+import org.junit.Assert;
3 7
 
4 8
 public class AccountServiceTest {
5 9
 
6
-    AccountService accountService;
7
-    Dao<Account, Integer> dao;
8
-    Account account;
10
+    MockDao mockDao = new MockDao();
11
+    AccountApp accountApp = new AccountApp(mockDao);
12
+    Account testAccount = new Account("Test", "Password");
9 13
 
10 14
     @Before
11 15
     public void setUp(){
12
-        dao = new MockDao();
13
-        // accountService = new AccountService(dao);
16
+
17
+
14 18
     }
15 19
 
20
+    @Test
21
+    public void createTest(){
22
+        try {
16 23
 
24
+            int expected = 1;
25
+            int actual = mockDao.create(testAccount);
26
+            Assert.assertEquals(expected, actual);
27
+        } catch (SQLException e) {
28
+            e.printStackTrace();
29
+        }
30
+
31
+    }
17 32
 
18 33
 }

BIN
target/classes/AccountApp.class Wyświetl plik


BIN
target/classes/AccountService.class Wyświetl plik


BIN
target/classes/MockDao.class Wyświetl plik