From 2fd206dac4e9bff52d9520c8a5cd5706fea2ed07 Mon Sep 17 00:00:00 2001 From: jull Date: Thu, 29 May 2025 19:37:19 +0200 Subject: [PATCH] chore: minor changes --- pom.xml | 7 ------- src/main/java/cz/jull/tui/Strings.java | 3 ++- .../main/resources/strings.json | 0 .../java/cz/jull/NotSufficientCoinsTest.java | 20 ------------------- 4 files changed, 2 insertions(+), 28 deletions(-) rename strings.json => src/main/resources/strings.json (100%) delete mode 100644 src/test/java/cz/jull/NotSufficientCoinsTest.java diff --git a/pom.xml b/pom.xml index f97ce02..53a66f6 100644 --- a/pom.xml +++ b/pom.xml @@ -26,13 +26,6 @@ 1.18.38 provided - - - org.junit.jupiter - junit-jupiter-api - 5.8.2 - test - \ No newline at end of file diff --git a/src/main/java/cz/jull/tui/Strings.java b/src/main/java/cz/jull/tui/Strings.java index e596804..bdfe3dc 100644 --- a/src/main/java/cz/jull/tui/Strings.java +++ b/src/main/java/cz/jull/tui/Strings.java @@ -54,7 +54,8 @@ public class Strings { */ public static Strings load() throws IOException { ObjectMapper objectMapper = new ObjectMapper(); - return objectMapper.readValue(new File("./strings.json"), Strings.class); + String json = Menu.loadResource("strings.json"); + return objectMapper.readValue(json, Strings.class); } /** diff --git a/strings.json b/src/main/resources/strings.json similarity index 100% rename from strings.json rename to src/main/resources/strings.json diff --git a/src/test/java/cz/jull/NotSufficientCoinsTest.java b/src/test/java/cz/jull/NotSufficientCoinsTest.java deleted file mode 100644 index 050e038..0000000 --- a/src/test/java/cz/jull/NotSufficientCoinsTest.java +++ /dev/null @@ -1,20 +0,0 @@ -package cz.jull; - -import cz.jull.exceptions.NotSufficientsCoinsException; -import cz.jull.items.Item; -import cz.jull.tui.Strings; -import org.junit.jupiter.api.Test; - -import java.io.IOException; - -import static org.junit.jupiter.api.Assertions.*; - -public class NotSufficientCoinsTest { - @Test - public void notSufficientCoins() throws IOException { - Strings strings = Strings.load(); - Game game = new Game(strings); - game.getPlayer().setCoins(1); - assertThrows(NotSufficientsCoinsException.class, () -> game.getMarket().buyItem(game, Item.AXE)); - } -}