title: Not able to mock data coming from Mapper class using mockito
body: <p>I have written unit test with Mockito to test controller, where I get back data from database using mapper.but due to for example : <code>@Param("abc") abc</code> parameters in mapper I am not able to retrive mocked data.</p>
  
  <p>public class classUnderTest {</p>
  
  <pre><code>    @Mock
      private ProductMapper productMapper;
  
      List&lt;ProductKey&gt; productKeys;
  
      String firstName;
  
      String lastName;
  
  
      @Before
      public void setUp() {
          productMapper = Mockito.mock(ProductMapper.class);
          productKeys = new ArrayList&lt;ProductKey&gt;();
          firstName = "John";
          lastName = "Rebbeca";
  
      }
  
      @Test
      public void getInsureddetails() {
          Mockito
                  .doReturn(productKeys)
                  .when(ProductMapper)
                  .getProductKeyByInsured(firstName, lastName);
      }
  }
  
  
  public interface ProductMapper{
      public List&lt;ProductKey&gt; getProductKeyByInsured(@Param("firstName")String firstName, @Param("lastName")String lastName);
  }
  </code></pre>