Fixed fragile tests, added tests for setMessage and adjusted the
functions to support the new test assumptions.