title: Skip execution of a line using Mockito
body: <p>I am using mockito for unit testing and I want to skip a line. </p>
  
  <pre><code>// method I am testing
  public String doSomeTask(String src, String dst) {
      // some code
  
      utils.createLink(src,dst);
  
      // some more code
  } 
  
  
  // utils class
  public void createLink(String src, String dst) {
      // do something
      Path realSrc = "/tmp/" + src;
      Files.createSymbolicLink(realSrc, dst);
  
      // do something
  }
  
  
  // Test class
  
  @Mock
  private Utils utils;
  
  @Test
  public void testDoSomeTask() {
      // this does not seem to work, it is still executing the createLink method
      doNothing.when(utils).createLink(anyString(), anyString());
      myClass.doSomeTask(anyString(), anyString());
  }
  </code></pre>
  
  <p>Now, <code>createLink</code> is a void method and its failing during my testing with exception reason <code>AccessDenied</code> to create a directory. </p>
  
  <p>I want to skip the line <code>utils.createLink(src,dst);</code> and continue with next lines. Is there a way I can tell Mockito to do this ?</p>