Add updateInner test

Signed-off-by: TheMode <themode@outlook.fr>
This commit is contained in:
TheMode 2022-07-29 16:11:13 +02:00
parent 660112dca6
commit 7aec259520

View File

@ -1,5 +1,6 @@
package net.minestom.server.tag;
import net.minestom.server.coordinate.Vec;
import org.junit.jupiter.api.Test;
import static net.minestom.server.api.TestUtils.assertEqualsSNBT;
@ -97,4 +98,18 @@ public class TagUpdateTest {
});
assertEquals(5, result);
}
@Test
public void updateInner() {
var tag = Tag.Structure("vec", Vec.class);
var tagX = Tag.Double("x").path("vec");
var handler = TagHandler.newHandler();
handler.setTag(tag, new Vec(5, 10, 15));
handler.updateTag(tagX, x -> {
assertEquals(5, x);
return 7d;
});
assertEquals(7d, handler.getTag(tagX));
assertEquals(new Vec(7, 10, 15), handler.getTag(tag));
}
}