title: Spring Boot and Mockito verify always true
body: <p>I have a test in which I want to verify that a method was called with given parameters:</p>
  
  <pre><code>    @Autowired
      private Client client;
  
      @Autowired
      private OtherClient otherClient;
  
      @Test
      public void test() {
          client.push();
  
          Mockito.verify(otherClient).publishReset(
              Mockito.anyString(),
              Mockito.argThat(l -&gt; l.size() == 3)
          );
      }
  </code></pre>
  
  <p>Problem is that <code>Mockito.verify</code> doesn't fail at all, I can replace <code>l -&gt; l.size() == 3</code> with any other size match and given test will always pass. How is it even possible for verify to always pass whatever I pass to argThat?</p>
  
  <p>Full example below:</p>
  
  <pre><code>@EnableConfigurationProperties
  @TestExecutionListeners(listeners = {
      DirtiesContextTestExecutionListener.class,
      DirtiesContextBeforeModesTestExecutionListener.class,
      ServletTestExecutionListener.class,
      DependencyInjectionTestExecutionListener.class,
      MockitoTestExecutionListener.class,
      TransactionalTestExecutionListener.class,
      WithSecurityContextTestExecutionListener.class
  })
  @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
  @DirtiesContext(classMode = DirtiesContext.ClassMode.AFTER_EACH_TEST_METHOD)
  @EnableAspectJAutoProxy(proxyTargetClass = true)
  @ContextConfiguration(
      loader = SpringBootContextLoader.class,
      classes = {MyApp.class, IntegrationTestContext.class})
  @RunWith(SpringRunner.class)
  public class FooIT {
      @Autowired
      private Client client;
  
      @Autowired
      private OtherClient otherClient;
  
      @Test
      public void test() {
          client.push();
  
          Mockito.verify(otherClient).publishReset(
              Mockito.anyString(),
              Mockito.argThat(l -&gt; l.size() == 3)
          );
      }
  }
  </code></pre>
  
  <p>And a configuration class:</p>
  
  <pre><code>@Configuration
  @MockBeans({
      @MockBean(OtherClient.class),
  })
  public class IntegrationTestContext {
  }
  </code></pre>
  
  <p>Is there something that I'm doing wrong? Is Spring interfering with mockito somehow?</p>