Selaa lähdekoodia

committing the changes

thulasi 6 vuotta sitten
vanhempi
commit
691fc28e36

+ 103
- 48
Checkbook/.idea/workspace.xml Näytä tiedosto

@@ -2,13 +2,10 @@
2 2
 <project version="4">
3 3
   <component name="ChangeListManager">
4 4
     <list default="true" id="6740fffe-7f4d-4976-ad48-af24e6914f17" name="Default Changelist" comment="">
5
-      <change afterPath="$PROJECT_DIR$/.idea/libraries/Maven__junit_junit_4_0.xml" afterDir="false" />
6
-      <change afterPath="$PROJECT_DIR$/.idea/modules.xml" afterDir="false" />
7
-      <change beforePath="$PROJECT_DIR$/Checkbook.iml" beforeDir="false" afterPath="$PROJECT_DIR$/Checkbook.iml" afterDir="false" />
5
+      <change afterPath="$PROJECT_DIR$/src/test/java/GenericAccountTest.java" afterDir="false" />
6
+      <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
8 7
       <change beforePath="$PROJECT_DIR$/src/main/java/Checkbook.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/Checkbook.java" afterDir="false" />
9 8
       <change beforePath="$PROJECT_DIR$/src/main/java/GenericAccount.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/GenericAccount.java" afterDir="false" />
10
-      <change beforePath="$PROJECT_DIR$/src/main/java/Payee.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/Payee.java" afterDir="false" />
11
-      <change beforePath="$PROJECT_DIR$/src/main/java/Transaction.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/Transaction.java" afterDir="false" />
12 9
       <change beforePath="$PROJECT_DIR$/src/test/java/CheckbookTest.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/test/java/CheckbookTest.java" afterDir="false" />
13 10
     </list>
14 11
     <ignored path="$PROJECT_DIR$/target/" />
@@ -31,22 +28,22 @@
31 28
       </usages-collector>
32 29
       <usages-collector id="statistics.file.extensions.open">
33 30
         <counts>
34
-          <entry key="java" value="10" />
31
+          <entry key="java" value="12" />
35 32
         </counts>
36 33
       </usages-collector>
37 34
       <usages-collector id="statistics.file.types.open">
38 35
         <counts>
39
-          <entry key="JAVA" value="10" />
36
+          <entry key="JAVA" value="12" />
40 37
         </counts>
41 38
       </usages-collector>
42 39
       <usages-collector id="statistics.file.extensions.edit">
43 40
         <counts>
44
-          <entry key="java" value="3480" />
41
+          <entry key="java" value="4196" />
45 42
         </counts>
46 43
       </usages-collector>
47 44
       <usages-collector id="statistics.file.types.edit">
48 45
         <counts>
49
-          <entry key="JAVA" value="3480" />
46
+          <entry key="JAVA" value="4196" />
50 47
         </counts>
51 48
       </usages-collector>
52 49
     </session>
@@ -56,8 +53,8 @@
56 53
       <file pinned="false" current-in-tab="false">
57 54
         <entry file="file://$PROJECT_DIR$/src/main/java/Checkbook.java">
58 55
           <provider selected="true" editor-type-id="text-editor">
59
-            <state relative-caret-position="231">
60
-              <caret line="119" column="53" selection-start-line="119" selection-start-column="53" selection-end-line="119" selection-end-column="53" />
56
+            <state relative-caret-position="289">
57
+              <caret line="72" lean-forward="true" selection-start-line="72" selection-end-line="72" />
61 58
               <folding>
62 59
                 <element signature="imports" expanded="true" />
63 60
                 <element signature="e#841#842#0" expanded="true" />
@@ -70,6 +67,8 @@
70 67
                 <element signature="e#3389#3390#0" expanded="true" />
71 68
                 <element signature="e#3477#3478#0" expanded="true" />
72 69
                 <element signature="e#3511#3512#0" expanded="true" />
70
+                <element signature="e#3565#3566#0" expanded="true" />
71
+                <element signature="e#3601#3602#0" expanded="true" />
73 72
               </folding>
74 73
             </state>
75 74
           </provider>
@@ -78,8 +77,8 @@
78 77
       <file pinned="false" current-in-tab="true">
79 78
         <entry file="file://$PROJECT_DIR$/src/test/java/CheckbookTest.java">
80 79
           <provider selected="true" editor-type-id="text-editor">
