package cz.jzitnik.game.smelting;

import cz.jzitnik.game.entities.items.Item;
import cz.jzitnik.game.entities.items.ItemBlockSupplier;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;

import java.util.function.Supplier;

import static org.junit.jupiter.api.Assertions.*;

public class SmeltingTest {
    @Test
    @DisplayName("Verity that all items in Smelting are actual items")
    void testAllItems() {
        Smelting smelting = new Smelting();

        for (String item : smelting.smeltingList.keySet()) {
            assertDoesNotThrow(() -> ItemBlockSupplier.getItem(item),
                    "Item " + item + "does not exist but is present as source in Smelting.");
        }

        for (Supplier<Item> supplier : smelting.smeltingList.values()) {
            assertDoesNotThrow(supplier::get, "Item does not exist but is present as result in Smelting.");
        }

        for (String fuel : smelting.fuelList.keySet()) {
            assertDoesNotThrow(() -> ItemBlockSupplier.getItem(fuel),
                    "Item " + fuel + " does not exist but is present as fuel in Smelting.");
        }
    }
}
