title: Mock reference objects
body: <p>How do you avoid creating superfluous Strings when unit testing?</p>
  
  <p>For example the String "SERIALIZED" seems a bit unnecessary and arbitrary..what would you use instead?</p>
  
  <pre><code>    Object update=new Object(); 
      FileWriter writer=mock(FileWriter.class);
      Serializer serializer=mock(Serializer.class);
      when(cache.getWriter(update)).thenReturn(writer);
      when(serializer.serialize(update)).thenReturn("SERIALIZED");
  
      FileRecorder recorder=new FileRecorder(serializer);
      recorder.receive(update);
      verify(writer).write("SERIALIZED");
  </code></pre>