Added unit tests for serialize