소스 검색

added methods to Inventory Class

Trinh Tong 6 년 전
부모
커밋
ae1b158d65

+ 33
- 21
.idea/workspace.xml 파일 보기

@@ -3,8 +3,8 @@
3 3
   <component name="ChangeListManager">
4 4
     <list default="true" id="268ab437-e0d5-4447-8401-9f321aad6d50" name="Default" comment="">
5 5
       <change beforePath="$PROJECT_DIR$/src/main/java/com/zipcodewilmington/productmanager/Inventory.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/zipcodewilmington/productmanager/Inventory.java" afterDir="false" />
6
+      <change beforePath="$PROJECT_DIR$/src/main/java/com/zipcodewilmington/productmanager/ProductManager.java" beforeDir="false" />
6 7
       <change beforePath="$PROJECT_DIR$/src/test/java/com/zipcodewilmington/productmanager/InventoryTest.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/test/java/com/zipcodewilmington/productmanager/InventoryTest.java" afterDir="false" />
7
-      <change beforePath="$PROJECT_DIR$/src/test/java/com/zipcodewilmington/productmanager/ProductTest.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/test/java/com/zipcodewilmington/productmanager/ProductTest.java" afterDir="false" />
8 8
     </list>
9 9
     <ignored path="$PROJECT_DIR$/out/" />
10 10
     <ignored path="$PROJECT_DIR$/target/" />
@@ -31,13 +31,13 @@
31 31
       <usages-collector id="statistics.file.extensions.edit">
32 32
         <counts>
33 33
           <entry key="gitignore" value="1" />
34
-          <entry key="java" value="6849" />
34
+          <entry key="java" value="7019" />
35 35
           <entry key="xml" value="1" />
36 36
         </counts>
37 37
       </usages-collector>
38 38
       <usages-collector id="statistics.file.types.edit">
39 39
         <counts>
40
-          <entry key="JAVA" value="6849" />
40
+          <entry key="JAVA" value="7019" />
41 41
           <entry key="PLAIN_TEXT" value="1" />
42 42
           <entry key="XML" value="1" />
43 43
         </counts>
@@ -45,13 +45,13 @@
45 45
       <usages-collector id="statistics.file.extensions.open">
46 46
         <counts>
47 47
           <entry key="class" value="1" />
48
-          <entry key="java" value="4" />
48
+          <entry key="java" value="6" />
49 49
         </counts>
50 50
       </usages-collector>
51 51
       <usages-collector id="statistics.file.types.open">
52 52
         <counts>
53 53
           <entry key="CLASS" value="1" />
54
-          <entry key="JAVA" value="4" />
54
+          <entry key="JAVA" value="6" />
55 55
         </counts>
56 56
       </usages-collector>
57 57
     </session>
@@ -105,11 +105,13 @@
105 105
       <file pinned="false" current-in-tab="false">
106 106
         <entry file="file://$PROJECT_DIR$/src/main/java/com/zipcodewilmington/productmanager/Inventory.java">
107 107
           <provider selected="true" editor-type-id="text-editor">
108
-            <state relative-caret-position="270">
109
-              <caret line="18" column="33" selection-start-line="18" selection-start-column="32" selection-end-line="18" selection-end-column="33" />
108
+            <state relative-caret-position="144">
109
+              <caret line="11" column="41" selection-start-line="11" selection-start-column="41" selection-end-line="11" selection-end-column="41" />
110 110
               <folding>
111 111
                 <element signature="imports" expanded="true" />
112 112
                 <element signature="e#170#179#0" expanded="true" />
113
+                <element signature="e#259#260#0" expanded="true" />
114
+                <element signature="e#307#308#0" expanded="true" />
113 115
               </folding>
114 116
             </state>
115 117
           </provider>
@@ -118,8 +120,8 @@
118 120
       <file pinned="false" current-in-tab="true">
119 121
         <entry file="file://$PROJECT_DIR$/src/test/java/com/zipcodewilmington/productmanager/InventoryTest.java">
120 122
           <provider selected="true" editor-type-id="text-editor">
121
-            <state relative-caret-position="675">
122
-              <caret line="45" column="41" lean-forward="true" selection-start-line="45" selection-start-column="41" selection-end-line="45" selection-end-column="41" />
123
+            <state relative-caret-position="282">
124
+              <caret line="23" lean-forward="true" selection-start-line="23" selection-end-line="23" />
123 125
               <folding>