81
-            <state relative-caret-position="231">
82
-              <caret line="467" column="25" lean-forward="true" selection-start-line="467" selection-start-column="25" selection-end-line="467" selection-end-column="25" />
80
+            <state relative-caret-position="1752">
81
+              <caret line="248" column="46" selection-start-line="248" selection-start-column="46" selection-end-line="248" selection-end-column="46" />
83 82
               <folding>
84 83
                 <element signature="imports" expanded="true" />
85 84
               </folding>
@@ -103,8 +102,38 @@
103 102
       <file pinned="false" current-in-tab="false">
104 103
         <entry file="file://$PROJECT_DIR$/src/main/java/GenericAccount.java">
105 104
           <provider selected="true" editor-type-id="text-editor">
106
-            <state relative-caret-position="15">
107
-              <caret line="1" column="29" selection-start-line="1" selection-start-column="29" selection-end-line="1" selection-end-column="29" />
105
+            <state relative-caret-position="141">
106
+              <caret line="20" column="60" selection-start-line="20" selection-start-column="60" selection-end-line="20" selection-end-column="60" />
107
+              <folding>
108
+                <element signature="e#310#311#0" expanded="true" />
109
+                <element signature="e#336#337#0" expanded="true" />
110
+                <element signature="e#382#383#0" expanded="true" />
111
+                <element signature="e#418#419#0" expanded="true" />
112
+                <element signature="e#555#556#0" expanded="true" />
113
+                <element signature="e#561#562#0" expanded="true" />
114
+                <element signature="e#600#601#0" expanded="true" />
115
+              </folding>
116
+            </state>
117
+          </provider>
118
+        </entry>
119
+      </file>
120
+      <file pinned="false" current-in-tab="false">
121
+        <entry file="file://$PROJECT_DIR$/src/test/java/GenericAccountTest.java">
122
+          <provider selected="true" editor-type-id="text-editor">
123
+            <state relative-caret-position="585">
124
+              <caret line="39" column="82" selection-start-line="39" selection-start-column="82" selection-end-line="39" selection-end-column="82" />
125
+              <folding>
126
+                <element signature="imports" expanded="true" />
127
+              </folding>
128
+            </state>
129
+          </provider>
130
+        </entry>
131
+      </file>
132
+      <file pinned="false" current-in-tab="false">
133
+        <entry file="file://$PROJECT_DIR$/src/main/java/AccountBook.java">
134
+          <provider selected="true" editor-type-id="text-editor">
135
+            <state relative-caret-position="45">
136
+              <caret line="3" column="27" selection-start-line="3" selection-start-column="27" selection-end-line="3" selection-end-column="27" />
108 137
             </state>
109 138
           </provider>
110 139
         </entry>
@@ -138,15 +167,23 @@
138 167
       </file>
139 168
     </leaf>
140 169
   </component>
170
+  <component name="FileTemplateManagerImpl">
171
+    <option name="RECENT_TEMPLATES">
172
+      <list>
173
+        <option value="Class" />
174
+      </list>
175
+    </option>
176
+  </component>
141 177
   <component name="Git.Settings">
142 178
     <option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$/.." />
143 179
   </component>
144 180
   <component name="IdeDocumentHistory">
145 181
     <option name="CHANGED_PATHS">
146 182
       <list>
147
-        <option value="$PROJECT_DIR$/src/main/java/GenericAccount.java" />
148 183
         <option value="$PROJECT_DIR$/src/main/java/Transaction.java" />
149 184
         <option value="$PROJECT_DIR$/src/main/java/Payee.java" />
185
+        <option value="$PROJECT_DIR$/src/main/java/GenericAccount.java" />
186
+        <option value="$PROJECT_DIR$/src/test/java/GenericAccountTest.java" />
150 187
         <option value="$PROJECT_DIR$/src/main/java/Checkbook.java" />
151 188
         <option value="$PROJECT_DIR$/src/test/java/CheckbookTest.java" />
152 189
       </list>
@@ -218,7 +255,7 @@
218 255
   <component name="PropertiesComponent">
219 256
     <property name="WebServerToolWindowFactoryState" value="false" />
220 257
     <property name="aspect.path.notification.shown" value="true" />
221
-    <property name="com.android.tools.idea.instantapp.provision.ProvisionBeforeRunTaskProvider.myTimeStamp" value="1544369669468" />
258
+    <property name="com.android.tools.idea.instantapp.provision.ProvisionBeforeRunTaskProvider.myTimeStamp" value="1544371979297" />
222 259
     <property name="last_opened_file_path" value="$PROJECT_DIR$/pom.xml" />
223 260
     <property name="nodejs_interpreter_path.stuck_in_default_project" value="undefined stuck path" />
