Parcourir la source

converted project to lambda exercise

Leon il y a 7 ans
Parent
révision
50120a249d
33 fichiers modifiés avec 1111 ajouts et 245 suppressions
  1. 2
    2
      .idea/compiler.xml
  2. 0
    15
      .idea/misc.xml
  3. 6
    0
      .idea/vcs.xml
  4. 824
    181
      .idea/workspace.xml
  5. 1
    1
      looptest.iml
  6. 5
    5
      src/main/java/com/zipcodewilmington/lambdas/StreamFilter.java
  7. 26
    1
      src/main/java/com/zipcodewilmington/lambdas/StreamMap.java
  8. 4
    2
      src/main/java/com/zipcodewilmington/lambdas/anthropoid/Person.java
  9. 10
    5
      src/main/java/com/zipcodewilmington/lambdas/anthropoid/PersonFactory.java
  10. 15
    8
      src/main/java/com/zipcodewilmington/lambdas/exercises/ArrayConversion.java
  11. 17
    1
      src/main/java/com/zipcodewilmington/lambdas/exercises/ConversionAgent.java
  12. 27
    2
      src/main/java/com/zipcodewilmington/lambdas/exercises/ListConversion.java
  13. 26
    1
      src/main/java/com/zipcodewilmington/lambdas/exercises/StreamConversion.java
  14. 16
    7
      src/main/java/com/zipcodewilmington/lambdas/tools/RandomUtils.java
  15. 40
    1
      src/main/java/com/zipcodewilmington/lambdas/tools/ReflectionUtils.java
  16. 26
    0
      src/main/java/com/zipcodewilmington/lambdas/tools/StringUtils.java
  17. 46
    0
      src/test/java/com/zipcodewilmington/lambdas/TestPersonFactory.java
  18. 8
    8
      src/test/java/com/zipcodewilmington/lambdas/TestStreamFilter.java
  19. 1
    2
      src/test/java/com/zipcodewilmington/lambdas/TestStreamMap.java
  20. 11
    3
      src/test/java/com/zipcodewilmington/lambdas/TestSuiteFullRegression.java
  21. BIN
      target/classes/com/zipcodewilmington/lambdas/LambdaFilter.class
  22. BIN
      target/classes/com/zipcodewilmington/lambdas/MapSyntax.class
  23. BIN
      target/classes/com/zipcodewilmington/lambdas/anthropoid/Person$PersonProperty.class
  24. BIN
      target/classes/com/zipcodewilmington/lambdas/anthropoid/Person.class
  25. BIN
      target/classes/com/zipcodewilmington/lambdas/anthropoid/PersonFactory.class
  26. BIN
      target/classes/com/zipcodewilmington/lambdas/tools/RandomUtils.class
  27. BIN
      target/classes/com/zipcodewilmington/lambdas/tools/ReflectionUtils$1.class
  28. BIN
      target/classes/com/zipcodewilmington/lambdas/tools/ReflectionUtils.class
  29. BIN
      target/classes/com/zipcodewilmington/lambdas/tools/StringUtils.class
  30. BIN
      target/test-classes/com/zipcodewilmington/lambdas/TestLambdaFilter.class
  31. BIN
      target/test-classes/com/zipcodewilmington/lambdas/TestMapSyntax.class
  32. BIN
      target/test-classes/com/zipcodewilmington/lambdas/TestPersonFactory.class
  33. BIN
      target/test-classes/com/zipcodewilmington/lambdas/TestSuiteFullRegression.class

+ 2
- 2
.idea/compiler.xml Voir le fichier

@@ -9,8 +9,8 @@
9 9
         <module name="looptest" />
10 10
       </profile>
11 11
     </annotationProcessing>
12
-    <bytecodeTargetLevel>
13
-      <module name="looptest" target="1.5" />
12
+    <bytecodeTargetLevel target="1.8">
13
+      <module name="looptest" target="1.8" />
14 14
     </bytecodeTargetLevel>
15 15
   </component>
16 16
 </project>

+ 0
- 15
.idea/misc.xml Voir le fichier

@@ -26,19 +26,4 @@
26 26
   <component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="1.8" project-jdk-type="JavaSDK">
27 27
     <output url="file://$PROJECT_DIR$/out" />
28 28
   </component>
