Commit 292c1928 authored by a-j.towse's avatar a-j.towse

Working UnitTest constructors

parent 6ddf0d83
No preview for this file type
...@@ -44,5 +44,13 @@ public abstract class Animal { ...@@ -44,5 +44,13 @@ public abstract class Animal {
return this.environment; return this.environment;
} }
public String getName(){
return this.name;
}
public String getDescription(){
return this.description;
}
} }
...@@ -4,7 +4,6 @@ public class App { ...@@ -4,7 +4,6 @@ public class App {
public static void main(String[] args) throws Exception { public static void main(String[] args) throws Exception {
Zoo myZoo = new Zoo();
Fish Rex = new Fish("Rex","red stripes","sea","sea-weed",12.5,"freshwater"); Fish Rex = new Fish("Rex","red stripes","sea","sea-weed",12.5,"freshwater");
Fish Pix = new Fish("Pix","gold","river","smaller fish",5.0,"saltwater"); Fish Pix = new Fish("Pix","gold","river","smaller fish",5.0,"saltwater");
......
...@@ -2,12 +2,21 @@ import static org.junit.Assert.assertEquals; ...@@ -2,12 +2,21 @@ import static org.junit.Assert.assertEquals;
import org.junit.Test; import org.junit.Test;
public class unitTest { public class unitTest {
@Test @Test
public void Constructors(){ public void testConstructors(){
Zoo myZoo = new Zoo();
//Fish Constructor //Fish Constructor
Fish Rex = new Fish("Rex","red stripes","sea","sea-weed",12.5,"freshwater");
Fish Pix = new Fish("Pix","gold","river","smaller fish",5.0,"saltwater");
Bird Rob = new Bird("Rob","red robin","large tree","seeds",false,true);
Mammal Tom = new Mammal("Tom","striped tiger","jungle","meat", 90.0,120.0);
Reptile Cameron = new Reptile("Cam","green eyed crocodile","salt water","chicken",182.5,230.0);
assertEquals("Rex",Rex.getName() );
assertEquals("river", Pix.getEnvironment());
assertEquals("seeds", Rob.getFoodType());
assertEquals("Tom", Tom.getName());
assertEquals("green eyed crocodile", Cameron.getDescription());
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment