Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,18 @@
<groupId>com.zipcodewilmington</groupId>
<artifactId>person</artifactId>
<version>1.0-SNAPSHOT</version>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>15</source>
<target>15</target>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>junit</groupId>
Expand Down
57 changes: 55 additions & 2 deletions src/main/java/com/zipcodewilmington/person/Person.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
55 changes: 55 additions & 0 deletions src/test/java/com/zipcodewilmington/person/TestPerson.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}