Skip to content

All tests passed + added 5 new fields & tests #61

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
60 changes: 58 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,86 @@
public class Person {
private String name;
private int age;
private int birthMonth;
private int birthYear;
private char middleInitial;
private String favoriteColor;
private boolean hasAPet;


public int getBirthMonth() {
return birthMonth;
}

public void setBirthMonth(int birthMonth) {
this.birthMonth = birthMonth;
}

public int getBirthYear() {
return birthYear;
}

public void setBirthYear(int birthYear) {
this.birthYear = birthYear;
}

public char getMiddleInitial() {
return middleInitial;
}

public void setMiddleInitial(char middleInitial) {
this.middleInitial = middleInitial;
}

public String getFavoriteColor() {
return favoriteColor;
}

public void setFavoriteColor(String favoriteColor) {
this.favoriteColor = favoriteColor;
}

public boolean getHasAPet() {
return hasAPet;
}

public void setHasAPet(boolean hasAPet) {
this.hasAPet = hasAPet;
}

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 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;
}


}
70 changes: 70 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,74 @@ public void testSetAge() {
Integer actual = person.getAge();
Assert.assertEquals(expected, actual);
}

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

// When
person.setBirthMonth(expected);

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

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

// When
person.setBirthYear(expected);

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

@Test
public void testSetMiddleInitial() {
// Given
Person person = new Person();
char expected = 'M';

// When
person.setMiddleInitial(expected);

// Then
char actual = person.getMiddleInitial();
Assert.assertEquals(expected, actual);
}

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

// When
person.setFavoriteColor(expected);

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

@Test
public void testSetHasAPet() {
// Given
Person person = new Person();
boolean expected = false;

// When
person.setHasAPet(expected);

// Then
boolean actual = person.getHasAPet();
Assert.assertEquals(expected, actual);
}
}