title: JUnit test case not working for JDBCTemplate
body: <p>MY Actual java class in like this:-</p>
  <pre class="lang-java prettyprint-override"><code>@Component
  public class AxonPaymentRequestStatusEventCycleDao {
  
      @Autowired
      private JdbcTemplate jdbcTemplate;
      
      @Autowired
      private NamedParameterJdbcTemplate namedParamJdbcTemplate;
  
      @Value(&quot;${EVENT_CYCLE_STATUS_SETTLEMENT_DATE_MANUAL}&quot;)
      private String eventCycleStatusSetlDateManual = &quot;&quot;;
  
      public AxonPaymentRequestEventRequest insertCycleEventStatus() throws SQLException {
          log.info(&quot;Inside AxonPaymentRequestCycleEventStatusDao - insertCycleEventStatus()--Entry-eventCycleStatusSetlDateManual-&quot;   + eventCycleStatusSetlDateManual);
  
          SimpleJdbcCall call = new SimpleJdbcCall(jdbcTemplate).withoutProcedureColumnMetaDataAccess()
                  .withProcedureName(AxonPaymentRequestStatusEventCycleConstant.INSERT_CYCLE_STATUS_PROCEDURE)
                  .declareParameters(new SqlParameter(AxonPaymentRequestStatusEventCycleConstant.SETTLEMENT_DATE_MANUAL, Types.CHAR))
                  .declareParameters(new SqlParameter(AxonPaymentRequestStatusEventCycleConstant.DEBUG_FLAG, Types.CHAR))
                  .declareParameters(new SqlOutParameter(AxonPaymentRequestStatusEventCycleConstant.ERROR_INFO, Types.CHAR))
                  .declareParameters(new SqlOutParameter(AxonPaymentRequestStatusEventCycleConstant.RESULT, Types.CHAR))
                  .declareParameters(new SqlOutParameter(AxonPaymentRequestStatusEventCycleConstant.INSERT_ROW_COUNT, Types.INTEGER));
  
          SqlParameterSource in = new MapSqlParameterSource()
                  .addValue(AxonPaymentRequestStatusEventCycleConstant.SETTLEMENT_DATE_MANUAL,(eventCycleStatusSetlDateManual.equalsIgnoreCase(AxonPaymentRequestStatusEventCycleConstant.NULL_STRING) ? null : eventCycleStatusSetlDateManual))
                  .addValue(AxonPaymentRequestStatusEventCycleConstant.DEBUG_FLAG, AxonPaymentRequestStatusEventCycleConstant.DEBUG_FLAG_VALUE);
          Map&lt;String, Object&gt; result = call.execute(in);
          
          log.info(&quot;Inside AxonPaymentRequestCycleEventStatusDao - getCycleEventStatus() - result of INSERT_CYCLE_STATUS_PROCEDURE-&quot; + result);
          
          if (null != result &amp;&amp; result.get(&quot;RESULT&quot;).equals(AxonPaymentRequestStatusEventCycleConstant.RESULT_PASS)) {
              return getCycleEventStatus();
          } 
          }
      }
  }
  </code></pre>
  <p>My test class is:-</p>
  <pre class="lang-java prettyprint-override"><code>@RunWith(MockitoJUnitRunner.Silent.class)
  public class AxonPaymentRequestStatusEventCycleDaoTest {
  
      @Mock
      private JdbcTemplate jdbcTemplate;
  
      @Mock
      private NamedParameterJdbcTemplate namedParameterJdbcTemplate;
  
      @Mock
      private SimpleJdbcCall simpleJdbcCall;
      
      @InjectMocks
      AxonPaymentRequestStatusEventCycleDao axonPaymentRequestStatusEventCycleDao = new AxonPaymentRequestStatusEventCycleDao();
  
      @Test
      public void testInsertCycleEventStatus() throws Exception {
          Map&lt;String, Object&gt; output = new HashMap&lt;&gt;();
          output.put(&quot;RESULT&quot;, &quot;PASS&quot;);
  
          ReflectionTestUtils.setField(axonPaymentRequestStatusEventCycleDao, &quot;jdbcTemplate&quot;, jdbcTemplate);
          when(simpleJdbcCall.execute(any(MapSqlParameterSource.class))).thenReturn(output);
          
          Mockito.when(simpleJdbcCall.withProcedureName(AxonPaymentRequestStatusEventCycleConstant.INSERT_CYCLE_STATUS_PROCEDURE)).thenReturn(simpleJdbcCall);
          Mockito.when(simpleJdbcCall.withoutProcedureColumnMetaDataAccess()).thenReturn(simpleJdbcCall);
          Mockito.when(simpleJdbcCall.declareParameters(
                  new SqlParameter(AxonPaymentRequestStatusEventCycleConstant.SETTLEMENT_DATE_MANUAL, Types.CHAR),
                  new SqlParameter(AxonPaymentRequestStatusEventCycleConstant.DEBUG_FLAG, Types.CHAR),
                  new SqlOutParameter(AxonPaymentRequestStatusEventCycleConstant.ERROR_INFO, Types.CHAR),
                  new SqlOutParameter(AxonPaymentRequestStatusEventCycleConstant.RESULT, Types.CHAR),
                  new SqlOutParameter(AxonPaymentRequestStatusEventCycleConstant.INSERT_ROW_COUNT, Types.INTEGER))).thenReturn(simpleJdbcCall);
          
          Mockito.when(simpleJdbcCall.execute(any(MapSqlParameterSource.class))).thenReturn(output);
          
          AxonPaymentRequestEventRequest axonPaymentRequestEventRequest = axonPaymentRequestStatusEventCycleDao.insertCycleEventStatus();
      }
  }
  </code></pre>
  <p>I am getting exception as:-</p>
  <pre><code>java.lang.IllegalStateException: No DataSource set
      at org.springframework.util.Assert.state(Assert.java:76)
      at org.springframework.jdbc.core.simple.AbstractJdbcCall.compileInternal(AbstractJdbcCall.java:314)
      at org.springframework.jdbc.core.simple.AbstractJdbcCall.compile(AbstractJdbcCall.java:298)
      at org.springframework.jdbc.core.simple.AbstractJdbcCall.checkCompiled(AbstractJdbcCall.java:355)
      at org.springframework.jdbc.core.simple.AbstractJdbcCall.doExecute(AbstractJdbcCall.java:370)
      at org.springframework.jdbc.core.simple.SimpleJdbcCall.execute(SimpleJdbcCall.java:198)
      at com.mastercard.settlment.axon.payment.request.status.dao.AxonPaymentRequestStatusEventCycleDao.insertCycleEventStatus(AxonPaymentRequestStatusEventCycleDao.java:58)
      at com.mastercard.settlment.axon.payment.request.status.dao.AxonPaymentRequestStatusEventCycleDaoTest.testInsertCycleEventStatus(AxonPaymentRequestStatusEventCycleDaoTest.java:57)
  </code></pre>
  <p>Can anyone help on this?</p>