Add tests for name retrieval and serialization.

Fixed bug related to getName uncovered while testing.