title: How to mock getNamedParameterJdbcTemplate()
body: <p>I am trying to mock a DAO implementation class that extends NamedParameterJdbcDaoSupport</p>
  
  <p>This is how my DAO interface looks like:</p>
  
  <pre><code>public interface TestDAO{
  
  List&lt;String&gt; search();
  
  }
  </code></pre>
  
  <p>This is how my implementation class is:</p>
  
  <pre><code>    public class TestDAOImpl extends NamedParameterJdbcDaoSupport implements TestDAO {
  
      public List&lt;String&gt; search(){
  
      return getNamedParameterJdbcTemplate().query(mySQLQuery,myMapSqlParameterSource, myRowMapper);
      }
  }
  </code></pre>
  
  <p>What I am trying to achieve is that write a mock test case to mock the behaviour of the call</p>
  
  <pre><code>getNamedParameterJdbcTemplate().query(mySQLQuery,myMapSqlParameterSource, myRowMapper)
  </code></pre>
  
  <p>So I want to implemented something like</p>
  
  <pre><code>when(getNamedParameterJdbcTemplate().query(mySQLQuery,myMapSqlParameterSource, myRowMapper)).thenReturn(whatIWantToReturn);
  </code></pre>
  
  <p>I am unable to find any information on this. Can someone guide me. How to do this?</p>
  
  <pre><code>public class TestDAOImplTestCase{
  
      @Test
      public void testSearch(){
          when(getNamedParameterJdbcTemplate().query(mySQLQuery,myMapSqlParameterSource, myRowMapper)).thenReturn(whatIWantToReturn); 
      } 
  }
  </code></pre>