Browse Source

{Sets finished}

Jacqueline Joson 6 years ago
parent
commit
7ae6d125d6
2 changed files with 96 additions and 66 deletions
  1. 59
    64
      .idea/workspace.xml
  2. 37
    2
      src/test/java/MySetTest.java

+ 59
- 64
.idea/workspace.xml View File

@@ -2,8 +2,7 @@
2 2
 <project version="4">
3 3
   <component name="ChangeListManager">
4 4
     <list default="true" id="ada34df4-dfd8-4fb3-8f80-b9a79b2fcc05" name="Default Changelist" comment="">
5
-      <change beforePath="$PROJECT_DIR$/src/main/java/MyArrayList.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/MyArrayList.java" afterDir="false" />
6
-      <change beforePath="$PROJECT_DIR$/src/main/java/MySet.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/MySet.java" afterDir="false" />
5
+      <change beforePath="$PROJECT_DIR$/src/test/java/MySetTest.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/test/java/MySetTest.java" afterDir="false" />
7 6
     </list>
8 7
     <ignored path="$PROJECT_DIR$/target/" />
9 8
     <option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
@@ -42,13 +41,13 @@
42 41
       </usages-collector>
43 42
       <usages-collector id="statistics.file.extensions.edit">
44 43
         <counts>
45
-          <entry key="java" value="6987" />
44
+          <entry key="java" value="7428" />
46 45
           <entry key="txt" value="59" />
47 46
         </counts>
48 47
       </usages-collector>
49 48
       <usages-collector id="statistics.file.types.edit">
50 49
         <counts>
51
-          <entry key="JAVA" value="6987" />
50
+          <entry key="JAVA" value="7428" />
52 51
           <entry key="PLAIN_TEXT" value="59" />
53 52
         </counts>
54 53
       </usages-collector>
@@ -76,7 +75,7 @@
76 75
       <file pinned="false" current-in-tab="false">
77 76
         <entry file="file://$PROJECT_DIR$/src/main/java/MySet.java">
78 77
           <provider selected="true" editor-type-id="text-editor">
79
-            <state relative-caret-position="56">
78
+            <state relative-caret-position="-94">
80 79
               <caret line="10" column="46" lean-forward="true" selection-start-line="10" selection-start-column="46" selection-end-line="10" selection-end-column="46" />
81 80
               <folding>
82 81
                 <element signature="e#84#85#0" expanded="true" />
@@ -101,8 +100,8 @@
101 100
       <file pinned="false" current-in-tab="true">
102 101
         <entry file="file://$PROJECT_DIR$/src/test/java/MySetTest.java">
103 102
           <provider selected="true" editor-type-id="text-editor">
104
-            <state relative-caret-position="248">
105
-              <caret line="55" column="29" selection-start-line="55" selection-start-column="29" selection-end-line="55" selection-end-column="29" />
103
+            <state relative-caret-position="259">
104
+              <caret line="74" column="34" lean-forward="true" selection-start-line="74" selection-start-column="34" selection-end-line="74" selection-end-column="34" />
106 105
               <folding>
107 106
                 <element signature="imports" expanded="true" />
108 107
                 <element signature="e#210#219#0" expanded="true" />
@@ -114,7 +113,7 @@
114 113
       <file pinned="false" current-in-tab="false">
115 114
         <entry file="file://$PROJECT_DIR$/src/test/java/MyArrayListTest.java">
116 115
           <provider selected="true" editor-type-id="text-editor">
117
-            <state relative-caret-position="109">
116
+            <state relative-caret-position="-410">
118 117
               <caret line="11" column="66" selection-start-line="11" selection-start-column="59" selection-end-line="11" selection-end-column="66" />
119 118
               <folding>
120 119
                 <element signature="imports" expanded="true" />
@@ -216,7 +215,7 @@
216 215
   <component name="PropertiesComponent">
217 216
     <property name="WebServerToolWindowFactoryState" value="false" />
218 217
     <property name="aspect.path.notification.shown" value="true" />
219
-    <property name="com.android.tools.idea.instantapp.provision.ProvisionBeforeRunTaskProvider.myTimeStamp" value="1542409926473" />
218
+    <property name="com.android.tools.idea.instantapp.provision.ProvisionBeforeRunTaskProvider.myTimeStamp" value="1542420975158" />
220 219
     <property name="com.intellij.testIntegration.createTest.CreateTestDialog.defaultLibrary" value="JUnit4" />
221 220
     <property name="com.intellij.testIntegration.createTest.CreateTestDialog.defaultLibrarySuperClass.JUnit4" value="" />
