mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-23 02:55:47 +01:00
SPIGOT-4646: Test + fix InventoryWrapper.getContents
This commit is contained in:
parent
faa6226959
commit
1dbe87c8cc
@ -128,7 +128,7 @@ public class InventoryWrapper implements IInventory {
|
|||||||
List<ItemStack> items = new ArrayList<ItemStack>(size);
|
List<ItemStack> items = new ArrayList<ItemStack>(size);
|
||||||
|
|
||||||
for (int i = 0; i < size; i++) {
|
for (int i = 0; i < size; i++) {
|
||||||
items.set(i, getItem(i));
|
items.add(getItem(i));
|
||||||
}
|
}
|
||||||
|
|
||||||
return items;
|
return items;
|
||||||
|
@ -0,0 +1,23 @@
|
|||||||
|
package org.bukkit.craftbukkit.inventory;
|
||||||
|
|
||||||
|
import junit.framework.Assert;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.inventory.Inventory;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
|
public class InventoryWrapperTest {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void test() {
|
||||||
|
Inventory raw = new CraftInventoryCustom(null, 9);
|
||||||
|
raw.addItem(new ItemStack(Material.STONE));
|
||||||
|
|
||||||
|
Assert.assertTrue(raw.contains(Material.STONE));
|
||||||
|
|
||||||
|
InventoryWrapper wrapper = new InventoryWrapper(raw);
|
||||||
|
CraftInventory proxy = new CraftInventory(wrapper);
|
||||||
|
|
||||||
|
Assert.assertTrue(proxy.contains(Material.STONE));
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user