Factor out test message creation.