chore: minor changes
This commit is contained in:
7
pom.xml
7
pom.xml
@@ -26,13 +26,6 @@
|
|||||||
<version>1.18.38</version>
|
<version>1.18.38</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</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>
|
</dependencies>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
@@ -54,7 +54,8 @@ public class Strings {
|
|||||||
*/
|
*/
|
||||||
public static Strings load() throws IOException {
|
public static Strings load() throws IOException {
|
||||||
ObjectMapper objectMapper = new ObjectMapper();
|
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -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));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user