224 261
     <property name="nodejs_npm_path_reset_for_default_project" value="true" />
@@ -268,40 +305,38 @@
268 305
         <option name="Make" enabled="true" />
269 306
       </method>
270 307
     </configuration>
271
-    <configuration name="CheckbookTest.test3GetAllCreditTransactions" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
308
+    <configuration name="CheckbookTest.test3GetAllDebitTransactions" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
272 309
       <module name="Checkbook" />
273 310
       <option name="PACKAGE_NAME" value="" />
274 311
       <option name="MAIN_CLASS_NAME" value="CheckbookTest" />
275
-      <option name="METHOD_NAME" value="test3GetAllCreditTransactions" />
312
+      <option name="METHOD_NAME" value="test3GetAllDebitTransactions" />
276 313
       <option name="TEST_OBJECT" value="method" />
277 314
       <method v="2">
278 315
         <option name="Make" enabled="true" />
279 316
       </method>
280 317
     </configuration>
281
-    <configuration name="CheckbookTest.test3GetAllDebitTransactions" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
318
+    <configuration name="GenericAccountTest" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
282 319
       <module name="Checkbook" />
283 320
       <option name="PACKAGE_NAME" value="" />
284
-      <option name="MAIN_CLASS_NAME" value="CheckbookTest" />
285
-      <option name="METHOD_NAME" value="test3GetAllDebitTransactions" />
286
-      <option name="TEST_OBJECT" value="method" />
321
+      <option name="MAIN_CLASS_NAME" value="GenericAccountTest" />
287 322
       <method v="2">
288 323
         <option name="Make" enabled="true" />
289 324
       </method>
290 325
     </configuration>
291 326
     <list>
292
-      <item itemvalue="JUnit.CheckbookTest.test3GetAllCreditTransactions" />
293 327
       <item itemvalue="JUnit.CheckbookTest.test3GetAllDebitTransactions" />
294 328
       <item itemvalue="JUnit.CheckbookTest.test1GetTransactionsForDate" />
295 329
       <item itemvalue="JUnit.CheckbookTest.test2GetTransactionsForDate" />
296 330
       <item itemvalue="JUnit.CheckbookTest" />
331
+      <item itemvalue="JUnit.GenericAccountTest" />
297 332
     </list>
298 333
     <recent_temporary>
299 334
       <list>
300 335
         <item itemvalue="JUnit.CheckbookTest" />
336
+        <item itemvalue="JUnit.GenericAccountTest" />
301 337
         <item itemvalue="JUnit.CheckbookTest.test1GetTransactionsForDate" />
302 338
         <item itemvalue="JUnit.CheckbookTest.test2GetTransactionsForDate" />
303 339
         <item itemvalue="JUnit.CheckbookTest.test3GetAllDebitTransactions" />
304
-        <item itemvalue="JUnit.CheckbookTest.test3GetAllCreditTransactions" />
305 340
       </list>
306 341
     </recent_temporary>
307 342
   </component>
@@ -317,17 +352,11 @@
317 352
       <updated>1544225864730</updated>
318 353
       <workItem from="1544225868313" duration="8881000" />
319 354
       <workItem from="1544319987271" duration="10272000" />
320
-      <workItem from="1544361451727" duration="6640000" />
355
+      <workItem from="1544361451727" duration="8762000" />
321 356
     </task>
322 357
     <servers />
323 358
   </component>
324 359
   <component name="TestHistory">
325
-    <history-entry file="CheckbookTest - 2018.12.09 at 10h 20m 27s.xml">
326
-      <configuration name="CheckbookTest" configurationId="JUnit" />
327
-    </history-entry>
328
-    <history-entry file="CheckbookTest - 2018.12.09 at 10h 21m 17s.xml">
329
-      <configuration name="CheckbookTest" configurationId="JUnit" />
330
-    </history-entry>
331 360
     <history-entry file="CheckbookTest - 2018.12.09 at 10h 22m 07s.xml">
332 361
       <configuration name="CheckbookTest" configurationId="JUnit" />
333 362
     </history-entry>
@@ -352,13 +381,18 @@
352 381
     <history-entry file="CheckbookTest - 2018.12.09 at 10h 29m 28s.xml">
353 382
       <configuration name="CheckbookTest" configurationId="JUnit" />
354 383
     </history-entry>
