Skip to content

super human #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 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
41 changes: 41 additions & 0 deletions src/main/java/Superpowers/Human.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,45 @@
* hero name, super ability. As before, create methods for retrieving field data and printing to screen.
*/
public class Human {

private String name;
private int age;
private String gender;
private String occupation;
private String address;

public Human(){

}

public Human(String name, int age, String gender, String occupation, String address){
this.name = name;
this.age = age;
this.gender = gender;
this.occupation = occupation;
this.address = address;

}

public String getName(){
return name;
}

public int getAge() {
return age;
}

public String getGender(){
return gender;
}

public String getOccupation(){
return occupation;
}

public String getAddress(){
return address;
}
}


41 changes: 41 additions & 0 deletions src/main/java/Superpowers/SuperHuman.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
package Superpowers;

public class SuperHuman extends Human {

private boolean good;
private boolean bad;
private String heroName;
private String superAbility;






public SuperHuman(String name, int age, String gender, String occupation, String address, String heroName, String superAbility, boolean good, boolean bad ) {

super(name, age, gender, occupation, address);
this.good = good;
this.bad = bad;
this.heroName = heroName;
this.superAbility = superAbility;


}

public boolean getGood() {
return good;
}

public boolean getBad(){
return bad;
}

public String getheroName(){
return heroName;
}
public String getsuperAbility(){
return superAbility;
}
}

16 changes: 16 additions & 0 deletions src/test/java/Superpowers/HumanTest.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
package Superpowers;


import org.junit.Assert;
import org.junit.Test;

public class HumanTest {
@Test
public void testFields(){
Human human = new Human("Bob", 36, "Male", "carpenter", "address");

Assert.assertEquals("Bob", human.getName());
Assert.assertEquals(36, human.getAge());
Assert.assertEquals("Male", human.getGender());
Assert.assertEquals("carpenter", human.getOccupation());
Assert.assertEquals("address", human.getAddress());

}


}
26 changes: 26 additions & 0 deletions src/test/java/Superpowers/TestSuperHuman.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package Superpowers;

import org.junit.Assert;
import org.junit.Test;

public class TestSuperHuman {
@Test
public void SuperHumanTest(){
SuperHuman superHuman = new SuperHuman("Bob", 36, "Male", "carpenter",
"address", "superBeast", "Git What chu Need", true, false );


Assert.assertEquals("superBeast", superHuman.getheroName());
Assert.assertEquals("Git What chu Need", superHuman.getsuperAbility());
Assert.assertEquals(true, superHuman.getGood());
Assert.assertEquals(false, superHuman.getBad());

Assert.assertEquals("Bob", superHuman.getName());
Assert.assertEquals(36, superHuman.getAge());
Assert.assertEquals("Male", superHuman.getGender());
Assert.assertEquals("carpenter", superHuman.getOccupation());
Assert.assertEquals("address", superHuman.getAddress());

}

}