mirror of
https://github.com/Minestom/Minestom.git
synced 2024-12-24 01:58:00 +01:00
Test item snbt in tag
This commit is contained in:
parent
60d22929a1
commit
3c2ef39d1b
@ -6,6 +6,7 @@ import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
|
||||
import static net.minestom.server.api.TestUtils.assertEqualsSNBT;
|
||||
import static net.minestom.server.api.TestUtils.waitUntilCleared;
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
@ -91,4 +92,22 @@ public class TagItemTest {
|
||||
assertEquals(item2.toItemNBT(), handler.getTag(nbtTag));
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void snbt() {
|
||||
var handler = TagHandler.newHandler();
|
||||
var tag = Tag.ItemStack("item");
|
||||
handler.setTag(tag, ItemStack.of(Material.DIAMOND));
|
||||
assertEqualsSNBT("""
|
||||
{
|
||||
"item": {
|
||||
"id":"minecraft:diamond",
|
||||
"Count":1B,
|
||||
"tag":{}
|
||||
}
|
||||
}
|
||||
""", handler.asCompound());
|
||||
handler.removeTag(tag);
|
||||
assertEqualsSNBT("{}", handler.asCompound());
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user