long longValue = generateLongTestValue();
float floatValue = generateFloatTestValue();
double doubleValue = generateDoubleTestValue();
char charValue = generateCharTestValue();
PrimitivePojo pojo = new PrimitivePojo(
boolValue,
byteValue,
shortValue,
intValue,
longValue,
floatValue,
doubleValue,
charValue
);
SerializationContext ctx = new SerializationContext();
ByteBuffer buffer = ByteBuffer.allocate(1024);
ctx.serialize(pojo, buffer);
buffer.flip();
DeserializationContext dctx = new DeserializationContext();
Object obj = dctx.deserialize(buffer);
assertTrue("Object must be a PrimitivePojo", obj instanceof PrimitivePojo);
PrimitivePojo response = (PrimitivePojo)obj;
assertEquals(boolValue, response.isBooleanField());
assertEquals(byteValue, response.getByteField());
assertEquals(shortValue, response.getShortField());
assertEquals(intValue, response.getIntField());
assertEquals(longValue, response.getLongField());
assertEquals(floatValue, response.getFloatField(), 0.0);
assertEquals(doubleValue, response.getDoubleField(), 0.0);
assertEquals(charValue, response.getCharField());
System.out.println(pojo);
System.out.println(response);
}