diff --git a/pom.xml b/pom.xml index 6d56659..d8f55a1 100644 --- a/pom.xml +++ b/pom.xml @@ -7,6 +7,18 @@ com.zipcodewilmington person 1.0-SNAPSHOT + + + + org.apache.maven.plugins + maven-compiler-plugin + + 15 + 15 + + + + junit diff --git a/src/main/java/com/zipcodewilmington/person/Person.java b/src/main/java/com/zipcodewilmington/person/Person.java index c12425f..5a76203 100644 --- a/src/main/java/com/zipcodewilmington/person/Person.java +++ b/src/main/java/com/zipcodewilmington/person/Person.java @@ -6,30 +6,83 @@ public class Person { private String name; private int age; + private String hairColor; + private String eyeColor; + private int height; + private int weight; + private String occupation; public Person() { + this.name = ""; + this.age = Integer.MAX_VALUE; } public Person(int age) { + setAge(age); } public Person(String name) { + setName(name); } public Person(String name, int age) { + setName(name); + setAge(age); } public void setName(String name) { + this.name = name; } public void setAge(int age) { + this.age = age; } public String getName() { - return null; + return name; } public Integer getAge() { - return null; + return age; + } + + public String getHairColor() { + return hairColor; + } + + public void setHairColor(String hairColor) { + this.hairColor = hairColor; + } + + public String getEyeColor() { + return eyeColor; + } + + public void setEyeColor(String eyeColor) { + this.eyeColor = eyeColor; + } + + public int getHeight() { + return height; + } + + public void setHeight(int height) { + this.height = height; + } + + public int getWeight() { + return weight; + } + + public void setWeight(int weight) { + this.weight = weight; + } + + public String getOccupation() { + return occupation; + } + + public void setOccupation(String occupation) { + this.occupation = occupation; } } diff --git a/src/test/java/com/zipcodewilmington/person/TestPerson.java b/src/test/java/com/zipcodewilmington/person/TestPerson.java index 59af3b2..ce790c3 100644 --- a/src/test/java/com/zipcodewilmington/person/TestPerson.java +++ b/src/test/java/com/zipcodewilmington/person/TestPerson.java @@ -95,4 +95,59 @@ public void testSetAge() { Integer actual = person.getAge(); Assert.assertEquals(expected, actual); } + @Test + public void testSetHairColor() { + //given + Person person = new Person(); + String expected = "brown"; + //when + person.setHairColor(expected); + //then + String actual = person.getHairColor(); + Assert.assertEquals(expected, actual); + } + @Test + public void testSetEyeColor() { + //given + Person person = new Person(); + String expected = "hazel"; + //when + person.setEyeColor(expected); + //then + String actual = person.getEyeColor(); + Assert.assertEquals(expected, actual); + } + @Test + public void testHeight() { + //given + Person person = new Person(); + int expected = 67; + //when + person.setHeight(expected); + //then + int actual = person.getHeight(); + Assert.assertEquals(expected, actual); + } + @Test + public void testWeight() { + //given + Person person = new Person(); + int expected = 155; + //when + person.setWeight(expected); + //then + int actual = person.getWeight(); + Assert.assertEquals(expected, actual); + } + @Test + public void testOccupation() { + //given + Person person = new Person(); + String expected = "software developer"; + //when + person.setOccupation(expected); + //then + String actual = person.getOccupation(); + Assert.assertEquals(expected, actual); + } }