Search in sources :

Example 1 with PersistedBytes

use of org.terasology.persistence.typeHandling.inMemory.PersistedBytes in project Terasology by MovingBlocks.

the class BytesTypeHandlerTest method byteArraySerializeDeserialize.

@Test
void byteArraySerializeDeserialize() {
    byte[] expectedObj = new byte[] { (byte) 0xFF };
    PersistedBytes data = serialize(expectedObj, new ByteArrayTypeHandler());
    Assertions.assertEquals(expectedObj, data.getAsBytes());
    byte[] obj = deserialize(data, new ByteArrayTypeHandler());
    Assertions.assertEquals(expectedObj, obj);
}
Also used : ByteArrayTypeHandler(org.terasology.persistence.typeHandling.coreTypes.ByteArrayTypeHandler) PersistedBytes(org.terasology.persistence.typeHandling.inMemory.PersistedBytes) Test(org.junit.jupiter.api.Test)

Example 2 with PersistedBytes

use of org.terasology.persistence.typeHandling.inMemory.PersistedBytes in project Terasology by MovingBlocks.

the class BytesTypeHandlerTest method byteSerializeDeserialize.

@Test
void byteSerializeDeserialize() {
    byte expectedObj = (byte) 0xFF;
    PersistedBytes data = serialize(expectedObj, new ByteTypeHandler());
    Assertions.assertEquals(expectedObj, data.getAsBytes()[0]);
    byte obj = deserialize(data, new ByteTypeHandler());
    Assertions.assertEquals(expectedObj, obj);
}
Also used : PersistedBytes(org.terasology.persistence.typeHandling.inMemory.PersistedBytes) ByteTypeHandler(org.terasology.persistence.typeHandling.coreTypes.ByteTypeHandler) Test(org.junit.jupiter.api.Test)

Aggregations

Test (org.junit.jupiter.api.Test)2 PersistedBytes (org.terasology.persistence.typeHandling.inMemory.PersistedBytes)2 ByteArrayTypeHandler (org.terasology.persistence.typeHandling.coreTypes.ByteArrayTypeHandler)1 ByteTypeHandler (org.terasology.persistence.typeHandling.coreTypes.ByteTypeHandler)1