Skip to content

One Eyed One Horned Flying Purple People Eater #1

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 3 commits 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
56 changes: 54 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,82 @@
public class Person {
private String name;
private int age;
private String favoriteColor;
private String favoriteAnimal;
private String favoriteGame;
private double height;

public Person() {
name = "";
age = Integer.MAX_VALUE;
favoriteColor = "";
favoriteAnimal = "";
favoriteGame = "";
}

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

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

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

public void setName(String name) {
this.name = name;
}

public void setAge(int age) {
this.age = age;
}

public String getName() {
return null;
return this.name;
}

public Integer getAge() {
return null;
return this.age;
}

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

public String getFavoriteColor() {
return favoriteColor;
}

public void setFavoriteColorToGreen() {
this.favoriteColor = "Green";
}

public void setFavoriteAnimal(String animal) {
this.favoriteAnimal = animal;
}

public String getFavoriteAnimal() {
return favoriteAnimal;
}

public void setFavoriteGame(String game) {
this.favoriteGame = game;
}

public String getFavoriteGame() {
return favoriteGame;
}

public void setHeight(double height) {
this.height = height;
}

public double getHeight() {
return height;
}

}
74 changes: 73 additions & 1 deletion src/test/java/com/zipcodewilmington/person/TestPerson.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public void testConstructorWithAge(){
Integer expected = 5;
Person person = new Person(expected);
person.setAge(expected);
String actual = person.getName();
Integer actual = person.getAge();
Assert.assertEquals(expected, actual);
}

Expand Down Expand Up @@ -73,4 +73,76 @@ public void testSetAge() {
Integer actual = person.getAge();
Assert.assertEquals(expected, actual);
}

@Test
public void testSetFavoriteColorToGreen() {
Person person = new Person();
String expected = "Green";
person.setFavoriteColorToGreen();
String actual = person.getFavoriteColor();
Assert.assertEquals(expected, actual);
}

@Test
public void testSetFavoriteColor() {
Person person = new Person();
String expected = "Red";
person.setFavoriteColor("Red");
String actual = person.getFavoriteColor();
Assert.assertEquals(expected, actual);
}

@Test
public void testSetFavoriteAnimal() {
Person person = new Person();
String expected = "Lion";
person.setFavoriteAnimal("Lion");
String actual = person.getFavoriteAnimal();
Assert.assertEquals(expected, actual);
}

@Test
public void testGetFavoriteAnimal() {
Person person = new Person();
String expected = "Tiger";
person.setFavoriteAnimal("Tiger");
String actual = person.getFavoriteAnimal();
Assert.assertEquals(expected, actual);
}

@Test
public void testSetFavoriteGame() {
Person person = new Person();
String expected = "Call of War Battle Game";
person.setFavoriteGame("Call of War Battle Game");
String actual = person.getFavoriteAnimal();
Assert.assertEquals(expected, actual);
}

@Test
public void testGetFavoriteGame() {
Person person = new Person();
String expected = "Shoot Bang Gun Shooter";
person.setFavoriteGame("Shoot Bang Gun Shooter");
String actual = person.getFavoriteAnimal();
Assert.assertEquals(expected, actual);
}

@Test
public void testSetHeight() {
Person person = new Person();
double expected = 6.1;
person.setHeight(6.1);
double actual = person.getHeight();
Assert.assertEquals(expected, actual);
}

@Test
public void testGetHeight() {
Person person = new Person();
double expected = 6.2;
person.setHeight(6.2);
double actual = person.getHeight();
Assert.assertEquals(expected, actual);
}
}