From 0a8f5b6f333a57b11bcab80718822cf4b9c11a35 Mon Sep 17 00:00:00 2001 From: jeanvalentin51 Date: Mon, 25 Nov 2019 17:19:56 -0500 Subject: [PATCH 01/12] modify gitignore --- .idea/.gitignore | 26 ++++++++++++++++++++++++++ .idea/Lambdas2-ZCW.iml | 9 +++++++++ .idea/misc.xml | 6 ++++++ .idea/modules.xml | 8 ++++++++ .idea/vcs.xml | 6 ++++++ 5 files changed, 55 insertions(+) create mode 100644 .idea/.gitignore create mode 100644 .idea/Lambdas2-ZCW.iml create mode 100644 .idea/misc.xml create mode 100644 .idea/modules.xml create mode 100644 .idea/vcs.xml diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..6528910 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,26 @@ + +# Default ignored files +/workspace.xml + +/target/ +.DS_Store +.classpath +.project +.settings +*.iml + +# User-specific stuff: +*.iml +.idea/** +.idea/**/workspace.xml +.idea/**/tasks.xml +.idea/dictionaries + +# Sensitive or high-churn files: +.idea/**/dataSources/ +.idea/**/dataSources.ids +.idea/**/dataSources.xml +.idea/**/dataSources.local.xml +.idea/**/sqlDataSources.xml +.idea/**/dynamic.xml +.idea/**/uiDesigner.xml diff --git a/.idea/Lambdas2-ZCW.iml b/.idea/Lambdas2-ZCW.iml new file mode 100644 index 0000000..d6ebd48 --- /dev/null +++ b/.idea/Lambdas2-ZCW.iml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..28a804d --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..e080e35 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file From 10b94cf6925f5f8f54eff6b1cffbb16a2aa50c77 Mon Sep 17 00:00:00 2001 From: jeanvalentin51 Date: Mon, 25 Nov 2019 17:23:51 -0500 Subject: [PATCH 02/12] pom --- .idea/.gitignore => .gitignore | 2 +- pom.xml | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) rename .idea/.gitignore => .gitignore (94%) create mode 100644 pom.xml diff --git a/.idea/.gitignore b/.gitignore similarity index 94% rename from .idea/.gitignore rename to .gitignore index 6528910..4151f93 100644 --- a/.idea/.gitignore +++ b/.gitignore @@ -1,6 +1,6 @@ # Default ignored files -/workspace.xml +/.idea/workspace.xml /target/ .DS_Store diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..153b8c8 --- /dev/null +++ b/pom.xml @@ -0,0 +1,21 @@ + + + 4.0.0 + + com.zipcodewilmington + Lambdas2-ZCW + 1.0-SNAPSHOT + + + + junit + junit + 4.12 + test + + + + + \ No newline at end of file From 7755ec61a995b0aad73ce703b4de7b89185afdf9 Mon Sep 17 00:00:00 2001 From: jeanvalentin51 Date: Mon, 25 Nov 2019 17:25:55 -0500 Subject: [PATCH 03/12] setup --- .idea/misc.xml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.idea/misc.xml b/.idea/misc.xml index 28a804d..5ec767c 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -3,4 +3,11 @@ + + + \ No newline at end of file From 5b701c045770d7fedbe500da12aa0a9e5166cf1c Mon Sep 17 00:00:00 2001 From: jeanvalentin51 Date: Mon, 25 Nov 2019 17:30:54 -0500 Subject: [PATCH 04/12] create stubs --- .idea/Lambdas2-ZCW.iml | 15 +++++++++++---- src/main/java/CheckPerson.java | 2 ++ src/main/java/Person.java | 2 ++ 3 files changed, 15 insertions(+), 4 deletions(-) create mode 100644 src/main/java/CheckPerson.java create mode 100644 src/main/java/Person.java diff --git a/.idea/Lambdas2-ZCW.iml b/.idea/Lambdas2-ZCW.iml index d6ebd48..0ddf51c 100644 --- a/.idea/Lambdas2-ZCW.iml +++ b/.idea/Lambdas2-ZCW.iml @@ -1,9 +1,16 @@ - - - - + + + + + + + + + + + \ No newline at end of file diff --git a/src/main/java/CheckPerson.java b/src/main/java/CheckPerson.java new file mode 100644 index 0000000..02838ff --- /dev/null +++ b/src/main/java/CheckPerson.java @@ -0,0 +1,2 @@ +public interface CheckPerson { +} diff --git a/src/main/java/Person.java b/src/main/java/Person.java new file mode 100644 index 0000000..425d40e --- /dev/null +++ b/src/main/java/Person.java @@ -0,0 +1,2 @@ +public class Person { +} From 90ef86f5b6f0ee1ca5c8c7359444aaaad48aacac Mon Sep 17 00:00:00 2001 From: jeanvalentin51 Date: Mon, 25 Nov 2019 17:33:27 -0500 Subject: [PATCH 05/12] maven --- .idea/misc.xml | 3 --- .idea/modules.xml | 2 +- .idea/vcs.xml | 2 +- 3 files changed, 2 insertions(+), 5 deletions(-) diff --git a/.idea/misc.xml b/.idea/misc.xml index 5ec767c..80cd069 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,8 +1,5 @@ - - \ No newline at end of file diff --git a/src/main/java/CheckPerson.java b/src/main/java/CheckPerson.java index 02838ff..26a5bae 100644 --- a/src/main/java/CheckPerson.java +++ b/src/main/java/CheckPerson.java @@ -1,2 +1,3 @@ public interface CheckPerson { + boolean test(Person p); } diff --git a/src/main/java/Person.java b/src/main/java/Person.java index 425d40e..c4922d1 100644 --- a/src/main/java/Person.java +++ b/src/main/java/Person.java @@ -1,2 +1,48 @@ +import java.time.LocalDate; +import java.util.List; + public class Person { + + public enum Sex { + MALE, FEMALE + } + + + private String name; + private LocalDate birthday; + private Sex gender; + private String emailAddress; + private Integer age; + + + public Person(String name, String emailAddress, Integer age, LocalDate birthday, Sex gender){ + this.age = age; + this.name = name; + this.birthday = birthday; + this.gender = gender; + this.emailAddress = emailAddress; + } + + public int getAge() { + return this.age; + } + + public String getName(){ + return this.name; + } + + public void printPerson(String name, int age) { + System.out.print(name + " is older than " + age); + } + + public static void printPersonsOlderThan(List roster, int age) { + for (Person p : roster) { + if (p.getAge() >= age) { + p.printPerson(p.getName(), p.getAge()); + } + } + } + + + } diff --git a/src/test/java/PersonTest.java b/src/test/java/PersonTest.java new file mode 100644 index 0000000..379650e --- /dev/null +++ b/src/test/java/PersonTest.java @@ -0,0 +1,29 @@ +import org.junit.After; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; + +import static org.junit.Assert.*; + +public class PersonTest { + + + @Test + public void getAge() { + + Person testPerson = new Person("Joe",null,42,null, Person.Sex.FEMALE); + + Integer expected = 42; + Integer actual = testPerson.getAge(); + + Assert.assertEquals(expected,actual); + } + + @Test + public void getName() { + } + + @Test + public void printPersonsOlderThan() { + } +} \ No newline at end of file From 372be92891dbcd5d2dcb71e59a8d5873ed889845 Mon Sep 17 00:00:00 2001 From: jeanvalentin51 Date: Mon, 25 Nov 2019 17:52:33 -0500 Subject: [PATCH 07/12] Add get name test --- src/test/java/PersonTest.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/test/java/PersonTest.java b/src/test/java/PersonTest.java index 379650e..41bfd54 100644 --- a/src/test/java/PersonTest.java +++ b/src/test/java/PersonTest.java @@ -11,7 +11,7 @@ public class PersonTest { @Test public void getAge() { - Person testPerson = new Person("Joe",null,42,null, Person.Sex.FEMALE); + Person testPerson = new Person("Joe",null,42,null, Person.Sex.MALE); Integer expected = 42; Integer actual = testPerson.getAge(); @@ -21,6 +21,12 @@ public void getAge() { @Test public void getName() { + Person testPerson = new Person("Joe",null,42,null, Person.Sex.MALE); + + String expected = "Joe"; + String actual = testPerson.getName(); + + Assert.assertEquals(expected,actual); } @Test From 3193d877efc59a3647d4f25b841231e0399f7e16 Mon Sep 17 00:00:00 2001 From: jeanvalentin51 Date: Mon, 25 Nov 2019 18:00:57 -0500 Subject: [PATCH 08/12] finished aproach 1 --- src/main/java/Person.java | 14 +++++++++++--- src/test/java/PersonTest.java | 14 ++++++++++++++ 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/src/main/java/Person.java b/src/main/java/Person.java index c4922d1..9917024 100644 --- a/src/main/java/Person.java +++ b/src/main/java/Person.java @@ -23,6 +23,14 @@ public Person(String name, String emailAddress, Integer age, LocalDate birthday, this.emailAddress = emailAddress; } + public Person(){ + this.age = null; + this.name = null; + this.birthday = null; + this.gender = null; + this.emailAddress = null; + } + public int getAge() { return this.age; } @@ -31,14 +39,14 @@ public String getName(){ return this.name; } - public void printPerson(String name, int age) { - System.out.print(name + " is older than " + age); + private void printPerson(String message) { + System.out.print(message); } public static void printPersonsOlderThan(List roster, int age) { for (Person p : roster) { if (p.getAge() >= age) { - p.printPerson(p.getName(), p.getAge()); + p.printPerson(p.getName() + " is older than " + age); } } } diff --git a/src/test/java/PersonTest.java b/src/test/java/PersonTest.java index 41bfd54..9aeb700 100644 --- a/src/test/java/PersonTest.java +++ b/src/test/java/PersonTest.java @@ -3,6 +3,9 @@ import org.junit.Before; import org.junit.Test; +import java.util.ArrayList; +import java.util.List; + import static org.junit.Assert.*; public class PersonTest { @@ -31,5 +34,16 @@ public void getName() { @Test public void printPersonsOlderThan() { + Person person1 = new Person("Joe",null,42,null, Person.Sex.MALE); + Person person2 = new Person("John",null,24,null, Person.Sex.MALE); + Person testPerson = new Person(); + + List testList = new ArrayList<>(); + testList.add(person1); + testList.add(person2); + + testPerson.printPersonsOlderThan(testList,28); + + } } \ No newline at end of file From fb785ab83d493687956338f040fd15b8f1173274 Mon Sep 17 00:00:00 2001 From: jeanvalentin51 Date: Mon, 25 Nov 2019 18:04:06 -0500 Subject: [PATCH 09/12] maven --- .idea/misc.xml | 7 +++++++ pom.xml | 12 ++++++++++++ 2 files changed, 19 insertions(+) diff --git a/.idea/misc.xml b/.idea/misc.xml index f091b54..fa89799 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -3,5 +3,12 @@ + + + \ No newline at end of file diff --git a/pom.xml b/pom.xml index 153b8c8..1bb2f95 100644 --- a/pom.xml +++ b/pom.xml @@ -7,6 +7,18 @@ com.zipcodewilmington Lambdas2-ZCW 1.0-SNAPSHOT + + + + org.apache.maven.plugins + maven-compiler-plugin + + 8 + 8 + + + + From 24ab05d03ca5d52ec485478049440f810301890d Mon Sep 17 00:00:00 2001 From: Valentin Gheorghe <56591914+jeanvalentin51@users.noreply.github.com> Date: Mon, 25 Nov 2019 18:30:00 -0500 Subject: [PATCH 10/12] Update pom.xml --- pom.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index 153b8c8..4356af6 100644 --- a/pom.xml +++ b/pom.xml @@ -4,8 +4,8 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - com.zipcodewilmington - Lambdas2-ZCW + com.zipcodewilmington.lambda + Lambdas2 1.0-SNAPSHOT @@ -18,4 +18,4 @@ - \ No newline at end of file + From 5f4b876efaedf9230812851430ac7929d979b9a1 Mon Sep 17 00:00:00 2001 From: Valentin Gheorghe <56591914+jeanvalentin51@users.noreply.github.com> Date: Mon, 25 Nov 2019 18:31:04 -0500 Subject: [PATCH 11/12] Update pom.xml --- pom.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index 1bb2f95..0d16b85 100644 --- a/pom.xml +++ b/pom.xml @@ -4,8 +4,8 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - com.zipcodewilmington - Lambdas2-ZCW + com.zipcodewilmington.lambda + Lambdas2 1.0-SNAPSHOT @@ -30,4 +30,4 @@ - \ No newline at end of file + From 1b9837af0f538cf7340b8b24d3f5196b6be55088 Mon Sep 17 00:00:00 2001 From: Valentin Gheorghe <56591914+jeanvalentin51@users.noreply.github.com> Date: Mon, 25 Nov 2019 18:31:34 -0500 Subject: [PATCH 12/12] Update pom.xml --- pom.xml | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/pom.xml b/pom.xml index 4356af6..18b3dcb 100644 --- a/pom.xml +++ b/pom.xml @@ -7,6 +7,19 @@ com.zipcodewilmington.lambda Lambdas2 1.0-SNAPSHOT + + + + + org.apache.maven.plugins + maven-compiler-plugin + + 8 + 8 + + + +