title: Unit Test Case For Spring jdbc template for RowMapper
body: <p>I know it is not a good thing write a unit test for mapper or get set but, it is what it is, so I am stucked how to do unit test for mappers;</p>
  <p>StudentGroupList below;</p>
  <pre><code>@Getter
  @Setter
  public class StudentGroupList {
  
   private String studentId;
  }
  </code></pre>
  <p>StudentGroupListRowMapper below;</p>
  <pre><code>public class StudentGroupListRowMapper implements RowMapper&lt;StudentGroupList&gt; {
  
    @Override
    public StudentGroupList mapRow(Resultset rs, int rowNum) throws SQLException {
  
    StudentGroupList studentGroupList = new StudentGroupList();
   
    studentGroupList.setStudentId(rs.getString(&quot;student_id&quot;));
  
    return studentGroupList;
   }
  }
  </code></pre>
  <p>I have tried below, but jococo coverage test did not coverage anything</p>
  <pre><code>   public class TaskGroupListRowMapperTest {
  
       private ResultSet resultSet;
       private StudentGroupList studentGroupList;
  
       @Before
       public void setUp() {
       resultSet = mock(ResultSet.class);
       studentGroupList = mock(StudentGroupList.class);
      }
  
      @Test
      public void testStudentGroupListMapper() throws SQLException {
       when(resultSet.getString(&quot;student_id&quot;))
      .thenReturn(studentGroupList.getStudentID());
       
      assertTrue(studentGroupList.getStudentId(), true);
      
   }
  }
  </code></pre>
  <p>İt says exception; thenReturn() may be missing.</p>