title: Object argument to mock EXPECT_CALL
body: <p>I have a simple mock class:</p>
  
  <pre><code>class MockCanInterface : public lib::CanInterface {
   public:
    MockCanInterface() : CanInterface({"mock"}) {}
  
    MOCK_METHOD1(Write, bool(const lib::CanFrame&amp; frame));
    MOCK_METHOD1(Read, bool(lib::CanFrame* frame));
  };
  </code></pre>
  
  <p>In the test code I want to pass an object to the <code>Write</code> method. Is there a way to do this with <code>.With</code> clause? It works with passing argument directly, but now with <code>.With</code>. The code compiles, but fails during execution - the size of the object is correct, but the data isn't.</p>
  
  <p>This works:</p>
  
  <pre><code>EXPECT_CALL(can_, Write(expected_command_))
          .WillOnce(Return(true));
  </code></pre>
  
  <p>This doesn't:</p>
  
  <pre><code>EXPECT_CALL(can_, Write(_))
          .With(Args&lt;0&gt;(expected_command_))
          .WillOnce(Return(true));
  </code></pre>
  
  <p>I admit that there may be something missing in the way the code sets the expected object.</p>