Validating that the printed message is json isn't really the responsibility of this method; it just calls `#to_json` on the output of `#format` and expects the right thing to happen. If you want to validate the formatted data, you could do something like this:

```ruby
it "format returns a structure that can be converted to json" do
  msg = Puppet::Util::Log.new # etc
  hash = msg.to_hash
  JSON.parse(hash.to_json)
end
```