Browse Source

testchagnes

Seth 6 years ago
parent
commit
5a7020d3b1

+ 6
- 2
src/main/java/com/zipcodewilmington/generic/group/Group.java View File

6
 import java.util.ArrayList;
6
 import java.util.ArrayList;
7
 import java.util.List;
7
 import java.util.List;
8
 import java.util.function.Predicate;
8
 import java.util.function.Predicate;
9
+import java.util.stream.Collectors;
9
 
10
 
10
 /**
11
 /**
11
  * @author leon on 06/12/2018.
12
  * @author leon on 06/12/2018.
46
     }
47
     }
47
 
48
 
48
     @Override
49
     @Override
49
-    public List filter(Predicate predicate) {
50
-        return null;
50
+    public List filter(Predicate<TypeOfEntity> predicate) {
51
+
52
+        return group.stream()
53
+                .filter(predicate)
54
+                .collect(Collectors.toList());
51
     }
55
     }
52
 }
56
 }

+ 6
- 0
src/main/java/com/zipcodewilmington/generic/identifiables/ActionFigure.java View File

1
 package com.zipcodewilmington.generic.identifiables;
1
 package com.zipcodewilmington.generic.identifiables;
2
 
2
 
3
+import java.awt.event.ActionEvent;
3
 import java.io.Serializable;
4
 import java.io.Serializable;
4
 
5
 
5
 /**
6
 /**
7
  */
8
  */
8
 public class ActionFigure implements IdentifiableInterface<Long> {
9
 public class ActionFigure implements IdentifiableInterface<Long> {
9
     private Long id;
10
     private Long id;
11
+    public ActionFigure(){
12
+        id = 100L;
13
+    }
10
 
14
 
11
     @Override
15
     @Override
12
     public Long getIdentity() {
16
     public Long getIdentity() {
17
         return Long.class;
21
         return Long.class;
18
     }
22
     }
19
 }
23
 }
24
+
25
+

+ 4
- 0
src/main/java/com/zipcodewilmington/generic/identifiables/Person.java View File

8
 public class Person implements IdentifiableInterface<String> {
8
 public class Person implements IdentifiableInterface<String> {
9
     private String id;
9
     private String id;
10
 
10
 
11
+    public Person(){
12
+        id = "krufty";
13
+    }
14
+
11
     @Override
15
     @Override
12
     public String getIdentity() {
16
     public String getIdentity() {
13
         return id;
17
         return id;

+ 1
- 1
src/test/java/com/zipcodewilmington/generic/group/CountTest.java View File

26
 
26
 
27
     @Test
27
     @Test
28
     public void testRandom() {
28
     public void testRandom() {
29
-        test(Math.abs(new Random().nextInt()));
29
+        test(1000);
30
     }
30
     }
31
 
31
 
32
     private void test(Integer numberOfObjectsToAdd) {
32
     private void test(Integer numberOfObjectsToAdd) {

+ 1
- 1
src/test/java/com/zipcodewilmington/generic/group/DeleteByIdTest.java View File

26
 
26
 
27
     @Test
27
     @Test
28
     public void testRandom() {
28
     public void testRandom() {
29
-        test(Math.abs(new Random().nextInt()));
29
+        test(1000);
30
     }
30
     }
31
 
31
 
32
     private void test(Integer numberOfObjectsToAdd) {
32
     private void test(Integer numberOfObjectsToAdd) {

+ 1
- 1
src/test/java/com/zipcodewilmington/generic/group/DeleteByValueTest.java View File

26
 
26
 
27
     @Test
27
     @Test
28
     public void testRandom() {
28
     public void testRandom() {
29
-        test(Math.abs(new Random().nextInt()));
29
+        test(1000);
30
     }
30
     }
31
 
31
 
32
     private void test(Integer numberOfObjectsToAdd) {
32
     private void test(Integer numberOfObjectsToAdd) {

+ 2
- 2
src/test/java/com/zipcodewilmington/generic/group/FilterTest.java View File

26
 
26
 
27
     @Test
27
     @Test
28
     public void testRandom() {
28
     public void testRandom() {
29
-        test(Math.abs(new Random().nextInt()));
29
+        test(1000);
30
     }
30
     }
31
 
31
 
32
 
32
 
45
             group.insert(identifiable);
45
             group.insert(identifiable);
46
 
46
 
47
             // then
47
             // then
48
-            Assert.assertFalse(group.filter(obj -> ((IdentifiableInterface)(obj)).getIdentity().equals(identifiable)).contains(identifiable));
48
+            Assert.assertTrue(group.filter(obj -> ((IdentifiableInterface)(obj)).getIdentity().equals(identifiable)).contains(identifiable));
49
         }
49
         }
50
     }
50
     }
51
 }
51
 }

+ 1
- 1
src/test/java/com/zipcodewilmington/generic/group/HasByIdTest.java View File

26
 
26
 
27
     @Test
27
     @Test
28
     public void testRandom() {
28
     public void testRandom() {
29
-        test(Math.abs(new Random().nextInt()));
29
+        test(1000);
30
     }
30
     }
31
 
31
 
32
     private void test(Integer numberOfObjectsToAdd) {
32
     private void test(Integer numberOfObjectsToAdd) {

+ 2
- 2
src/test/java/com/zipcodewilmington/generic/group/InsertTest.java View File

26
 
26
 
27
     @Test
27
     @Test
28
     public void testRandom() {
28
     public void testRandom() {
29
-        test(Math.abs(new Random().nextInt()));
29
+        test(1000);
30
     }
30
     }
31
 
31
 
32
     private void test(Integer numberOfObjectsToAdd) {
32
     private void test(Integer numberOfObjectsToAdd) {
44
             group.insert(identifiable);
44
             group.insert(identifiable);
45
 
45
 
46
             // then
46
             // then
47
-            Assert.assertFalse(group.has(identifiable));
47
+            Assert.assertTrue(group.has(identifiable));
48
         }
48
         }
49
     }
49
     }
50
 }
50
 }