chore: minor changes

This commit is contained in:
2025-05-29 19:37:19 +02:00
parent 671f6e11ba
commit 2fd206dac4
4 changed files with 2 additions and 28 deletions

View File

@@ -26,13 +26,6 @@
<version>1.18.38</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>5.8.2</version> <!-- Choose the latest version -->
<scope>test</scope>
</dependency>
</dependencies>
</project>

View File

@@ -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);
}
/**

View File

@@ -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));
}
}