222 221
     <property name="com.intellij.testIntegration.createTest.CreateTestDialog.includeInheritedMembers" value="true" />
@@ -248,69 +247,65 @@
248 247
       </list>
249 248
     </option>
250 249
   </component>
251
-  <component name="RunManager" selected="JUnit.MySetTest">
252
-    <configuration name="MySetTest" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
250
+  <component name="RunManager" selected="JUnit.All in generics">
251
+    <configuration name="All in generics" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
253 252
       <module name="generics" />
254 253
       <option name="PACKAGE_NAME" value="" />
255
-      <option name="MAIN_CLASS_NAME" value="MySetTest" />
254
+      <option name="TEST_OBJECT" value="package" />
256 255
       <method v="2">
257 256
         <option name="Make" enabled="true" />
258 257
       </method>
259 258
     </configuration>
260
-    <configuration name="MySetTest.addTest" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
259
+    <configuration name="MyArrayListTest" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
261 260
       <module name="generics" />
262 261
       <option name="PACKAGE_NAME" value="" />
263
-      <option name="MAIN_CLASS_NAME" value="MySetTest" />
264
-      <option name="METHOD_NAME" value="addTest" />
265
-      <option name="TEST_OBJECT" value="method" />
262
+      <option name="MAIN_CLASS_NAME" value="MyArrayListTest" />
266 263
       <method v="2">
267 264
         <option name="Make" enabled="true" />
268 265
       </method>
269 266
     </configuration>
270
-    <configuration name="MySetTest.clearTest" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
267
+    <configuration name="MySetTest" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
271 268
       <module name="generics" />
272 269
       <option name="PACKAGE_NAME" value="" />
273 270
       <option name="MAIN_CLASS_NAME" value="MySetTest" />
274
-      <option name="METHOD_NAME" value="clearTest" />
275
-      <option name="TEST_OBJECT" value="method" />
276 271
       <method v="2">
277 272
         <option name="Make" enabled="true" />
278 273
       </method>
279 274
     </configuration>
280
-    <configuration name="MySetTest.getTest" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
275
+    <configuration name="MySetTest.containsNopeTest" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
281 276
       <module name="generics" />
282 277
       <option name="PACKAGE_NAME" value="" />
283 278
       <option name="MAIN_CLASS_NAME" value="MySetTest" />
284
-      <option name="METHOD_NAME" value="getTest" />
279
+      <option name="METHOD_NAME" value="containsNopeTest" />
285 280
       <option name="TEST_OBJECT" value="method" />
286 281
       <method v="2">
287 282
         <option name="Make" enabled="true" />
288 283
       </method>
289 284
     </configuration>
290
-    <configuration name="MySetTest.sizeTest" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
285
+    <configuration name="MySetTest.containsTest" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
291 286
       <module name="generics" />
292 287
       <option name="PACKAGE_NAME" value="" />
293 288
       <option name="MAIN_CLASS_NAME" value="MySetTest" />
294
-      <option name="METHOD_NAME" value="sizeTest" />
289
+      <option name="METHOD_NAME" value="containsTest" />
295 290
       <option name="TEST_OBJECT" value="method" />
296 291
       <method v="2">
297 292
         <option name="Make" enabled="true" />
298 293
       </method>
299 294
     </configuration>
300 295
     <list>
296
+      <item itemvalue="JUnit.MySetTest.containsTest" />
297
+      <item itemvalue="JUnit.MySetTest.containsNopeTest" />
301 298
       <item itemvalue="JUnit.MySetTest" />
302
-      <item itemvalue="JUnit.MySetTest.addTest" />
303
-      <item itemvalue="JUnit.MySetTest.getTest" />
304
-      <item itemvalue="JUnit.MySetTest.sizeTest" />
305
-      <item itemvalue="JUnit.MySetTest.clearTest" />
299
+      <item itemvalue="JUnit.MyArrayListTest" />
300
+      <item itemvalue="JUnit.All in generics" />
306 301
     </list>
307 302
     <recent_temporary>
308 303
       <list>
304
+        <item itemvalue="JUnit.All in generics" />
305
+        <item itemvalue="JUnit.MyArrayListTest" />
309 306
         <item itemvalue="JUnit.MySetTest" />
310
-        <item itemvalue="JUnit.MySetTest.clearTest" />
311
-        <item itemvalue="JUnit.MySetTest.sizeTest" />
312
-        <item itemvalue="JUnit.MySetTest.getTest" />
313
-        <item itemvalue="JUnit.MySetTest.addTest" />
307
+        <item itemvalue="JUnit.MySetTest.containsNopeTest" />
308
+        <item itemvalue="JUnit.MySetTest.containsTest" />
314 309
       </list>
