diff --git a/src/main/java/Orc.java b/src/main/java/Orc.java new file mode 100644 index 0000000..b010cd5 --- /dev/null +++ b/src/main/java/Orc.java @@ -0,0 +1,46 @@ +public class Orc implements Tradable, Domesticatable { + int toes; + private String[] armor; + private String[] weapon; + + public Orc(){ + this.armor = new String[0]; + this.weapon = new String[0]; + toes = 1; + } + @Override + public String sound() { + return "growl"; + } + + @Override + public int getPrice() { + return 50; + } + + public void upgrade_armor(String item){ + String[] jk = new String[armor.length+1]; + for(int i = 0; i < jk.length; i++){ + jk[i] = armor[i]; + } + jk[armor.length] = item; + armor = jk; + } + public void upgrade_weapon(String item){ + String[] lm = new String[weapon.length+1]; + for(int i = 0; i < lm.length; i++){ + lm[i] = weapon[i]; + } + lm[weapon.length] = item; + weapon = lm; + } + + public String[] getArmor(){ + return armor; + } + + public String[] getWeapon(){ + return weapon; + } + +} \ No newline at end of file diff --git a/src/main/java/Trader.java b/src/main/java/Trader.java index 7d4d1f4..09b51ba 100644 --- a/src/main/java/Trader.java +++ b/src/main/java/Trader.java @@ -96,7 +96,9 @@ public static void main(String[] args) { List all_items = Arrays.asList( new Horse(), new Horse(), - new Horse() + new Horse(), + new Orc(), + new Orc() // TODO: Add Tradable objects here! ); diff --git a/src/test/java/OrcTest.java b/src/test/java/OrcTest.java new file mode 100644 index 0000000..eacf5df --- /dev/null +++ b/src/test/java/OrcTest.java @@ -0,0 +1,24 @@ +import org.junit.*; + +import static org.junit.Assert.*; + + +public class OrcTest { + Orc o; + + @Before + public void setUp() throws Exception { + o = new Orc(); + } + + @Test(timeout = 50) + public void TestSound() { + assertEquals("growl", o.sound()); + } + + @Test(timeout = 50) + public void TestGetPrice() { + assertEquals(50, o.getPrice()); + } + +} \ No newline at end of file