unit test for the whole serialization process