diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml
new file mode 100644
index 0000000..a5d4b84
--- /dev/null
+++ b/.idea/inspectionProfiles/Project_Default.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/main/java/cz/jull/Game.java b/src/main/java/cz/jull/Game.java
index f465914..e52dff9 100644
--- a/src/main/java/cz/jull/Game.java
+++ b/src/main/java/cz/jull/Game.java
@@ -39,9 +39,6 @@ public class Game {
this.strings = strings;
}
- public Game() {
- }
-
public void play() {
strings.print("welcome");
Cli.pressEnter();
diff --git a/src/main/java/cz/jull/Item.java b/src/main/java/cz/jull/Item.java
index e04d9a1..021e7b6 100644
--- a/src/main/java/cz/jull/Item.java
+++ b/src/main/java/cz/jull/Item.java
@@ -1,7 +1,15 @@
package cz.jull;
+import cz.jull.actions.Action;
+import cz.jull.actions.BuildAction;
+import cz.jull.actions.axe.AxeCutTreesAction;
+import cz.jull.actions.vineyard.VineyardHarvestAction;
+import cz.jull.actions.wheat_farmland.WheatFarmlandHarvestAction;
+import cz.jull.actions.wheat_farmland.WheatFarmlandPlantAction;
import lombok.Getter;
+import java.util.ArrayList;
+import java.util.List;
import java.util.function.Function;
/**
@@ -12,40 +20,40 @@ import java.util.function.Function;
* The same thing applies for buying.
*/
public enum Item implements Buildable {
- AXE("Axe", false, 5),
+ AXE("Axe", false, 5, List.of(new AxeCutTreesAction())),
- WHEAT("Wheat", false, 0),
- HOPS("Hops", false, 0),
- GRAPEVINE("Grapes", false, 0),
- WOOD("Wood", false, 0),
- MILK("Milk", false, 0),
+ WHEAT("Wheat", false, 0, List.of()),
+ HOPS("Hops", false, 0, List.of()),
+ GRAPEVINE("Grapes", false, 0, List.of()),
+ WOOD("Wood", false, 0, List.of()),
+ MILK("Milk", false, 0, List.of()),
- WHEAT_SEEDS("Wheat seeds", true, 5),
- HOPS_SEEDS("Hops seeds", true, 5),
- GRAPEVINE_SEEDS("Grapes seeds", true, 5),
+ WHEAT_SEEDS("Wheat seeds", true, 5, List.of()),
+ HOPS_SEEDS("Hops seeds", true, 5, List.of()),
+ GRAPEVINE_SEEDS("Grapes seeds", true, 5, List.of()),
- VINEYARD("Vineyard", true, 7),
- WHEAT_FARMLAND("Wheat farmland", true, 7),
- HOPS_FARMLAND("Hops farmland", true, 7),
+ VINEYARD("Vineyard", true, 7, List.of(new BuildAction()), List.of(new VineyardHarvestAction())),
+ WHEAT_FARMLAND("Wheat farmland", true, 7, List.of(new BuildAction()), List.of(new WheatFarmlandHarvestAction(), new WheatFarmlandPlantAction())),
+ HOPS_FARMLAND("Hops farmland", true, 7, List.of(new BuildAction())),
- FENCE_WITH_COWS("Fence with cows", true, 100),
+ FENCE_WITH_COWS("Fence with cows", true, 100, List.of(new BuildAction()), List.of()),
- CHURCH("Church", true, 100),
- VILLAGER_HOUSE("Villager house", true, 50),
+ CHURCH("Church", true, 100, List.of(new BuildAction())),
+ VILLAGER_HOUSE("Villager house", true, 50, List.of(new BuildAction())),
- PUB("Pub", true, 400),
- WINERY("Winery", true, 350),
- BAKERY("Bakery", true, 350),
+ PUB("Pub", true, 400, List.of(new BuildAction()), List.of()),
+ WINERY("Winery", true, 350, List.of(new BuildAction()), List.of()),
+ BAKERY("Bakery", true, 350, List.of(new BuildAction()), List.of()),
- WELL("Well", true, 30),
+ WELL("Well", true, 30, List.of()),
- COAL_FACTORY("Coal factory", true, 200),
- CHEESE_FACTORY("Cheese factory", true, 200);
+ COAL_FACTORY("Coal factory", true, 200, List.of(new BuildAction()), List.of()),
+ CHEESE_FACTORY("Cheese factory", true, 200, List.of(new BuildAction()), List.of()),;
static {
WHEAT_SEEDS.canBeBuiltFunction = game -> {
- if (game.getBuildings().stream().filter(building -> building == Item.WHEAT_FARMLAND).count() >= game.getBuildings().stream().filter(building -> building == Item.WHEAT_SEEDS || building == Item.HOPS_SEEDS).count() + 1) {
+ if (game.getBuildings().stream().filter(building -> building == Item.WHEAT_FARMLAND).count() >= game.getBuildings().stream().filter(building -> building == Item.WHEAT_SEEDS).count() + 1) {
return true;
}
System.out.println(" "); //TODO
@@ -53,7 +61,7 @@ public enum Item implements Buildable {
};
HOPS_SEEDS.canBeBuiltFunction = game -> {
- if (game.getBuildings().stream().filter(building -> building == Item.WHEAT_FARMLAND).count() >= game.getBuildings().stream().filter(building -> building == Item.WHEAT_SEEDS || building == Item.HOPS_SEEDS).count() + 1) {
+ if (game.getBuildings().stream().filter(building -> building == Item.WHEAT_FARMLAND).count() >= game.getBuildings().stream().filter(building -> building == Item.HOPS_SEEDS).count() + 1) {
return true;
}
System.out.println(" "); //TODO
@@ -61,7 +69,7 @@ public enum Item implements Buildable {
};
GRAPEVINE_SEEDS.canBeBuiltFunction = game -> {
- if (game.getBuildings().stream().filter(building -> building == Item.VINEYARD).count() >= game.getBuildings().stream().filter(building -> building == Item.GRAPEVINE_SEEDS || building == Item.HOPS_SEEDS).count() + 1) {
+ if (game.getBuildings().stream().filter(building -> building == Item.VINEYARD).count() >= game.getBuildings().stream().filter(building -> building == Item.GRAPEVINE_SEEDS).count() + 1) {
return true;
}
System.out.println(" "); //TODO
@@ -191,6 +199,12 @@ public enum Item implements Buildable {
@Getter
private final int price;
+ @Getter
+ private final List actions;
+
+ @Getter
+ private List buildActions = new ArrayList<>();
+
/**
* Function that determines if the item can be built or not
*/
@@ -202,17 +216,28 @@ public enum Item implements Buildable {
@Getter
private Function canBeBoughtFunction;
- Item(String name, boolean isPlaceable, int price) {
+ Item(String name, boolean isPlaceable, int price, List actions) {
this.name = name;
this.isPlaceable = isPlaceable;
this.canBeBuiltFunction = ignored -> isPlaceable;
this.price = price;
this.canBeBoughtFunction = ignored -> true;
+ this.actions = actions;
+ }
+
+ Item(String name, boolean isPlaceable, int price, List actions, List buildActions) {
+ this.name = name;
+ this.isPlaceable = isPlaceable;
+ this.canBeBuiltFunction = ignored -> isPlaceable;
+ this.price = price;
+ this.canBeBoughtFunction = ignored -> true;
+ this.actions = actions;
+ this.buildActions = buildActions;
}
/**
* Function that executes function that determines if the item can be built or not
- * @param game
+ * @param game The game instance
* @return Boolean if the item can be built
*/
@Override
diff --git a/src/main/java/cz/jull/actions/Action.java b/src/main/java/cz/jull/actions/Action.java
new file mode 100644
index 0000000..8d469bc
--- /dev/null
+++ b/src/main/java/cz/jull/actions/Action.java
@@ -0,0 +1,10 @@
+package cz.jull.actions;
+
+import cz.jull.Game;
+import cz.jull.Item;
+
+public abstract class Action {
+ public abstract String toString();
+
+ public abstract void execute(Game game, Item item);
+}
diff --git a/src/main/java/cz/jull/actions/BuildAction.java b/src/main/java/cz/jull/actions/BuildAction.java
new file mode 100644
index 0000000..40ed828
--- /dev/null
+++ b/src/main/java/cz/jull/actions/BuildAction.java
@@ -0,0 +1,17 @@
+package cz.jull.actions;
+
+import cz.jull.Game;
+import cz.jull.Item;
+
+public class BuildAction extends Action {
+ @Override
+ public String toString() {
+ return "Build";
+ }
+
+ @Override
+ public void execute(Game game, Item item) {
+ game.build(item);
+ }
+}
+
diff --git a/src/main/java/cz/jull/actions/axe/AxeCutTreesAction.java b/src/main/java/cz/jull/actions/axe/AxeCutTreesAction.java
new file mode 100644
index 0000000..eeb7bf9
--- /dev/null
+++ b/src/main/java/cz/jull/actions/axe/AxeCutTreesAction.java
@@ -0,0 +1,17 @@
+package cz.jull.actions.axe;
+
+import cz.jull.Game;
+import cz.jull.Item;
+import cz.jull.actions.Action;
+
+public class AxeCutTreesAction extends Action {
+ @Override
+ public String toString() {
+ return "Cut trees";
+ }
+
+ @Override
+ public void execute(Game game, Item item) {
+ game.cutTrees();
+ }
+}
diff --git a/src/main/java/cz/jull/actions/hops_farmland/HopsFarmlandHarvestAction.java b/src/main/java/cz/jull/actions/hops_farmland/HopsFarmlandHarvestAction.java
new file mode 100644
index 0000000..189c276
--- /dev/null
+++ b/src/main/java/cz/jull/actions/hops_farmland/HopsFarmlandHarvestAction.java
@@ -0,0 +1,17 @@
+package cz.jull.actions.hops_farmland;
+
+import cz.jull.Game;
+import cz.jull.Item;
+import cz.jull.actions.Action;
+
+public class HopsFarmlandHarvestAction extends Action {
+ @Override
+ public String toString() {
+ return "Harvest hops";
+ }
+
+ @Override
+ public void execute(Game game, Item item) {
+ game.harvest(Item.HOPS_FARMLAND);
+ }
+}
diff --git a/src/main/java/cz/jull/actions/vineyard/VineyardHarvestAction.java b/src/main/java/cz/jull/actions/vineyard/VineyardHarvestAction.java
new file mode 100644
index 0000000..1ba1f3b
--- /dev/null
+++ b/src/main/java/cz/jull/actions/vineyard/VineyardHarvestAction.java
@@ -0,0 +1,17 @@
+package cz.jull.actions.vineyard;
+
+import cz.jull.Game;
+import cz.jull.Item;
+import cz.jull.actions.Action;
+
+public class VineyardHarvestAction extends Action {
+ @Override
+ public String toString() {
+ return "Harverst grapevines";
+ }
+
+ @Override
+ public void execute(Game game, Item item) {
+ game.harvest(Item.VINEYARD);
+ }
+}
diff --git a/src/main/java/cz/jull/actions/wheat_farmland/WheatFarmlandHarvestAction.java b/src/main/java/cz/jull/actions/wheat_farmland/WheatFarmlandHarvestAction.java
new file mode 100644
index 0000000..9c27715
--- /dev/null
+++ b/src/main/java/cz/jull/actions/wheat_farmland/WheatFarmlandHarvestAction.java
@@ -0,0 +1,17 @@
+package cz.jull.actions.wheat_farmland;
+
+import cz.jull.Game;
+import cz.jull.Item;
+import cz.jull.actions.Action;
+
+public class WheatFarmlandHarvestAction extends Action {
+ @Override
+ public String toString() {
+ return "Harvest wheats";
+ }
+
+ @Override
+ public void execute(Game game, Item item) {
+ game.harvest(Item.WHEAT_FARMLAND);
+ }
+}
diff --git a/src/main/java/cz/jull/actions/wheat_farmland/WheatFarmlandPlantAction.java b/src/main/java/cz/jull/actions/wheat_farmland/WheatFarmlandPlantAction.java
new file mode 100644
index 0000000..d985e5d
--- /dev/null
+++ b/src/main/java/cz/jull/actions/wheat_farmland/WheatFarmlandPlantAction.java
@@ -0,0 +1,17 @@
+package cz.jull.actions.wheat_farmland;
+
+import cz.jull.Game;
+import cz.jull.Item;
+import cz.jull.actions.Action;
+
+public class WheatFarmlandPlantAction extends Action {
+ @Override
+ public String toString() {
+ return "Plant wheat seeds";
+ }
+
+ @Override
+ public void execute(Game game, Item item) {
+ game.build(Item.WHEAT_SEEDS);
+ }
+}
diff --git a/src/main/java/cz/jull/market/Market.java b/src/main/java/cz/jull/market/Market.java
index 08665bd..0e463c4 100644
--- a/src/main/java/cz/jull/market/Market.java
+++ b/src/main/java/cz/jull/market/Market.java
@@ -57,7 +57,7 @@ public class Market {
public Market(Game game) {
// Soil Type
if (game.getSoilType() == SoilType.STONY) {
- availableItems.addAll(List.of(Item.FENCE_WITH_COWS, Item.VINEYARD));
+ availableItems.addAll(List.of(Item.FENCE_WITH_COWS, Item.VINEYARD, Item.GRAPEVINE_SEEDS));
}
if (game.getSoilType() == SoilType.LESS_FERTILE) {
@@ -65,7 +65,7 @@ public class Market {
}
if (game.getSoilType() == SoilType.FERTILE) {
- availableItems.add(Item.WHEAT_FARMLAND);
+ availableItems.addAll(List.of(Item.WHEAT_FARMLAND, Item.WHEAT_SEEDS, Item.HOPS_FARMLAND, Item.HOPS_SEEDS));
}
// Path Type
diff --git a/src/main/java/cz/jull/tui/Menu.java b/src/main/java/cz/jull/tui/Menu.java
index 2d485c9..1fc7940 100644
--- a/src/main/java/cz/jull/tui/Menu.java
+++ b/src/main/java/cz/jull/tui/Menu.java
@@ -2,14 +2,32 @@ package cz.jull.tui;
import cz.jull.Game;
import cz.jull.Item;
+import cz.jull.actions.Action;
import lombok.RequiredArgsConstructor;
+import java.io.IOException;
+import java.io.InputStream;
+import java.nio.charset.StandardCharsets;
+import java.util.ArrayList;
import java.util.List;
@RequiredArgsConstructor
public class Menu {
private final Game game;
+ public static String loadResource(String fileName) {
+ try (InputStream inputStream = Menu.class.getClassLoader().getResourceAsStream(fileName)) {
+ if (inputStream == null) {
+ return "File not found: " + fileName;
+ }
+
+ byte[] bytes = inputStream.readAllBytes();
+ return new String(bytes, StandardCharsets.UTF_8);
+ } catch (IOException e) {
+ return null;
+ }
+ }
+
public void start() {
int index = Cli.selectOptionIndex(List.of(
"See your inventory",
@@ -18,14 +36,38 @@ public class Menu {
"See your stats" ));
switch (index) {
case 0 -> {
- for (Item item : game.getPlayer().getInventory()) {
- System.out.println(item);
+ List inventory = new ArrayList<>(game.getPlayer().getInventory().stream().map(Item::toString).toList());
+ inventory.add("Go back");
+ int itemIndex = Cli.selectOptionIndex(inventory);
+ if (itemIndex == inventory.size() - 1) {
+ start();
+ return;
}
+ Item item = game.getPlayer().getInventory().get(itemIndex);
+
+ String art = loadResource("item_art/" + item.name() + ".txt");
+ System.out.println(art);
+ System.out.println();
+
+ List actions = item.getActions();
+ actionMenu(item, actions);
}
case 1 -> {
- for (Item building : game.getBuildings()) {
- System.out.println(building);
+ List buildings = new ArrayList<>(game.getBuildings().stream().map(Item::toString).toList());
+ buildings.add("Go back");
+ int itemIndex = Cli.selectOptionIndex(buildings);
+ if (itemIndex == buildings.size() - 1) {
+ start();
+ return;
}
+ Item item = game.getBuildings().get(itemIndex);
+
+ String art = loadResource("item_art/" + item.name() + ".txt");
+ System.out.println(art);
+ System.out.println();
+
+ List actions = item.getBuildActions();
+ actionMenu(item, actions);
}
case 2 -> {
game.getStrings().print("marketGreeting");
@@ -50,11 +92,21 @@ public class Menu {
Item item = game.getMarket().getAvailableItems().get(itemIndex);
game.getMarket().sellItem(game, item);
}
- case 2 -> {
- start();
- }
+ case 2 -> start();
}
}
}
}
+
+ private void actionMenu(Item item, List actions) {
+ List actionStrings = new ArrayList<>(actions.stream().map(Action::toString).toList());
+ actionStrings.add("Go back");
+ int actionIndex = Cli.selectOptionIndex(actionStrings);
+ if (actionIndex == actionStrings.size() - 1) {
+ start();
+ return;
+ }
+ Action action = actions.get(actionIndex);
+ action.execute(game, item);
+ }
}
diff --git a/src/main/resources/item_art/AXE.txt b/src/main/resources/item_art/AXE.txt
new file mode 100644
index 0000000..ecf1062
--- /dev/null
+++ b/src/main/resources/item_art/AXE.txt
@@ -0,0 +1,19 @@
+ ████
+ ██ ██
+ ██ ██
+ ██ ██
+ ██ ██
+ ██ ██
+ ██████ ██████
+ ██████████ ██
+ ████████ ██ ██
+ ████████ ██ ██
+ ████████ ██ ██
+ ████████ ██ ██
+ ████████ ██ ████
+ ████████ ████
+ ████████
+ ████████
+ ████████
+████████
+██████
diff --git a/src/main/resources/item_art/BAKERY.txt b/src/main/resources/item_art/BAKERY.txt
new file mode 100644
index 0000000..7af6607
--- /dev/null
+++ b/src/main/resources/item_art/BAKERY.txt
@@ -0,0 +1,13 @@
+ ▄▄▄▄▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▄▄▄▄
+ ▄▄▀▀▀▀▀▀ ▄▄████▀▀ ▄▄▄▄████ ▀▀▀▀▀▀▀▀▄▄▄▄
+ ▄▄▀▀ ▄▄████▀▀ ▄▄██████▀▀ ▄▄████ ▀▀▄▄▄▄▄▄
+▄▄██ ████ ██████▀▀ ▄▄████▀▀ ▀▀▄▄
+██ ▄▄██ ▄▄████▀▀ ▄▄████ ▄▄▄▄██▀▀ ▀▀▄▄
+██ ▀▀ ████▀▀ ████▀▀ ▄▄██▀▀ ▀▀▄▄
+██ ██ ▄▄██▀▀ ██ ██▄▄
+ ██▄▄ ▀▀▀▀ ██
+ ▀▀▄▄ ▄▄▀▀
+ ▀▀▄▄▄▄ ▄▄▀▀
+ ▀▀▀▀▄▄▄▄ ▄▄▄▄▀▀
+ ▀▀▀▀▀▀▄▄▄▄▄▄▄▄ ▄▄▄▄▄▄▄▄▀▀▀▀
+ ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
diff --git a/src/main/resources/item_art/CHURCH.txt b/src/main/resources/item_art/CHURCH.txt
new file mode 100644
index 0000000..1598189
--- /dev/null
+++ b/src/main/resources/item_art/CHURCH.txt
@@ -0,0 +1,28 @@
+ ██
+ ██████
+ ██
+ ██
+ ██████
+ ██ ██
+ ██ ██
+ ██ ██
+ ██ ██
+ ██ ██████ ██
+ ██ ██ ██ ██
+ ██████ ██ ██ ██████
+ ██ ██ ██ ██
+ ██ ██████ ██
+ ██ ██
+ ██ ██
+ ██ ██
+ ██ ██
+██ ██
+████████ ████████
+ ██ ██
+ ██ ██████████ ██
+ ██ ██ ██ ██
+ ██ ██ ██ ██
+ ██ ██ ██ ██
+ ██ ██ ██ ██
+ ██ ██ ██ ██
+ ██████████████████████████████████████
\ No newline at end of file
diff --git a/src/main/resources/item_art/COAL_FACTORY.txt b/src/main/resources/item_art/COAL_FACTORY.txt
new file mode 100644
index 0000000..a5c7921
--- /dev/null
+++ b/src/main/resources/item_art/COAL_FACTORY.txt
@@ -0,0 +1,13 @@
+ ██████████████
+ ██████████████████████
+ ██████████████████████████████
+ ██████████████████████████████████
+ ██████████████████████████████████████
+██████████████████████████████████████████████
+██████████████████████████████████████████████
+██████████████████████████████████████████████████
+██████████████████████████████████████████████████
+ ▀▀██████████████████████████████████████████▀▀▀▀
+ ▀▀▀▀██████████████████████████████████▀▀▀▀
+ ▀▀▀▀██████████████▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
+ ▀▀▀▀▀▀▀▀▀▀▀▀▀▀
diff --git a/src/main/resources/item_art/HOPS.txt b/src/main/resources/item_art/HOPS.txt
new file mode 100644
index 0000000..c69cee6
--- /dev/null
+++ b/src/main/resources/item_art/HOPS.txt
@@ -0,0 +1,28 @@
+ ██
+ ██ ██
+ ██ ██
+ ██████ ██████
+ ██████ ██████ ██████
+ ████ ██ ████
+ ████ ████
+ ████ ████
+ ██ ██
+ ██ ██
+ ██ ██
+████ ██ ██ ████
+██ ████ ████ ██
+██ ██ ██ ██ ██ ██
+██ ████ ██ ██ ████ ██
+████████ ██ ██ ████████
+ ██ ██ ██ ██
+ ██ ████ ████ ██
+ ██ ██████████ ██
+ ██ ██ ██ ██
+ ████ ██ ██ ████
+ ████ ██ ██ ████
+ ██████ ██████
+ ██ ██
+ ██ ██
+ ██ ██
+ ████ ████
+ ██
diff --git a/src/main/resources/item_art/VILLAGER_HOUSE.txt b/src/main/resources/item_art/VILLAGER_HOUSE.txt
new file mode 100644
index 0000000..1d1e5b8
--- /dev/null
+++ b/src/main/resources/item_art/VILLAGER_HOUSE.txt
@@ -0,0 +1,13 @@
+ ▄▄▄▄▄▄▄▄▄▄ ▄▄▀▀▄▄
+ ██ ██▄▄▀▀ ▀▀▄▄
+ ██ ▄▄▀▀ ▄▄▀▀▀▀▀▀▄▄ ▀▀▄▄
+ ██▄▄▀▀ ▄▄▀▀ ▀▀▄▄ ▀▀▄▄
+ ▄▄▀▀ ▄▄▀▀ ▀▀▄▄ ▀▀▄▄
+ ▄▄▀▀ ▄▄▀▀ ▀▀▄▄ ▀▀▄▄
+▀▀▄▄▄▄██ ▄▄▄▄▄▄▄▄▄▄▄▄ ██▄▄▄▄▀▀
+ ██ ██ ██ ██▀▀▀▀▀▀▀▀▀▀██ ██
+ ██ ██ ██ ██ ██ ██
+ ██ ██ ▄▄██ ██ ██ ██
+ ██ ██ ██ ██▄▄▄▄▄▄▄▄▄▄██ ██
+ ██ ██ ██ ██
+ ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
diff --git a/src/main/resources/item_art/WHEAT.txt b/src/main/resources/item_art/WHEAT.txt
new file mode 100644
index 0000000..50517cc
--- /dev/null
+++ b/src/main/resources/item_art/WHEAT.txt
@@ -0,0 +1,22 @@
+ ██
+ ██
+ ██ ██
+ ██ ████
+ ██ ████
+ ██ ████ ██
+ ██ ██████████
+ ██ ██ ████
+ ██ ██ ████ ██
+ ██ ██ ████████
+ ██ ██ ████
+ ██ ██ ██ ██████████
+ ██ ██ ████ ██
+ ██ ██ ██████████████
+ ██ ████
+ ██ ████████████
+ ████ ██
+ ██████████████
+ ██
+ ██
+ ██
+██
diff --git a/src/test/java/cz/jull/NotSufficientCoinsTest.java b/src/test/java/cz/jull/NotSufficientCoinsTest.java
index d497f9c..b4620f1 100644
--- a/src/test/java/cz/jull/NotSufficientCoinsTest.java
+++ b/src/test/java/cz/jull/NotSufficientCoinsTest.java
@@ -1,13 +1,18 @@
package cz.jull;
import cz.jull.exceptions.NotSufficientsCoinsException;
+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() {
- Game game = new Game();
+ 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));
}