29
-  <component name="masterDetails">
30
-    <states>
31
-      <state key="ScopeChooserConfigurable.UI">
32
-        <settings>
33
-          <splitter-proportions>
34
-            <option name="proportions">
35
-              <list>
36
-                <option value="0.2" />
37
-              </list>
38
-            </option>
39
-          </splitter-proportions>
40
-        </settings>
41
-      </state>
42
-    </states>
43
-  </component>
44 29
 </project>

+ 6
- 0
.idea/vcs.xml Voir le fichier

@@ -0,0 +1,6 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<project version="4">
3
+  <component name="VcsDirectoryMappings">
4
+    <mapping directory="$PROJECT_DIR$" vcs="Git" />
5
+  </component>
6
+</project>

+ 824
- 181
.idea/workspace.xml
Fichier diff supprimé car celui-ci est trop grand
Voir le fichier


+ 1
- 1
looptest.iml Voir le fichier

@@ -1,6 +1,6 @@
1 1
 <?xml version="1.0" encoding="UTF-8"?>
2 2
 <module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
3
-  <component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_5">
3
+  <component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
4 4
     <output url="file://$MODULE_DIR$/target/classes" />
5 5
     <output-test url="file://$MODULE_DIR$/target/test-classes" />
6 6
     <content url="file://$MODULE_DIR$">

+ 5
- 5
src/main/java/com/zipcodewilmington/lambdas/StreamFilter.java Voir le fichier

@@ -10,14 +10,14 @@ import java.util.stream.Stream;
10 10
 /**
11 11
  * Created by leon on 5/2/17.
12 12
  */
