diff --git a/src/main/java/org/bitbiome/shop/Shop.java b/src/main/java/org/bitbiome/shop/Shop.java index 5c4216c..3491896 100644 --- a/src/main/java/org/bitbiome/shop/Shop.java +++ b/src/main/java/org/bitbiome/shop/Shop.java @@ -233,7 +233,7 @@ public class Shop { System.out.println(""); } - private int subtractGold(int gold, int cost){ + public int subtractGold(int gold, int cost){ return gold - cost; } } diff --git a/src/test/java/org/bitbiome/commands/ShopCommandTest.java b/src/test/java/org/bitbiome/commands/ShopCommandTest.java index 0e28dfb..9359232 100755 --- a/src/test/java/org/bitbiome/commands/ShopCommandTest.java +++ b/src/test/java/org/bitbiome/commands/ShopCommandTest.java @@ -7,6 +7,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; public class ShopCommandTest { final ShopCommand shopCommand = new ShopCommand(); + final Shop shop = new Shop(); @Test public void testValidInput1(){ boolean expected = true; @@ -31,4 +32,13 @@ public class ShopCommandTest { boolean result = shopCommand.validInput("4"); assertEquals(expected, result); } + + + + @Test + public void testSubtractGold(){ + int expected = 1; + int result = shop.subtractGold(3, 2); + assertEquals(expected, result); + } }