mirror of
https://github.com/Minestom/Minestom.git
synced 2024-12-27 11:38:03 +01:00
Add InventoryTest
This commit is contained in:
parent
80baeb6e54
commit
62fc71338b
33
src/test/java/inventory/InventoryTest.java
Normal file
33
src/test/java/inventory/InventoryTest.java
Normal file
@ -0,0 +1,33 @@
|
||||
package inventory;
|
||||
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.minestom.server.inventory.Inventory;
|
||||
import net.minestom.server.inventory.InventoryType;
|
||||
import net.minestom.server.item.ItemStack;
|
||||
import net.minestom.server.item.Material;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertSame;
|
||||
|
||||
public class InventoryTest {
|
||||
|
||||
@Test
|
||||
public void testCreation() {
|
||||
Inventory inventory = new Inventory(InventoryType.CHEST_1_ROW, "title");
|
||||
assertEquals(InventoryType.CHEST_1_ROW, inventory.getInventoryType());
|
||||
assertEquals(Component.text("title"), inventory.getTitle());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testEntry() {
|
||||
Inventory inventory = new Inventory(InventoryType.CHEST_1_ROW, "title");
|
||||
assertSame(ItemStack.AIR, inventory.getItemStack(0));
|
||||
var item = ItemStack.of(Material.DIAMOND);
|
||||
inventory.setItemStack(0, item);
|
||||
assertSame(item, inventory.getItemStack(0));
|
||||
|
||||
inventory.setItemStack(0, ItemStack.AIR);
|
||||
assertSame(ItemStack.AIR, inventory.getItemStack(0));
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user