Search in sources :

Example 1 with Bytes20Deserializer

use of tech.pegasys.teku.ethereum.executionlayer.client.serialization.Bytes20Deserializer in project teku by ConsenSys.

the class Web3JExecutionEngineClientTest method shouldSerializeDeserializeBytes20.

@TestTemplate
void shouldSerializeDeserializeBytes20() throws IOException {
    Bytes20 originalBytes20 = dataStructureUtil.randomBytes20();
    new Bytes20Serializer().serialize(originalBytes20, jsonGenerator, serializerProvider);
    jsonGenerator.flush();
    JsonParser parser = prepareDeserializationContext(jsonWriter.toString());
    Bytes20Deserializer deserializer = new Bytes20Deserializer();
    Bytes20 result = deserializer.deserialize(parser, objectMapper.getDeserializationContext());
    assertThat(originalBytes20).isEqualTo(result);
}
Also used : Bytes20Deserializer(tech.pegasys.teku.ethereum.executionlayer.client.serialization.Bytes20Deserializer) Bytes20Serializer(tech.pegasys.teku.ethereum.executionlayer.client.serialization.Bytes20Serializer) Bytes20(tech.pegasys.teku.infrastructure.bytes.Bytes20) JsonParser(com.fasterxml.jackson.core.JsonParser) TestTemplate(org.junit.jupiter.api.TestTemplate)

Aggregations

JsonParser (com.fasterxml.jackson.core.JsonParser)1 TestTemplate (org.junit.jupiter.api.TestTemplate)1 Bytes20Deserializer (tech.pegasys.teku.ethereum.executionlayer.client.serialization.Bytes20Deserializer)1 Bytes20Serializer (tech.pegasys.teku.ethereum.executionlayer.client.serialization.Bytes20Serializer)1 Bytes20 (tech.pegasys.teku.infrastructure.bytes.Bytes20)1