Search in sources :

Example 6 with ByteArrayNBT

use of net.minecraft.nbt.ByteArrayNBT in project Mekanism by mekanism.

the class CCArgumentWrapperPropertyTest method testListEmptyPlusByteArray.

@Test
@DisplayName("Test serializing and deserializing lists of lists that would create the inner ones as an empty compound plus a byte array")
void testListEmptyPlusByteArray() {
    qt().forAll(lists().of(allBytes()).ofSizeBetween(1, 15)).check(bytes -> {
        ListNBT nbt = fromArray(new ListNBT(), fromBytes(bytes));
        ListNBT expected = fromArray(new ByteArrayNBT(new byte[0]), new ByteArrayNBT(bytes));
        return expected.equals(CCArgumentWrapperTestHelper.wrapAndSanitize(nbt, null, false));
    });
}
Also used : ListNBT(net.minecraft.nbt.ListNBT) ByteArrayNBT(net.minecraft.nbt.ByteArrayNBT) Test(org.junit.jupiter.api.Test) DisplayName(org.junit.jupiter.api.DisplayName)

Aggregations

ByteArrayNBT (net.minecraft.nbt.ByteArrayNBT)6 DisplayName (org.junit.jupiter.api.DisplayName)6 Test (org.junit.jupiter.api.Test)6 ListNBT (net.minecraft.nbt.ListNBT)4 CompoundNBT (net.minecraft.nbt.CompoundNBT)3 Collections (java.util.Collections)2 List (java.util.List)2 Collectors (java.util.stream.Collectors)2 Nullable (javax.annotation.Nullable)2 ByteNBT (net.minecraft.nbt.ByteNBT)2 CollectionNBT (net.minecraft.nbt.CollectionNBT)2 DoubleNBT (net.minecraft.nbt.DoubleNBT)2 FloatNBT (net.minecraft.nbt.FloatNBT)2 INBT (net.minecraft.nbt.INBT)2 IntArrayNBT (net.minecraft.nbt.IntArrayNBT)2 IntNBT (net.minecraft.nbt.IntNBT)2 LongArrayNBT (net.minecraft.nbt.LongArrayNBT)2 LongNBT (net.minecraft.nbt.LongNBT)2 NumberNBT (net.minecraft.nbt.NumberNBT)2 ShortNBT (net.minecraft.nbt.ShortNBT)2