Search in sources :

Example 6 with TypeValue

use of uk.gov.gchq.gaffer.types.TypeValue in project Gaffer by gchq.

the class TypeValueSerialiserTest method testCanSerialiseDeSerialiseCorrectly.

@Test
public void testCanSerialiseDeSerialiseCorrectly() throws SerialisationException {
    TypeValue typeValue = new TypeValue("testType", "testValue");
    byte[] bytes = serialiser.serialise(typeValue);
    String serialisedForm = new String(bytes);
    assertEquals("testType\0testValue", serialisedForm);
    TypeValue deSerialisedTypeValue = (TypeValue) serialiser.deserialise(bytes);
    assertEquals(typeValue.getType(), deSerialisedTypeValue.getType());
    assertEquals(typeValue.getValue(), deSerialisedTypeValue.getValue());
    assertEquals(typeValue, deSerialisedTypeValue);
}
Also used : TypeValue(uk.gov.gchq.gaffer.types.TypeValue) Test(org.junit.Test)

Aggregations

TypeValue (uk.gov.gchq.gaffer.types.TypeValue)6 Test (org.junit.Test)4 UnsupportedEncodingException (java.io.UnsupportedEncodingException)1 SerialisationException (uk.gov.gchq.gaffer.exception.SerialisationException)1