title: Mockito Error "Value must not be null" on when thenReturn with any()
body: <p>I have the following code in my unit tests to simulate database calls:</p>
  
  <pre><code>Mockito.when(valueRepository.findAllByDateBetweenAndValueContent_BoolVal(
          any(LocalDate.class),
          any(LocalDate.class),
          anyBoolean()
  )).thenReturn(new ArrayList&lt;&gt;());
  </code></pre>
  
  <p>Whenever I try to run my code I get the following error:</p>
  
  <pre><code>org.springframework.dao.InvalidDataAccessApiUsageException: Value must not be null!; nested exception is java.lang.IllegalArgumentException: Value must not be null!
  </code></pre>
  
  <p>I tried messing around with the Return value and with the Inputs (any...) but I couldn't find a solution and I don't really understand what value is null / what spring is complaining about. </p>
  
  <p>The valueRepository - variable was initialized correctly, I checked with debug that it is not null.</p>