124 126
                 <element signature="imports" expanded="true" />
125 127
               </folding>
@@ -169,6 +171,7 @@
169 171
         <option value="$PROJECT_DIR$/pom.xml" />
170 172
         <option value="$PROJECT_DIR$/src/main/java/com/zipcodewilmington/productmanager/Product.java" />
171 173
         <option value="$PROJECT_DIR$/src/test/java/com/zipcodewilmington/productmanager/ProductTest.java" />
174
+        <option value="$PROJECT_DIR$/src/main/java/com/zipcodewilmington/productmanager/ProductManager.java" />
172 175
         <option value="$PROJECT_DIR$/src/main/java/com/zipcodewilmington/productmanager/Inventory.java" />
173 176
         <option value="$PROJECT_DIR$/src/test/java/com/zipcodewilmington/productmanager/InventoryTest.java" />
174 177
       </list>
@@ -268,7 +271,7 @@
268 271
   <component name="PropertiesComponent">
269 272
     <property name="WebServerToolWindowFactoryState" value="false" />
270 273
     <property name="aspect.path.notification.shown" value="true" />
271
-    <property name="com.android.tools.idea.instantapp.provision.ProvisionBeforeRunTaskProvider.myTimeStamp" value="1540429147456" />
274
+    <property name="com.android.tools.idea.instantapp.provision.ProvisionBeforeRunTaskProvider.myTimeStamp" value="1540429498796" />
272 275
     <property name="last_opened_file_path" value="$PROJECT_DIR$" />
273 276
     <property name="project.structure.last.edited" value="Modules" />
274 277
     <property name="project.structure.proportion" value="0.0" />
@@ -491,14 +494,11 @@
491 494
       <updated>1515620835041</updated>
492 495
       <workItem from="1540329189897" duration="13000" />
493 496
       <workItem from="1540382573342" duration="34000" />
494
-      <workItem from="1540384510969" duration="19187000" />
497
+      <workItem from="1540384510969" duration="19851000" />
495 498
     </task>
496 499
     <servers />
497 500
   </component>
498 501
   <component name="TestHistory">
499
-    <history-entry file="ProductTest_testSetID - 2018.10.24 at 17h 43m 44s.xml">
500
-      <configuration name="ProductTest.testSetID" configurationId="JUnit" />
501
-    </history-entry>
502 502
     <history-entry file="ProductTest - 2018.10.24 at 17h 45m 31s.xml">
503 503
       <configuration name="ProductTest" configurationId="JUnit" />
504 504
     </history-entry>
@@ -526,15 +526,18 @@
526 526
     <history-entry file="InventoryTest_testAddProduct - 2018.10.24 at 20h 31m 47s.xml">
527 527
       <configuration name="InventoryTest.testAddProduct" configurationId="JUnit" />
528 528
     </history-entry>
529
+    <history-entry file="InventoryTest - 2018.10.24 at 20h 59m 09s.xml">
530
+      <configuration name="InventoryTest" configurationId="JUnit" />
531
+    </history-entry>
529 532
   </component>
530 533
   <component name="TimeTrackingManager">
531
-    <option name="totallyTimeSpent" value="19234000" />
534
+    <option name="totallyTimeSpent" value="19898000" />
532 535
   </component>
533 536
   <component name="ToolWindowManager">
534 537
     <frame x="20" y="49" width="1440" height="877" extended-state="0" />
535 538
     <editor active="true" />
536 539
     <layout>
537
-      <window_info content_ui="combo" id="Project" order="0" visible="true" weight="0.26037195" />
540
+      <window_info active="true" content_ui="combo" id="Project" order="0" visible="true" weight="0.26037195" />
538 541
       <window_info id="Structure" order="1" weight="0.25" />
539 542
       <window_info id="Nl-Palette" order="2" />
540 543
       <window_info id="Favorites" order="3" side_tool="true" />
@@ -545,7 +548,7 @@
545 548
       <window_info anchor="bottom" id="Messages" weight="0.3299363" />
546 549
       <window_info anchor="bottom" id="Message" order="0" />
547 550
       <window_info anchor="bottom" id="Find" order="1" />
