title: TooLittleActualInvocations:
body: <p>I try to use mock to verify method for serveral times.But I meet this problem. </p>
  
  <pre><code>org.mockito.exceptions.verification.TooLittleActualInvocations: 
  personDao.update(isA(com.zhaolu08.Person));
  Wanted 3 times:
  -&gt; at com.zhaolu08.PersonServiceTest.testUpdate(PersonServiceTest.java:32)
  But was 1 time:
  </code></pre>
  
  <p>while my code is:</p>
  
  <pre><code>package com.zhaolu08;
  
  import org.junit.Assert;
  import org.junit.Before;
  import org.junit.Test;
  
  import static org.mockito.Mockito.times;
  import static org.mockito.Mockito.verify;
  import static org.mockito.Mockito.mock;
  import static org.mockito.Mockito.when;
  import static org.mockito.Mockito.isA;
  import static org.mockito.Mockito.eq;
  public class PersonServiceTest {
      private PersonDao mockDao;
      private PersonService personService;
  
      @Before
      public void setUp() throws Exception {
          //模拟PersonDao对象
          mockDao = mock(PersonDao.class);
          when(mockDao.getPerson(1)).thenReturn(new Person(1, "Person1"));
          when(mockDao.update(isA(Person.class))).thenReturn(true);
          personService = new PersonService(mockDao);
      }
  
      @Test
      public void testUpdate() throws Exception {
  
          boolean result = personService.update(1, "new name");
          Assert.assertTrue("must true", result);
          verify(mockDao, times(2)).getPerson(eq(1));
          verify(mockDao, times(3)).update(isA(Person.class));
  
      }
  }
  </code></pre>
  
  <p>I can't find out the problem. I try some methods. They did not work.
  My IDE is idea.</p>
  
  <p>Maven pom is:</p>
  
  <pre><code>&lt;dependency&gt;
        &lt;groupId&gt;junit&lt;/groupId&gt;
        &lt;artifactId&gt;junit&lt;/artifactId&gt;
        &lt;version&gt;4.12&lt;/version&gt;
      &lt;/dependency&gt;
  
      &lt;dependency&gt;
        &lt;groupId&gt;org.mockito&lt;/groupId&gt;
        &lt;artifactId&gt;mockito-all&lt;/artifactId&gt;
        &lt;version&gt;1.10.19&lt;/version&gt;
      &lt;/dependency&gt;
  </code></pre>
  
  <p>I can't find out why it doesn't work. It is just a simple demo. It's too wired.</p>