Skip to content

Added 5 new fields to Person class, and 5 new tests to TestPerson #65

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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>11</source>
<target>11</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 hairType;
private String eyeColor;
private boolean glasses;
private int amountOfTeeth;
private int wingSpan;

public Person() {
this.name = "";
this.age = Integer.MAX_VALUE;
}

public Person(int age) {
this.age = age;
}

public Person(String name) {
this.name = name;
}

public Person(String name, int age) {
this.name = name;
this.age = age;
}

public String getHairType() {
return hairType;
}

public void setHairType(String hairType) {
this.hairType = hairType;
}

public String getEyeColor() {
return eyeColor;
}

public void setEyeColor(String eyeColor) {
this.eyeColor = eyeColor;
}

public boolean isGlasses() {
return glasses;
}

public void setGlasses(boolean glasses) {
this.glasses = glasses;
}

public int getAmountOfTeeth() {
return amountOfTeeth;
}

public void setAmountOfTeeth(int amountOfTeeth) {
this.amountOfTeeth = amountOfTeeth;
}

public int getWingSpan() {
return wingSpan;
}

public void setWingSpan(int wingSpan) {
this.wingSpan = wingSpan;
}

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;
}
}
76 changes: 75 additions & 1 deletion src/test/java/com/zipcodewilmington/person/TestPerson.java
Original file line number Diff line number Diff line change
Expand Up @@ -95,4 +95,78 @@ public void testSetAge() {
Integer actual = person.getAge();
Assert.assertEquals(expected, actual);
}
}

@Test
public void testSetHairType() {
//Given
Person person = new Person();
String expected = "curly";

//When
person.setHairType(expected);

//Then
String actual = person.getHairType();
Assert.assertEquals(expected, actual);
}

@Test
public void testSetEyeColor() {
//Given
Person person = new Person();
String expected = "brown";

//When
person.setEyeColor(expected);

//Then
String actual = person.getEyeColor();
Assert.assertEquals(expected, actual);
}

@Test
public void testHasGlasses() {
//Given
Person person = new Person();
Boolean expected = true;

//When
person.setGlasses(true);

//Then
Boolean actual = person.isGlasses();
Assert.assertEquals(true, actual);
}

@Test
public void testAmountOfTeeth() {
//Given
Person person = new Person();
Integer expected = 32;

//When
person.setAmountOfTeeth(expected);

//Then
Integer actual = person.getAmountOfTeeth();
Assert.assertEquals(expected, actual);
}

@Test
public void testWingSpan() {
//Given
Person person = new Person();
Integer expected = 65;

//When
person.setWingSpan(expected);

//Then
Integer actual = person.getWingSpan();
Assert.assertEquals(expected, actual);
}




} // final brace