Add unit test stuff from pubsub branch.