548
-      <window_info active="true" anchor="bottom" id="Run" order="2" visible="true" weight="0.3299363" />
551
+      <window_info anchor="bottom" id="Run" order="2" visible="true" weight="0.3299363" />
549 552
       <window_info anchor="bottom" id="Debug" order="3" weight="0.4" />
550 553
       <window_info anchor="bottom" id="Cvs" order="4" weight="0.25" />
551 554
       <window_info anchor="bottom" id="Inspection" order="5" weight="0.4" />
@@ -636,6 +639,13 @@
636 639
         </state>
637 640
       </provider>
638 641
     </entry>
642
+    <entry file="file://$PROJECT_DIR$/src/main/java/com/zipcodewilmington/productmanager/ProductManager.java">
643
+      <provider selected="true" editor-type-id="text-editor">
644
+        <state relative-caret-position="75">
645
+          <caret line="5" selection-start-line="5" selection-end-line="5" />
646
+        </state>
647
+      </provider>
648
+    </entry>
639 649
     <entry file="file://$PROJECT_DIR$/src/test/java/com/zipcodewilmington/productmanager/ProductTest.java">
640 650
       <provider selected="true" editor-type-id="text-editor">
641 651
         <state relative-caret-position="346">
@@ -648,19 +658,21 @@
648 658
     </entry>
649 659
     <entry file="file://$PROJECT_DIR$/src/main/java/com/zipcodewilmington/productmanager/Inventory.java">
650 660
       <provider selected="true" editor-type-id="text-editor">
651
-        <state relative-caret-position="270">
652
-          <caret line="18" column="33" selection-start-line="18" selection-start-column="32" selection-end-line="18" selection-end-column="33" />
661
+        <state relative-caret-position="144">
662
+          <caret line="11" column="41" selection-start-line="11" selection-start-column="41" selection-end-line="11" selection-end-column="41" />
653 663
           <folding>
654 664
             <element signature="imports" expanded="true" />
655 665
             <element signature="e#170#179#0" expanded="true" />
666
+            <element signature="e#259#260#0" expanded="true" />
667
+            <element signature="e#307#308#0" expanded="true" />
656 668
           </folding>
657 669
         </state>
658 670
       </provider>
659 671
     </entry>
660 672
     <entry file="file://$PROJECT_DIR$/src/test/java/com/zipcodewilmington/productmanager/InventoryTest.java">
661 673
       <provider selected="true" editor-type-id="text-editor">
662
-        <state relative-caret-position="675">
663
-          <caret line="45" column="41" lean-forward="true" selection-start-line="45" selection-start-column="41" selection-end-line="45" selection-end-column="41" />
674
+        <state relative-caret-position="282">
675
+          <caret line="23" lean-forward="true" selection-start-line="23" selection-end-line="23" />
664 676
           <folding>
665 677
             <element signature="imports" expanded="true" />
666 678
           </folding>

+ 4
- 0
src/main/java/com/zipcodewilmington/productmanager/Inventory.java 파일 보기

@@ -8,6 +8,10 @@ public class Inventory {
8 8
 
9 9
     List<Product> productList = new ArrayList<Product>();
10 10
 
11
+    public void addToList(Product newProduct) {
12
+        this.productList.add(newProduct);
13
+    }
14
+
11 15
     public int getTotalQuantity() {
12 16
         int totalQuantity = 0;
13 17
         for (Product eachProduct: this.productList) {

+ 0
- 4
src/main/java/com/zipcodewilmington/productmanager/ProductManager.java 파일 보기

@@ -1,4 +0,0 @@
1
-package com.zipcodewilmington.productmanager;
2
-
3
-public class ProductManager {
4
-}

+ 1
- 3
src/test/java/com/zipcodewilmington/productmanager/InventoryTest.java 파일 보기

@@ -11,14 +11,12 @@ public class InventoryTest {
11 11
     public InventoryTest() {
12 12
         testInventory = new Inventory();
13 13
         testProduct = new Product("milk", 10, 2.50);
14
-        testInventory.productList.add(testProduct);
14
+        testInventory.addToList(testProduct);
15 15
     }
16 16
 
17 17
     @Test
18 18
     public void testAddProduct() {
19 19
         // Given
20
-        // Add to list
21
-        // Check the list for it
22 20
         boolean expectedToken = true;
23 21
 
24 22
         // When