From 148b7f0927f285db956d928b83e760b53f696882 Mon Sep 17 00:00:00 2001 From: Max Gerbeth Date: Mon, 9 Jan 2023 18:33:14 +0100 Subject: [PATCH] unittest: ShopCommandTest.java --- .../java/org/bitbiome/commands/ShopCommand.java | 2 +- .../org/bitbiome/commands/ShopCommandTest.java | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 src/test/java/org/bitbiome/commands/ShopCommandTest.java diff --git a/src/main/java/org/bitbiome/commands/ShopCommand.java b/src/main/java/org/bitbiome/commands/ShopCommand.java index 3cc6337..1231a48 100644 --- a/src/main/java/org/bitbiome/commands/ShopCommand.java +++ b/src/main/java/org/bitbiome/commands/ShopCommand.java @@ -35,7 +35,7 @@ public class ShopCommand implements CommandAPI{ } } - private boolean validInput(String input){ + public static boolean validInput(String input){ return (input.equals("1") || input.equals("2") || input.equals("3")); } diff --git a/src/test/java/org/bitbiome/commands/ShopCommandTest.java b/src/test/java/org/bitbiome/commands/ShopCommandTest.java new file mode 100644 index 0000000..449fc23 --- /dev/null +++ b/src/test/java/org/bitbiome/commands/ShopCommandTest.java @@ -0,0 +1,16 @@ +package org.bitbiome.commands; + +import org.bitbiome.shop.Shop; +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +public class ShopCommandTest { + final ShopCommand shopCommand = new ShopCommand(); + @Test + public void testValidInput(){ + boolean expected = true; + boolean result = shopCommand.validInput("1"); + assertEquals(expected, result); + } +}