title: How do I mock a method call with arguments that don't implement `equals`?
body: <p>I'm writing unit tests for a <code>SystemLoggingService</code> and mocking all calls to it's repository.
  I'm using <code>Spring</code> with a <code>JPA</code> repository. </p>
  
  <pre><code>@Repository
  public interface SystemLoggingRepository extends PagingAndSortingRepository&lt;SystemLogEntity, Long&gt;, JpaSpecificationExecutor&lt;SystemLogEntity&gt; {
  }
  </code></pre>
  
  <p>For a unit test of the service method <code>findAll(Searchable searchable,Pageable pageable)</code> I need to mock the repository method <code>findAll(Specification&lt;T&gt; spec, Pageable pageable)</code></p>
  
  <p>As one sees, the <code>Searchable</code> object gets transformed to a JPA <code>Specifications</code> object within the service logic.</p>
  
  <p>The problem is that the JPA's <code>Specifications</code> class which my service logic will pass over to repository method does not implement <code>equals()</code>. </p>
  
  <p>In other words, I cannot mock the repository method very precisely as I have to use <code>Matchers.any(Specifications.class)</code>    </p>
  
  <pre><code>BDDMockito.given(systemLoggingRepository.findAll(Matchers.any(Specifications.class), Matchers.eq(pageRequest))).willReturn(...)
  </code></pre>
  
  <p>How bad is this for the quality of the unit test or is this common practice? What would be a different approach to this problem?
  The <code>Specifications</code> object is a Spring framework class. It's not an option to just add the <code>equals()</code> method.</p>