384
+    <history-entry file="CheckbookTest - 2018.12.09 at 10h 34m 35s.xml">
385
+      <configuration name="CheckbookTest" configurationId="JUnit" />
386
+    </history-entry>
387
+    <history-entry file="GenericAccountTest - 2018.12.09 at 11h 07m 10s.xml">
388
+      <configuration name="GenericAccountTest" configurationId="JUnit" />
389
+    </history-entry>
355 390
   </component>
356 391
   <component name="TimeTrackingManager">
357
-    <option name="totallyTimeSpent" value="25793000" />
392
+    <option name="totallyTimeSpent" value="27915000" />
358 393
   </component>
359 394
   <component name="ToolWindowManager">
360 395
     <frame x="0" y="23" width="1280" height="709" extended-state="0" />
361
-    <editor active="true" />
362 396
     <layout>
363 397
       <window_info id="Designer" order="0" />
364 398
       <window_info id="UI Designer" order="1" />
@@ -368,7 +402,7 @@
368 402
       <window_info content_ui="combo" id="Project" order="5" sideWeight="0.496633" visible="true" weight="0.105815835" />
369 403
       <window_info id="Structure" order="6" sideWeight="0.503367" side_tool="true" weight="0.19063005" />
370 404
       <window_info anchor="bottom" id="Version Control" order="0" show_stripe_button="false" />
371
-      <window_info anchor="bottom" id="Terminal" order="1" />
405
+      <window_info anchor="bottom" id="Terminal" order="1" weight="0.32996634" />
372 406
       <window_info anchor="bottom" id="Event Log" order="2" side_tool="true" />
373 407
       <window_info anchor="bottom" id="Message" order="3" />
374 408
       <window_info anchor="bottom" id="Find" order="4" />
@@ -426,13 +460,6 @@
426 460
     <option name="myLimit" value="2678400000" />
427 461
   </component>
428 462
   <component name="editorHistoryManager">
429
-    <entry file="file://$PROJECT_DIR$/src/main/java/AccountBook.java">
430
-      <provider selected="true" editor-type-id="text-editor">
431
-        <state relative-caret-position="45">
432
-          <caret line="3" column="27" selection-start-line="3" selection-start-column="27" selection-end-line="3" selection-end-column="27" />
433
-        </state>
434
-      </provider>
435
-    </entry>
436 463
     <entry file="file://$PROJECT_DIR$/src/main/java/TransactionType.java">
437 464
       <provider selected="true" editor-type-id="text-editor" />
438 465
     </entry>
@@ -472,17 +499,43 @@
472 499
         </state>
473 500
       </provider>
474 501
     </entry>
502
+    <entry file="file://$PROJECT_DIR$/src/main/java/AccountBook.java">
503
+      <provider selected="true" editor-type-id="text-editor">
504
+        <state relative-caret-position="45">
505
+          <caret line="3" column="27" selection-start-line="3" selection-start-column="27" selection-end-line="3" selection-end-column="27" />
506
+        </state>
507
+      </provider>
508
+    </entry>
475 509
     <entry file="file://$PROJECT_DIR$/src/main/java/GenericAccount.java">
476 510
       <provider selected="true" editor-type-id="text-editor">
477
-        <state relative-caret-position="15">
478
-          <caret line="1" column="29" selection-start-line="1" selection-start-column="29" selection-end-line="1" selection-end-column="29" />
511
+        <state relative-caret-position="141">
512
+          <caret line="20" column="60" selection-start-line="20" selection-start-column="60" selection-end-line="20" selection-end-column="60" />
513
+          <folding>
514
+            <element signature="e#310#311#0" expanded="true" />
515
+            <element signature="e#336#337#0" expanded="true" />
516
+            <element signature="e#382#383#0" expanded="true" />
517
+            <element signature="e#418#419#0" expanded="true" />
518
+            <element signature="e#555#556#0" expanded="true" />
519
+            <element signature="e#561#562#0" expanded="true" />
520
+            <element signature="e#600#601#0" expanded="true" />
521
+          </folding>
522
+        </state>
523
+      </provider>
524
+    </entry>
525
+    <entry file="file://$PROJECT_DIR$/src/test/java/GenericAccountTest.java">
526
+      <provider selected="true" editor-type-id="text-editor">
527
+        <state relative-caret-position="585">
528
+          <caret line="39" column="82" selection-start-line="39" selection-start-column="82" selection-end-line="39" selection-end-column="82" />
529
+          <folding>
530
+            <element signature="imports" expanded="true" />
531
+          </folding>
479 532
         </state>
480 533
       </provider>
481 534
     </entry>
482 535
     <entry file="file://$PROJECT_DIR$/src/main/java/Checkbook.java">
