MessageImpl implements Message { @Override public String toString() { return MoreObjects.toStringHelper( this ).add( "id", id ).add( "sourcePeerId", sourcePeerId ) .add( "sender", sender ).add( "payloadString", payloadString ).toString(); } MessageImpl( Message message );  MessageImpl( String sourcePeerId, Object payload ); @Override String getSourcePeerId(); @Override UUID getId(); @Override T getPayload( Class<T> clazz ); @Override String getSender(); @Override void setSender( final String sender ); @Override String getPayload(); @Override String toString(); static final int MAX_SENDER_LEN; }
@Test public void testToString() throws Exception { assertThat( message.toString(), containsString( SOURCE_PEER_ID ) ); message.setSender( SENDER ); assertThat( message.toString(), containsString( SENDER ) ); }