13
-public class LambdaFilter {
13
+public class StreamFilter {
14 14
     private final Stream<Person> personStream;
15 15
     public final String startingCharacter;
16 16
 
17 17
     /**
18 18
      * No arg constructor
19 19
      */
20
-    public LambdaFilter() {
20
+    public StreamFilter() {
21 21
         this(PersonFactory.createPersonStream(100), 'A');
22 22
     }
23 23
 
@@ -25,7 +25,7 @@ public class LambdaFilter {
25 25
      * @param people - Array of person objects
26 26
      * @param startingCharacter - character to filter by
27 27
      */
28
-    public LambdaFilter(Person[] people, Character startingCharacter) {
28
+    public StreamFilter(Person[] people, Character startingCharacter) {
29 29
         this(Stream.of(people), startingCharacter);
30 30
     }
31 31
 
@@ -33,7 +33,7 @@ public class LambdaFilter {
33 33
      * @param people - List of person objects
34 34
      * @param startingCharacter - character to filter by
35 35
      */
36
-    public LambdaFilter(List<Person> people, Character startingCharacter) {
36
+    public StreamFilter(List<Person> people, Character startingCharacter) {
37 37
         this(people.stream(), startingCharacter);
38 38
     }
39 39
 
@@ -42,7 +42,7 @@ public class LambdaFilter {
42 42
      * @param people - Stream of person objects
43 43
      * @param startingCharacter - character to filter by
44 44
      */
45
-    public LambdaFilter(Stream<Person> people, Character startingCharacter) {
45
+    public StreamFilter(Stream<Person> people, Character startingCharacter) {
46 46
         this.personStream = people;
47 47
         this.startingCharacter = startingCharacter.toString();
48 48
     }

+ 26
- 1
src/main/java/com/zipcodewilmington/lambdas/StreamMap.java Voir le fichier

@@ -1,7 +1,32 @@
1 1
 package com.zipcodewilmington.lambdas;
2 2
 
3
+import java.util.ArrayList;
4
+import java.util.Arrays;
5
+import java.util.List;
6
+import java.util.stream.Collectors;
7
+import java.util.stream.Stream;
8
+
3 9
 /**
4 10
  * Created by leon on 5/24/17.
5 11
  */
6
-public class MapSyntax {
12
+public class StreamMap {
13
+    /**
14
+     * @param someWord - word to convert to Stream<String>
15
+     * @return - a Stream of single characters
16
+     */
17
+    public static Stream<String> letters(String someWord) {
18
+        return Stream.of(someWord.split(""));
19
+    }
20
+
21
+    /**
22
+     * @param someWords - variable amount of String arguments
23
+     * @return - a Stream of several Streams of single characters
24
+     */
25
+    public static Stream<Stream<String>> wordsMap(String... someWords) {
26
+        return Stream.of(someWords).map(w -> letters(w));
27
+    }
28
+
29
+    public static Stream<Stream<String>> wordsFlatMap(String... someWords) {
30
+        return null;//Arrays.asList(someWords).stream().flatMap(w -> letters(w));
31
+    }
7 32
 }

+ 4
- 2
src/main/java/com/zipcodewilmington/lambdas/anthropoid/Person.java Voir le fichier

@@ -1,4 +1,4 @@
1
-package com.zipcodewilmington.lambdas.tools.anthropoid;
1
+package com.zipcodewilmington.lambdas.anthropoid;
2 2
 
3 3
 import java.util.Date;
4 4
 
@@ -11,6 +11,7 @@ public class Person {
11 11
     public final PersonProperty<Boolean> isMale;
12 12
     public final PersonProperty<Long> personalId;
13 13
     public final PersonProperty<Date> birthDate;
14
+    public final PersonProperty<String[]> aliases;
14 15
 
15 16
     /**
16 17
      * @param name - name of person
@@ -19,12 +20,13 @@ public class Person {
19 20
      * @param personalId - unique id
20 21
      * @param birthDate - date of birth
21 22
      */
22
-    public Person(String name, int age, boolean isMale, long personalId, Date birthDate) {
23
+    public Person(String name, int age, boolean isMale, long personalId, Date birthDate, String... aliases) {
23 24
         this.name = new PersonProperty<>(name);
24 25
         this.age = new PersonProperty<>(age);
25 26
         this.isMale = new PersonProperty<>(isMale);
26 27
         this.personalId = new PersonProperty<>(personalId);
27 28
         this.birthDate = new PersonProperty<>(birthDate);
29
+        this.aliases = new PersonProperty<>(aliases);
28 30
     }
29 31
 
30 32
     /** the purpose of this class is compress verbose getter and setter logic

+ 10
- 5
src/main/java/com/zipcodewilmington/lambdas/anthropoid/PersonFactory.java Voir le fichier

@@ -1,9 +1,8 @@
1
-package com.zipcodewilmington.lambdas.tools.anthropoid;
1
+package com.zipcodewilmington.lambdas.anthropoid;
2 2
 
3 3
 import com.zipcodewilmington.lambdas.tools.RandomUtils;
4 4
 import com.zipcodewilmington.lambdas.tools.StringUtils;
5 5
 
6
-import java.util.ArrayList;
7 6
 import java.util.Date;
8 7
 import java.util.List;
9 8
 import java.util.stream.Collectors;
@@ -12,18 +11,24 @@ import java.util.stream.Stream;
12 11
 /**
13 12
  * Created by leon on 5/1/17.
14 13
  */
15
-public class PersonFactory {
14
+public final class PersonFactory {
15
+    private PersonFactory() {
16
+        /** this class is not to be instantiated */
17
+    }
18
+
16 19
     /**
17 20
      * @return a new instance of a person with randomized fields
18 21
      */
19 22
     public static Person createRandomPerson() {
20 23
         String name = StringUtils.capitalizeFirstChar(RandomUtils.createString('a', 'z', 10));
24
+        String[] aliases = RandomUtils.createStrings('a', 'z', 10, 100);
21 25
         int age = RandomUtils.createInteger(0, 99);
22
-        boolean isMale = RandomUtils.chance(50);
26
+        boolean isMale = RandomUtils.createBoolean(50);
23 27
         long personalId = System.nanoTime();
24 28
         Date birthDate = RandomUtils.createDate(1950, 2010);
25 29
 
26
-        Person randomPerson = new Person(name, age, isMale, personalId, birthDate);
30
+
31
+        Person randomPerson = new Person(name, age, isMale, personalId, birthDate, aliases);
27 32
         return randomPerson;
28 33
     }
29 34
 

+ 15
- 8
src/main/java/com/zipcodewilmington/lambdas/exercises/ArrayConversion.java Voir le fichier

@@ -1,25 +1,32 @@
1
-package com.zipcodewilmington.lambdas;
1
+package com.zipcodewilmington.lambdas.exercises;
2 2
 
3 3
 import com.zipcodewilmington.lambdas.anthropoid.Person;
4 4
 
5 5
 import java.util.List;
6
-import java.util.function.Predicate;
7 6
 import java.util.stream.Stream;
8 7
 
9 8
 /**
10 9
  * Created by leon on 5/25/17.
11 10
  */
12
-public class ArrayConversions {
13
-    public Stream<Person> getStream() {
14
-        return null;
11
+public final class ArrayConversion extends ConversionAgent {
12
+    private final Person[] people;
13
+
14
+    public ArrayConversion(Person... people) {
15
+        this.people = people;
15 16
     }
16 17
 
17
-    public static List<Person> getList() {
18
+    //TODO
19
+    public Stream<Person> toStream() {
18 20
         return null;
19 21
     }
20 22
 
21
-    public Stream<Person> filter(Predicate<? super Person> predicate) {
22
-        return getStream().filter(predicate);
23
+    @Override
24
+    public Person[] toArray() {
25
+        return this.people;
23 26
     }
24 27
 
28
+    //TODO
29
+    public List<Person> toList() {
30
+        return null;
31
+    }
25 32
 }

+ 17
- 1
src/main/java/com/zipcodewilmington/lambdas/exercises/ConversionAgent.java Voir le fichier

@@ -1,7 +1,23 @@
1 1
 package com.zipcodewilmington.lambdas.exercises;
2 2
 
3
+import com.zipcodewilmington.lambdas.anthropoid.Person;
4
+
5
+import java.util.List;
6
+import java.util.function.Predicate;
7
+import java.util.stream.Stream;
8
+
3 9
 /**
4 10
  * Created by leon on 5/25/17.
5 11
  */
6
-public class Conversion {
12
+public abstract class ConversionAgent {
13
+
14
+    abstract public List<Person> toList();
15
+
16
+    abstract public Stream<Person> toStream();
17
+
18
+    abstract public Person[] toArray();
19
+
20
+    public Stream<Person> filter(Predicate<? super Person> predicate) {
21
+        return toStream().filter(predicate);
22
+    }
7 23
 }

+ 27
- 2
src/main/java/com/zipcodewilmington/lambdas/exercises/ListConversion.java Voir le fichier

@@ -1,7 +1,32 @@
1
-package com.zipcodewilmington.lambdas;
1
+package com.zipcodewilmington.lambdas.exercises;
2
+
3
+import com.zipcodewilmington.lambdas.anthropoid.Person;
4
+
5
+import java.util.List;
6
+import java.util.stream.Stream;
2 7
 
3 8
 /**
4 9
  * Created by leon on 5/25/17.
5 10
  */
6
-public class ListConversions {
11
+public final class ListConversion extends ConversionAgent {
12
+    private final List<Person> people;
13
+
14
+    public ListConversion(List<Person> people) {
15
+        this.people = people;
16
+    }
17
+
18
+    @Override
19
+    public List<Person> toList() {
20
+        return this.people;
21
+    }
22
+
23
+    //TODO
24
+    public Stream<Person> toStream() {
25
+        return null;
26
+    }
27
+
28
+    //TODO
29
+    public Person[] toArray() {
30
+        return null;
31
+    }
7 32
 }

+ 26
- 1
src/main/java/com/zipcodewilmington/lambdas/exercises/StreamConversion.java Voir le fichier

@@ -1,7 +1,32 @@
1 1
 package com.zipcodewilmington.lambdas.exercises;
2 2
 
3
+import com.zipcodewilmington.lambdas.anthropoid.Person;
4
+
5
+import java.util.List;
6
+import java.util.stream.Stream;
7
+
3 8
 /**
4 9
  * Created by leon on 5/25/17.
5 10
  */
6
-public class StreamConversions {
11
+public final class StreamConversion extends ConversionAgent {
12
+    private final Stream<Person> people;
13
+
14
+    public StreamConversion(Stream<Person> people) {
15
+        this.people = people;
16
+    }
17
+
18
+    // TODO
19
+    public List<Person> toList() {
20
+        return null;
21
+    }
22
+
23
+    // TODO
24
+    public Stream<Person> toStream() {
25
+        return this.people;
26
+    }
27
+
28
+    // TODO
29
+    public Person[] toArray() {
30
+        return null;
31
+    }
7 32
 }

+ 16
- 7
src/main/java/com/zipcodewilmington/lambdas/tools/RandomUtils.java Voir le fichier

@@ -1,4 +1,4 @@
1
-package com.zipcode.tools;
1
+package com.zipcodewilmington.lambdas.tools;
2 2
 
3 3
 import java.awt.*;
4 4
 import java.util.*;
@@ -11,7 +11,7 @@ public abstract class RandomUtils {
11 11
     private static final Random random = new Random();
12 12
 
13 13
     /** @return true with the likelihood of specified percentage */
14
-    public static boolean chance(float percentage) {
14
+    public static boolean createBoolean(float percentage) {
15 15
         return percentage > createFloat(0, 100);
16 16
     }
17 17
 
@@ -41,14 +41,23 @@ public abstract class RandomUtils {
41 41
     }
42 42
 
43 43
     /** @return a random string of the specified length containing characters in the specified range */
44
-    public static String createString(char min, char max, int length) {
45
-        StringBuilder sb = new StringBuilder();
46
-        for (int i = 0; i < length; i++) {
44
+    public static String createString(char min, char max, int stringLength) {
45
+        StringBuffer sb = new StringBuffer();
46
+        for (int i = 0; i < stringLength; i++) {
47 47
             sb.append(createCharacter(min, max));
48 48
         }
49 49
         return sb.toString();
50 50
     }
51 51
 
52
+    /** @return an array of random string objects of the specified length containing characters in the specified range */
53
+    public static String[] createStrings(char min, char max, int stringLength, int stringCount) {
54
+        String[] strings = new String[stringCount];
55
+        for(int i=0;i<strings.length;i++) {
56
+            strings[i] = createString(min,max,stringLength);
57
+        }
58
+        return strings;
59
+    }
60
+
52 61
     /** @return a random date object ranging between the specified dates */
53 62
     public static Date createDate(int minYear, int maxYear) {
54 63
         GregorianCalendar gc = new GregorianCalendar();
@@ -64,9 +73,9 @@ public abstract class RandomUtils {
64 73
 
65 74
     /** @return specified string value with random upper and lower casing assigned to each character */
66 75
     public static String shuffleCasing(String str) {
67
-        StringBuilder sb = new StringBuilder();
76
+        StringBuffer sb = new StringBuffer();
68 77
         for (String s : str.toLowerCase().split("")) {
69
-            sb.append(chance(50) ? s.toUpperCase() : s.toLowerCase());
78
+            sb.append(createBoolean(50) ? s.toUpperCase() : s.toLowerCase());
70 79
         }
71 80
         return sb.toString();
72 81
     }

+ 40
- 1
src/main/java/com/zipcodewilmington/lambdas/tools/ReflectionUtils.java Voir le fichier

@@ -1,7 +1,46 @@
1 1
 package com.zipcodewilmington.lambdas.tools;
2 2
 
3
+import java.lang.reflect.Field;
4
+import java.util.HashMap;
5
+import java.util.Iterator;
6
+
3 7
 /**
4
- * Created by leon on 5/24/17.
8
+ * Created by leon on 5/19/17.
5 9
  */
6 10
 public class ReflectionUtils {
11
+    public static HashMap<Field, String> getFieldMap(Object object) {
12
+        HashMap hm = new HashMap() {
13
+            @Override
14
+            public String toString() {
15
+                StringBuilder sb = new StringBuilder();
16
+                Iterator it = this.entrySet().iterator();
17
+
18
+                for (int i = 0; it.hasNext(); i++) {
19
+                    Entry pair = (Entry) it.next();
20
+                    sb
21
+                            .append("\n" + StringUtils.repeatString(150, "-"))
22
+                            .append(String.format("\nEntry number:\t\t%s", i))
23
+                            .append(String.format("\nKey:\t\t\t\t%s", pair.getKey()))
24
+                            .append(String.format("\nValue:\t\t\t\t%s", pair.getValue()));
25
+                    it.remove(); // prevents ConcurrentModificationException
26
+                }
27
+                return sb.toString();
28
+            }
29
+        };
30
+        for (Field f : object.getClass().getDeclaredFields()) {
31
+            try {
32
+                boolean defaultAccess = f.isAccessible();
33
+
34
+                // attempt to modify visibility
35
+                f.setAccessible(true);
36
+                hm.put(f, f.get(object).toString());
37
+                f.setAccessible(defaultAccess);
38
+            } catch (IllegalArgumentException | IllegalAccessException e) {
39
+                e.printStackTrace();
40
+                hm.put(f, null);
41
+            }
42
+
43
+        }
44
+        return hm;
45
+    }
7 46
 }

+ 26
- 0
src/main/java/com/zipcodewilmington/lambdas/tools/StringUtils.java Voir le fichier

@@ -1,7 +1,33 @@
1 1
 package com.zipcodewilmington.lambdas.tools;
2 2
 
3
+import java.util.ArrayList;
4
+import java.util.List;
5
+import java.util.stream.Stream;
6
+
3 7
 /**
4 8
  * Created by leon on 5/24/17.
5 9
  */
6 10
 public class StringUtils {
11
+    /**
12
+     * @param string - String to capitalize
13
+     * @return - input String with first character capitalized
14
+     */
15
+
16
+    public static String capitalizeFirstChar(String string) {
17
+        String firstChar = new Character(string.charAt(0)).toString();
18
+        return string.replaceFirst(firstChar, firstChar.toUpperCase());
19
+    }
20
+
21
+    /**
22
+     * @param numberOfRepeats - number of times to repeat this string
23
+     * @param val - value of string to repeat
24
+     * @return - `val` concatenated with itself `numberOfRepeats` times
25
+     */
26
+    public static String repeatString(int numberOfRepeats, String val) {
27
+        StringBuffer sb = new StringBuffer();
28
+        for (int i = 0; i < numberOfRepeats; i++) {
29
+            sb.append(val);
30
+        }
31
+        return sb.toString();
32
+    }
7 33
 }

+ 46
- 0
src/test/java/com/zipcodewilmington/lambdas/TestPersonFactory.java Voir le fichier

@@ -1,7 +1,53 @@
1 1
 package com.zipcodewilmington.lambdas;
2 2
 
3
+import com.zipcodewilmington.lambdas.tools.ReflectionUtils;
4
+import com.zipcodewilmington.lambdas.anthropoid.Person;
5
+import com.zipcodewilmington.lambdas.anthropoid.PersonFactory;
6
+import org.junit.Assert;
7
+import org.junit.Test;
8
+
9
+import java.lang.reflect.Field;
10
+import java.util.HashMap;
11
+import java.util.Map;
12
+import java.util.stream.Stream;
13
+
3 14
 /**
4 15
  * Created by leon on 5/24/17.
5 16
  */
6 17
 public class TestPersonFactory {
18
+    int collectionSize = 1000;
19
+
20
+    @Test
21
+    public void testCreateRandomPersonList() {
22
+        checkStream(PersonFactory.createPersonList(collectionSize).stream());
23
+    }
24
+
25
+    @Test
26
+    public void testCreateRandomPersonArray() {
27
+        checkStream(Stream.of(PersonFactory.createPersonArray(collectionSize)));
28
+    }
29
+
30
+    @Test
31
+    public void testCreateRandomPersonStream() {
32
+        checkStream(PersonFactory.createPersonStream(collectionSize));
33
+    }
34
+
35
+    private void checkStream(Stream<Person> personStream) {
36
+        String messageCheckSize = "Ensuring appropriately sized stream was produced.";
37
+        String messageCheckKey = "Ensuring field is non-null";
38
+        String messageCheckValue = "Ensuring field-value is non-null";
39
+
40
+        Person[] personArray = personStream.toArray(Person[]::new);
41
+        Assert.assertEquals(messageCheckSize, collectionSize, personArray.length);
42
+        for (Person person : personArray) {
43
+            HashMap<Field, String> fieldMap = ReflectionUtils.getFieldMap(person);
44
+            for (Map.Entry<Field, String> entry : fieldMap.entrySet()) {
45
+                Field key = entry.getKey();
46
+                String value = entry.getValue();
47
+
48
+                Assert.assertTrue(messageCheckKey, key != null);
49
+                Assert.assertTrue(messageCheckValue, value != null);
50
+            }
51
+        }
52
+    }
7 53
 }

+ 8
- 8
src/test/java/com/zipcodewilmington/lambdas/TestStreamFilter.java Voir le fichier

@@ -10,32 +10,32 @@ import java.util.List;
10 10
 /**
11 11
  * Created by leon on 5/2/17.
12 12
  */
13
-public class TestLambdaFilter {
14
-    private LambdaFilter lambdaFilter;
13
+public class TestStreamFilter {
14
+    private StreamFilter streamFilter;
15 15
 
16 16
     @Before
17 17
     public void setup() {
18
-        lambdaFilter = new LambdaFilter();
18
+        streamFilter = new StreamFilter();
19 19
     }
20 20
 
21 21
     @Test
22 22
     public void testToListMultiLine() {
23
-        testFilter(lambdaFilter.toListMultiLine());
23
+        testFilter(streamFilter.toListMultiLine());
24 24
     }
25 25
 
26 26
     @Test
27 27
     public void testToListOneLine() {
28
-        testFilter(lambdaFilter.toListOneLine());
28
+        testFilter(streamFilter.toListOneLine());
29 29
     }
30 30
 
31 31
     @Test
32 32
     public void testToArrayMultiLine() {
33
-        testFilter(lambdaFilter.toArrayMultiLine());
33
+        testFilter(streamFilter.toArrayMultiLine());
34 34
     }
35 35
 
36 36
     @Test
37 37
     public void testToArrayOneLine() {
38
-        testFilter(lambdaFilter.toArrayOneLine());
38
+        testFilter(streamFilter.toArrayOneLine());
39 39
     }
40 40
 
41 41
 
@@ -47,7 +47,7 @@ public class TestLambdaFilter {
47 47
 
48 48
     private void testFilter(List<Person> persons) {
49 49
         for (Person p : persons) {
50
-            assert (p.name.getValue().startsWith(lambdaFilter.startingCharacter));
50
+            assert (p.name.getValue().startsWith(streamFilter.startingCharacter));
51 51
         }
52 52
     }
53 53
 }

+ 1
- 2
src/test/java/com/zipcodewilmington/lambdas/TestStreamMap.java Voir le fichier

@@ -5,8 +5,7 @@ import org.junit.Test;
5 5
 /**
6 6
  * Created by leon on 5/24/17.
7 7
  */
8
-public class
9
-TestMapSyntax {
8
+public class TestStreamMap {
10 9
     @Test
11 10
     public void test() {
12 11
 

+ 11
- 3
src/test/java/com/zipcodewilmington/lambdas/TestSuiteFullRegression.java Voir le fichier

@@ -1,7 +1,15 @@
1 1
 package com.zipcodewilmington.lambdas;
2 2
 
3
-/**
4
- * Created by leon on 5/24/17.
5
- */
3
+import org.junit.runner.RunWith;
4
+import org.junit.runners.Suite;
5
+
6
+@RunWith(Suite.class)
7
+
8
+@Suite.SuiteClasses({
9
+        TestStreamFilter.class,
10
+        TestStreamMap.class,
11
+        TestPersonFactory.class
12
+})
13
+
6 14
 public class TestSuiteFullRegression {
7 15
 }

BIN
target/classes/com/zipcodewilmington/lambdas/LambdaFilter.class Voir le fichier


BIN
target/classes/com/zipcodewilmington/lambdas/MapSyntax.class Voir le fichier


BIN
target/classes/com/zipcodewilmington/lambdas/anthropoid/Person$PersonProperty.class Voir le fichier


BIN
target/classes/com/zipcodewilmington/lambdas/anthropoid/Person.class Voir le fichier


BIN
target/classes/com/zipcodewilmington/lambdas/anthropoid/PersonFactory.class Voir le fichier


BIN
target/classes/com/zipcodewilmington/lambdas/tools/RandomUtils.class Voir le fichier


BIN
target/classes/com/zipcodewilmington/lambdas/tools/ReflectionUtils$1.class Voir le fichier


BIN
target/classes/com/zipcodewilmington/lambdas/tools/ReflectionUtils.class Voir le fichier


BIN
target/classes/com/zipcodewilmington/lambdas/tools/StringUtils.class Voir le fichier


BIN
target/test-classes/com/zipcodewilmington/lambdas/TestLambdaFilter.class Voir le fichier


BIN
target/test-classes/com/zipcodewilmington/lambdas/TestMapSyntax.class Voir le fichier


BIN
target/test-classes/com/zipcodewilmington/lambdas/TestPersonFactory.class Voir le fichier


BIN
target/test-classes/com/zipcodewilmington/lambdas/TestSuiteFullRegression.class Voir le fichier