improved expactations messages
replaced deprecated StringOutputStream with ByteArrayOutputStream