diff --git a/src/test/java/org/bitbiome/commands/CollectCommandTest.java b/src/test/java/org/bitbiome/commands/CollectCommandTest.java new file mode 100644 index 0000000..cb718d1 --- /dev/null +++ b/src/test/java/org/bitbiome/commands/CollectCommandTest.java @@ -0,0 +1,26 @@ +package org.bitbiome.commands; + +import org.bitbiome.classes.JsonParser; +import org.json.JSONArray; +import org.json.JSONObject; +import org.junit.jupiter.api.Test; + + +import static org.junit.jupiter.api.Assertions.assertEquals; + +public class CollectCommandTest { + + @Test + public void testIncreaseAmountInPlayerConfig() { + CollectCommand command = new CollectCommand(); + JsonParser jp = new JsonParser(); + JSONObject o = jp.getJSONObject("playerconfig.json"); + JSONArray inventory = o.getJSONArray("inventory"); + int k = 0; + int initialAmount = inventory.getJSONObject(k).getInt("amount"); + command.increaseAmountInPlayerConfig(inventory, k, jp, o); + int finalAmount = inventory.getJSONObject(k).getInt("amount"); + assertEquals(initialAmount + 1, finalAmount); + } + +} \ No newline at end of file