483 536
       <provider selected="true" editor-type-id="text-editor">
484
-        <state relative-caret-position="231">
485
-          <caret line="119" column="53" selection-start-line="119" selection-start-column="53" selection-end-line="119" selection-end-column="53" />
537
+        <state relative-caret-position="289">
538
+          <caret line="72" lean-forward="true" selection-start-line="72" selection-end-line="72" />
486 539
           <folding>
487 540
             <element signature="imports" expanded="true" />
488 541
             <element signature="e#841#842#0" expanded="true" />
@@ -495,14 +548,16 @@
495 548
             <element signature="e#3389#3390#0" expanded="true" />
496 549
             <element signature="e#3477#3478#0" expanded="true" />
497 550
             <element signature="e#3511#3512#0" expanded="true" />
551
+            <element signature="e#3565#3566#0" expanded="true" />
552
+            <element signature="e#3601#3602#0" expanded="true" />
498 553
           </folding>
499 554
         </state>
500 555
       </provider>
501 556
     </entry>
502 557
     <entry file="file://$PROJECT_DIR$/src/test/java/CheckbookTest.java">
503 558
       <provider selected="true" editor-type-id="text-editor">
504
-        <state relative-caret-position="231">
505
-          <caret line="467" column="25" lean-forward="true" selection-start-line="467" selection-start-column="25" selection-end-line="467" selection-end-column="25" />
559
+        <state relative-caret-position="1752">
560
+          <caret line="248" column="46" selection-start-line="248" selection-start-column="46" selection-end-line="248" selection-end-column="46" />
506 561
           <folding>
507 562
             <element signature="imports" expanded="true" />
508 563
           </folding>

+ 25
- 1
Checkbook/src/main/java/GenericAccount.java Näytä tiedosto

@@ -1,4 +1,28 @@
1
+import java.util.List;
1 2
 
2
-public class GenericAccount {
3
+public class GenericAccount<T extends AccountBook> {
4
+    private Payee payee;
5
+    private Checkbook checkbook;
6
+    private List<Transaction> transactions;
7
+    public GenericAccount(Payee payee, Checkbook checkbook){
8
+        this.payee = payee;
9
+        this.checkbook = checkbook;
10
+    }
3 11
 
12
+
13
+    public Payee getPayee() {
14
+        return this.payee;
15
+    }
16
+
17
+    public Checkbook getCheckbook() {
18
+        return this.checkbook;
19
+    }
20
+
21
+    public void setTransaction(List<Transaction> expected) {
22
+        this.transactions = expected;
23
+    }
24
+
25
+    public List<Transaction> getTransaction() {
26
+        return this.transactions;
27
+    }
4 28
 }

+ 45
- 0
Checkbook/src/test/java/GenericAccountTest.java Näytä tiedosto

@@ -0,0 +1,45 @@
1
+import junit.framework.Assert;
2
+import org.junit.Before;
3
+import org.junit.Test;
4
+
5
+import java.util.ArrayList;
6
+import java.util.List;
7
+
8
+public class GenericAccountTest {
9
+    Payee payee;
10
+    Checkbook checkbook;
11
+    GenericAccount genericAccount;
12
+
13
+    @Before
14
+    public void setup(){
15
+        payee = new Payee();
16
+        payee.setGivenName("thulasi");
17
+        payee.setFamilyName("puppala");
18
+        payee.setEmailAddress("thulasi@gmail.com");
19
+        checkbook = new Checkbook(payee, 20000);
20
+        genericAccount = new GenericAccount(payee, checkbook);
21
+    }
22
+
23
+    @Test
24
+    public void TestGetPayee(){
25
+        Payee expected = payee;
26
+        Payee actualPayee = genericAccount.getPayee();
27
+        Assert.assertEquals(expected, actualPayee);
28
+    }
29
+
30
+    @Test
31
+    public void TestGetCheckbook(){
32
+        Checkbook expected = checkbook;
33
+        Checkbook actual = genericAccount.getCheckbook();
34
+        Assert.assertEquals(expected, actual);
35
+    }
36
+
37
+    @Test
38
+    public void TestSetGetTransaction(){
39
+        List<Transaction> expected = new ArrayList<>();
40
+        expected.add(new Transaction("one", payee, TransactionType.DEBIT, 200.0));
41
+        genericAccount.setTransaction(expected);
42
+        List<Transaction> actual = genericAccount.getTransaction();
43
+        Assert.assertEquals(expected, actual);
44
+    }
45
+}