title: Junit for SimpleJdbcCall with JdbcTemplate Autowired
body: <p>How do i test the repository class which uses JdbcTemplate and SimpleJdbcCall as below</p>
  <p>This is what i have tried</p>
  <p>Below is the test code and repository code
  I am using Spring boot latest version junit 5 and mockito.
  I have tried looking into the below solution but could got it working</p>
  <p><a href="https://stackoverflow.com/questions/62402041/mockito-for-simplejdbccall-with-spring-jdbctemplate">Mockito for SimpleJdbcCall with Spring JdbcTemplate</a></p>
  <pre><code>@RunWith(MockitoJUnitRunner.class)
  public class DataRepositoryTest {
  
      
      @InjectMocks
      private DataRepository dataRepository 
      
      
      @Mock
      private JdbcTemplate oracleJDBCTemplate;
      
       @Mock
       private SimpleJdbcCall simpleJdbcCall;
      
      
      
      @BeforeEach
      public void setup() {
          
          MockitoAnnotations.initMocks(this);
          
          simpleJdbcCall = new SimpleJdbcCall(oracleJDBCTemplate)
                  .withProcedureName(&quot;PROC_NAME_P1&quot;)
                  .withoutProcedureColumnMetaDataAccess()
                  .declareParameters(
                             
                                  new SqlParameter(&quot;p_in_name&quot;, Types.VARCHAR),
                                  new SqlParameter(&quot;p_age&quot;, Types.VARCHAR)
                                  
                          
                                  ).returningResultSet(&quot;ref_cur&quot;, new DataRowMapper());
      
          
          
  
          }
      
      
      @Test
      public void test()
      {
          
          System.out.println(&quot; JdbcTemplate-- &quot;  + oracleJDBCTemplate ); // prints is oracleJDBCTemplate;
          
          System.out.println(&quot; simpleJdbcCall-- &quot;  + simpleJdbcCall ); //print object hascode
  
      }
  
  }
  </code></pre>
  <p>Below is the  repository code
  @Repository
  public class DataRepository{</p>
  <pre><code>    @Autowired
      @Qualifier(&quot;OracleJDBCTemplate&quot;)
      private JdbcTemplate oracleJDBCTemplate;
  
      
      
      private SimpleJdbcCall simpleJdbcCall;
      
      
      @PostConstruct
      public void init()
      {
          simpleJdbcCall = new SimpleJdbcCall(oracleJDBCTemplate)
                  .withProcedureName(&quot;PROC_NAME_P1&quot;)
                  .withoutProcedureColumnMetaDataAccess()
                  .declareParameters(
                             
                                  new SqlParameter(&quot;p_in_name&quot;, Types.VARCHAR),
                                  new SqlParameter(&quot;p_age&quot;, Types.VARCHAR)
                                  
                          
                                  ).returningResultSet(&quot;ref_cur&quot;, new DataRowMapper());
          
  
  
                          
  
                  
      }
  
      @SuppressWarnings(&quot;unchecked&quot;)
      public List&lt;Person&gt;  getPerson(Data data) {
          
  
          
          
            Map&lt;String, Object&gt; result =
                    simpleJdbcCall.execute(date.getName,date.getAge);
            
  
            
            return (List&lt;Person&gt;) result.get(&quot;ref_cur&quot;);
        }
  }
  </code></pre>