Nick Satinover 6 years ago
parent
commit
d3b5e5470a

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

@@ -41,7 +41,7 @@ public class Group<TypeOfId extends Serializable,
41 41
 
42 42
     @Override
43 43
     public Boolean has(IdentifiableInterface object) {
44
-        return null;
44
+        return group.contains(object);
45 45
     }
46 46
 
47 47
     @Override

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

@@ -18,9 +18,9 @@ public class ActionFigure<TypeofId extends Serializable> implements Identifiable
18 18
     }
19 19
 
20 20
 
21
-    public Class getIdentityType() {
21
+    public Class<? extends Serializable> getIdentityType() { // <? extends Serializable>
22 22
         return id.getClass();
23
-        // <? extends Serializable>
23
+
24 24
     }
25 25
 
26 26
 

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

@@ -17,7 +17,7 @@ public class Person<TypeofId extends Serializable> implements IdentifiableInterf
17 17
         return id;
18 18
     }
19 19
 
20
-    public Class getIdentityType() {
20
+    public Class<? extends Serializable> getIdentityType() { //<? extends Serializable>
21 21
         return id.getClass();
22 22
     }
23 23
 }

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

@@ -41,6 +41,7 @@ public class DeleteByIdTest {
41 41
         // when
42 42
         for (int i = 0; i < numberOfObjectsToAdd; i++) {
43 43
             IdentifiableInterface<TypeOfId> identifiable = supplier.get();
44
+            identifiable.getIdentity();
44 45
             group.insert(identifiable);
45 46
             if(!group.has(identifiable)) {
46 47
                 throw new UnsupportedOperationException("`.insert` has not yet been implemented");

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

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

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

@@ -26,7 +26,7 @@ public class FilterTest {
26 26
 
27 27
     @Test
28 28
     public void testRandom() {
29
-        test(Math.abs(new Random().nextInt()));
29
+        test(1000);
30 30
     }
31 31
 
32 32
 
@@ -42,6 +42,7 @@ public class FilterTest {
42 42
         // when
43 43
         for (int i = 0; i < numberOfObjectsToAdd; i++) {
44 44
             IdentifiableInterface<TypeOfId> identifiable = supplier.get();
45
+            // identifiable.setId((TypeOfId) "foo");
45 46
             group.insert(identifiable);
46 47
 
47 48
             // then

+ 6
- 0
src/test/java/com/zipcodewilmington/generic/identifiables/ActionFigureTest.java View File

@@ -1,6 +1,7 @@
1 1
 package com.zipcodewilmington.generic.identifiables;
2 2
 
3 3
 import org.junit.Assert;
4
+import org.junit.Before;
4 5
 import org.junit.Test;
5 6
 
6 7
 /**
@@ -9,6 +10,11 @@ import org.junit.Test;
9 10
 public class ActionFigureTest {
10 11
     ActionFigure actionFigure = new ActionFigure();
11 12
 
13
+    @Before
14
+    public void setUp() throws Exception{
15
+        actionFigure.setId(1L);
16
+    }
17
+
12 18
     @Test
13 19
     public void testImplementation() {
14 20
         Assert.assertTrue(actionFigure instanceof IdentifiableInterface);

+ 9
- 0
src/test/java/com/zipcodewilmington/generic/identifiables/PersonTest.java View File

@@ -1,12 +1,21 @@
1 1
 package com.zipcodewilmington.generic.identifiables;
2 2
 
3 3
 import org.junit.Assert;
4
+import org.junit.Before;
4 5
 import org.junit.Test;
5 6
 
6 7
 /**
7 8
  * @author leon on 06/12/2018.
8 9
  */
9 10
 public class PersonTest {
11
+    Person<String> person = new Person<>();
12
+
13
+    @Before
14
+    public void setUp(){
15
+        person.setId("new");
16
+    }
17
+
18
+
10 19
     @Test
11 20
     public void testImplementation() {
12 21
         Assert.assertTrue(new Person() instanceof IdentifiableInterface);