title: Mockito Test case not working when mocking a method
body: <p>I have created an example below to test if Mockito is able to mock the method and return my value but it does not work. Here are the classes.</p>
  <pre><code>package com.te;
  
  public interface IA {
  Long getVal(Long v);
  }
  package com.te;
  
  public class A implements IA{
  
  @Override
  public Long getVal(Long v) {
      return 1L;
  }
  
  
  package com.te;
  
  public class AService {
  
  public void ser(){
      A a = new A();
      boolean d = a.getVal(1L) &gt; 0;
      if(d){
          System.out.println(&quot;Inside If&quot;);
      }
  }}
  
  import com.te.A;
  import com.te.AService;
  import com.te.IA;
  import org.junit.Test;
  import org.junit.runner.RunWith;
  import org.mockito.Mockito;
  import org.mockito.junit.MockitoJUnitRunner;
  
  @RunWith(MockitoJUnitRunner.class)
  public class ATest {
  
  @Test
  public void test(){
      IA a = Mockito.mock(A.class);
      AService s = new AService();
      Mockito.when(a.getVal(1l)).thenReturn(0L);
      s.ser();
  }}
  </code></pre>
  <p>In my Test class I am mocking the method and asking it to return 0 but it still returns 1 from the method. I am not sure why its not working and I tried to search but couldn't find anything. Please help me understand where I am incorrect here. Thanks.</p>