315 310
     </recent_temporary>
316 311
   </component>
@@ -324,44 +319,44 @@
324 319
       <option name="number" value="Default" />
325 320
       <option name="presentableId" value="Default" />
326 321
       <updated>1542236797011</updated>
327
-      <workItem from="1542236798436" duration="35275000" />
322
+      <workItem from="1542236798436" duration="36119000" />
328 323
     </task>
329 324
     <servers />
330 325
   </component>
331 326
   <component name="TestHistory">
332
-    <history-entry file="MySetTest_addTest - 2018.11.16 at 17h 40m 43s.xml">
327
+    <history-entry file="MySetTest_addTest - 2018.11.16 at 18h 02m 27s.xml">
333 328
       <configuration name="MySetTest.addTest" configurationId="JUnit" />
334 329
     </history-entry>
335
-    <history-entry file="MySetTest_addTest - 2018.11.16 at 17h 54m 24s.xml">
330
+    <history-entry file="MySetTest_addTest - 2018.11.16 at 18h 02m 31s.xml">
336 331
       <configuration name="MySetTest.addTest" configurationId="JUnit" />
337 332
     </history-entry>
338
-    <history-entry file="MySetTest_addTest - 2018.11.16 at 17h 57m 59s.xml">
339
-      <configuration name="MySetTest.addTest" configurationId="JUnit" />
333
+    <history-entry file="MySetTest_getTest - 2018.11.16 at 18h 04m 18s.xml">
334
+      <configuration name="MySetTest.getTest" configurationId="JUnit" />
340 335
     </history-entry>
341
-    <history-entry file="MySetTest_addTest - 2018.11.16 at 18h 00m 09s.xml">
342
-      <configuration name="MySetTest.addTest" configurationId="JUnit" />
336
+    <history-entry file="MySetTest_sizeTest - 2018.11.16 at 18h 09m 05s.xml">
337
+      <configuration name="MySetTest.sizeTest" configurationId="JUnit" />
343 338
     </history-entry>
344
-    <history-entry file="MySetTest_addTest - 2018.11.16 at 18h 00m 13s.xml">
345
-      <configuration name="MySetTest.addTest" configurationId="JUnit" />
339
+    <history-entry file="MySetTest_clearTest - 2018.11.16 at 18h 10m 53s.xml">
340
+      <configuration name="MySetTest.clearTest" configurationId="JUnit" />
346 341
     </history-entry>
347
-    <history-entry file="MySetTest_addTest - 2018.11.16 at 18h 00m 16s.xml">
348
-      <configuration name="MySetTest.addTest" configurationId="JUnit" />
342
+    <history-entry file="MySetTest_clearTest - 2018.11.16 at 18h 11m 41s.xml">
343
+      <configuration name="MySetTest.clearTest" configurationId="JUnit" />
349 344
     </history-entry>
350
-    <history-entry file="MySetTest_addTest - 2018.11.16 at 18h 02m 23s.xml">
351
-      <configuration name="MySetTest.addTest" configurationId="JUnit" />
345
+    <history-entry file="MySetTest - 2018.11.16 at 18h 12m 08s.xml">
346
+      <configuration name="MySetTest" configurationId="JUnit" />
352 347
     </history-entry>
353
-    <history-entry file="MySetTest_addTest - 2018.11.16 at 18h 02m 27s.xml">
354
-      <configuration name="MySetTest.addTest" configurationId="JUnit" />
348
+    <history-entry file="MySetTest_clearTest - 2018.11.16 at 21h 08m 27s.xml">
349
+      <configuration name="MySetTest.clearTest" configurationId="JUnit" />
355 350
     </history-entry>
356
-    <history-entry file="MySetTest_addTest - 2018.11.16 at 18h 02m 31s.xml">
357
-      <configuration name="MySetTest.addTest" configurationId="JUnit" />
351
+    <history-entry file="MySetTest_isEmptyTest - 2018.11.16 at 21h 10m 48s.xml">
352
+      <configuration name="MySetTest.isEmptyTest" configurationId="JUnit" />
358 353
     </history-entry>
359
-    <history-entry file="MySetTest_getTest - 2018.11.16 at 18h 04m 18s.xml">
360
-      <configuration name="MySetTest.getTest" configurationId="JUnit" />
354
+    <history-entry file="MySetTest_isEmptyTest2 - 2018.11.16 at 21h 11m 58s.xml">
355
+      <configuration name="MySetTest.isEmptyTest2" configurationId="JUnit" />
361 356
     </history-entry>
362 357
   </component>
363 358
   <component name="TimeTrackingManager">
364
-    <option name="totallyTimeSpent" value="35275000" />
359
+    <option name="totallyTimeSpent" value="36119000" />
365 360
   </component>
366 361
   <component name="ToolWindowManager">
367 362
     <frame x="0" y="23" width="1280" height="712" extended-state="0" />
@@ -553,9 +548,19 @@
553 548
         </state>
554 549
       </provider>
555 550
     </entry>
551
+    <entry file="file://$PROJECT_DIR$/src/test/java/MyArrayListTest.java">
552
+      <provider selected="true" editor-type-id="text-editor">
553
+        <state relative-caret-position="-410">
554
+          <caret line="11" column="66" selection-start-line="11" selection-start-column="59" selection-end-line="11" selection-end-column="66" />
555
+          <folding>
556
+            <element signature="imports" expanded="true" />
557
+          </folding>
558
+        </state>
559
+      </provider>
560
+    </entry>
556 561
     <entry file="file://$PROJECT_DIR$/src/main/java/MySet.java">
557 562
       <provider selected="true" editor-type-id="text-editor">
558
-        <state relative-caret-position="56">
563
+        <state relative-caret-position="-94">
559 564
           <caret line="10" column="46" lean-forward="true" selection-start-line="10" selection-start-column="46" selection-end-line="10" selection-end-column="46" />
560 565
           <folding>
561 566
             <element signature="e#84#85#0" expanded="true" />
@@ -576,20 +581,10 @@
576 581
         </state>
577 582
       </provider>
578 583
     </entry>
579
-    <entry file="file://$PROJECT_DIR$/src/test/java/MyArrayListTest.java">
580
-      <provider selected="true" editor-type-id="text-editor">
581
-        <state relative-caret-position="109">
582
-          <caret line="11" column="66" selection-start-line="11" selection-start-column="59" selection-end-line="11" selection-end-column="66" />
583
-          <folding>
584
-            <element signature="imports" expanded="true" />
585
-          </folding>
586
-        </state>
587
-      </provider>
588
-    </entry>
589 584
     <entry file="file://$PROJECT_DIR$/src/test/java/MySetTest.java">
590 585
       <provider selected="true" editor-type-id="text-editor">
591
-        <state relative-caret-position="248">
592
-          <caret line="55" column="29" selection-start-line="55" selection-start-column="29" selection-end-line="55" selection-end-column="29" />
586
+        <state relative-caret-position="259">
587
+          <caret line="74" column="34" lean-forward="true" selection-start-line="74" selection-start-column="34" selection-end-line="74" selection-end-column="34" />
593 588
           <folding>
594 589
             <element signature="imports" expanded="true" />
595 590
             <element signature="e#210#219#0" expanded="true" />

+ 37
- 2
src/test/java/MySetTest.java View File

@@ -40,16 +40,51 @@ public class MySetTest {
40 40
         //when
41 41
         mySet.clear();
42 42
         //then
43
-        
44
-
43
+        Assert.assertNull(numbers[1]);
45 44
     }
46 45
 
47 46
     @Test
48 47
     public void isEmptyTest() {
48
+        //given
49
+        String [] words = {"Hopefully", "I'm", "doing", "this", "right"};
50
+        MySet<String> wordSet = new MySet<>(words);
51
+        //when
52
+        boolean actual = wordSet.isEmpty();
53
+        //then
54
+        Assert.assertFalse(actual);
55
+    }
56
+
57
+    @Test
58
+    public void isEmptyTest2() {
59
+        //given
60
+        String [] noWords = {};
61
+        MySet<String> wordSet = new MySet<>(noWords);
62
+        //when
63
+        boolean actual = wordSet.isEmpty();
64
+        //then
65
+        Assert.assertTrue(actual);
49 66
     }
50 67
 
51 68
     @Test
52 69
     public void containsTest() {
70
+        //given
71
+        Integer [] numbers = {1, 3, 6, 15, 25};
72
+        MySet<Integer> numSet = new MySet<>(numbers);
73
+        //when
74
+        boolean actual = numSet.contains(25);
75
+        //then
76
+        Assert.assertTrue(actual);
77
+    }
78
+
79
+    @Test
80
+    public void containsNopeTest() {
81
+        //given
82
+        Integer [] numbers = {1, 3, 6, 15, 25};
83
+        MySet<Integer> numSet = new MySet<>(numbers);
84
+        //when
85
+        boolean actual = numSet.contains(30);
86
+        //then
87
+        Assert.assertFalse(actual);
53 88
     }
54 89
 
55 90
     @Test