Added unit tests to ensure mapping between internal and external message representations are consistent and can be carried out automatically.