title: Mocking repository class in spring boot
body: <p>I want to test my repository layer class using JUnit and Mockito. Since I have lots of database tables I am not going to use an in-memory database to mock my database. I need to test the below method and it uses <code>JdbcTemplate</code> to retrieve data from the database.</p>
  <pre class="lang-java prettyprint-override"><code>public List&lt;EmployeeSqlDTO&gt; findEmployees(String sqlQuery) {
      List&lt;EmployeeSqlDTO&gt; list = new ArrayList&lt;&gt;();
      EmployeeSqlDTO sqlDTO;
      SqlRowSet rowSet = jdbcTemplate.queryForRowSet(sqlQuery, 1, 1);
  
      while (rowSet.next()) {
          sqlDTO = new EmployeeSqlDTO();
          sqlDTO.setId(rowSet.getInt(&quot;id&quot;));
          sqlDTO.setName(rowSet.getString(&quot;name&quot;));
          sqlDTO.setEmail(rowSet.getString(&quot;email&quot;));
          list.add(sqlDTO);
      }
      return list;
  }
  </code></pre>
  <p><code>EmployeeSqlDTO</code> class contains three instance variables (<code>id</code>, <code>name</code>, <code>email</code>) with getters and setters.
  I require to test the above method using Mockito and JUnit.
  Is there a proper way to test the above code?</p>