title: how to write junit test cases for Row Mapper class in spring
body: <p>Hi This is my Row Mapper class.</p>
  
  <pre><code>public class UserRowMapper implements RowMapper&lt;UserData&gt; {
  
      @Override
      public UserData mapRow(ResultSet resultSet, int line) throws SQLException {
          UserData userData = new UserData();  
          try
          {
              userData.setUserID(resultSet.getString("User_ID"));
              userData.setUserName(resultSet.getString("User_Name"));  
              userData.setUserPassword(resultSet.getString("User_Password"));  
              userData.setUserRole(resultSet.getString("User_Role")); 
              userData.setUserStatus(resultSet.getString("User_Status")); 
              userData.setUserLogStatus(resultSet.getString("UserLog_Status")); 
              userData.setUserAccountName(resultSet.getString("User_AccountName")); 
              userData.setUserAccountID(resultSet.getString("User_AccountID")); 
              userData.setUserEmailID(resultSet.getString("User_EmailID")); 
              userData.setUserPasswordStatus(resultSet.getString("User_Password_ExpiryStatus")); 
              userData.setUserIDStatus(resultSet.getString("User_ID_Status")); 
              userData.setAcatTenantID(resultSet.getLong("acatTenant_ID")); 
              userData.setUserRoleCode(resultSet.getLong("User_Role_Code")); 
              userData.setUserSkillSetCode(resultSet.getLong("User_SkillSet_Code")); 
              userData.setUserAccountCode(resultSet.getLong("User_Account_Code")); 
  
              return userData;
          }
          catch (EmptyResultDataAccessException e)
          {
              return null;
          }
      }
  
  }
  </code></pre>
  
  <p>and this is my Model class.</p>
  
  <pre><code>public class UserData {
  
      private String userID;
      private String userPassword;
      private String userRole;
      private String userStatus;
      private String userLogStatus;
      private String userName;
      private String userAccountName;
      private String userAccountID;
      private String userIDStatus;
      private String userPasswordStatus;
      private String userEmailID;  
  
      private String userAdminID;
      private String deactivationComment;
  
      private String reqPageID;
      private String userSessionID;    
      private String reqFunctionalityID;  
  
      private long userAccountCode;
      private long userRoleCode;
      private long userSkillSetCode;
      private long acatTenantID;
  
  
      public long getUserAccountCode() {
          return userAccountCode;
      }
      public void setUserAccountCode(long userAccountCode) {
          this.userAccountCode = userAccountCode;
      }
  
      public long getUserRoleCode() {
          return userRoleCode;
      }
      public void setUserRoleCode(long userRoleCode) {
          this.userRoleCode = userRoleCode;
      }
  
      public long getUserSkillSetCode() {
          return userSkillSetCode;
      }
      public void setUserSkillSetCode(long userSkillSetCode) {
          this.userSkillSetCode = userSkillSetCode;
      }
  
      public long getAcatTenantID() {
          return acatTenantID;
      }
      public void setAcatTenantID(long acatTenantID) {
          this.acatTenantID = acatTenantID;
      }
  
      public String getReqFunctionalityID() {
          return reqFunctionalityID;
      }
      public void setReqFunctionalityID(String reqFunctionalityID) {
          this.reqFunctionalityID = reqFunctionalityID;
      }
  
      public String getReqPageID() {
          return reqPageID;
      }
      public void setReqPageID(String reqPageID) {
          this.reqPageID = reqPageID;
      }
  
      public String getUserSessionID() {
          return userSessionID;
      }
      public void setUserSessionID(String userSessionID) {
          this.userSessionID = userSessionID;
      }
  
      public String getUserAdminID() {
          return userAdminID;
      }
      public void setUserAdminID(String userAdminID) {
          this.userAdminID = userAdminID;
      }
  
      public String getDeactivationComment() {
          return deactivationComment;
      }
      public void setDeactivationComment(String deactivationComment) {
          this.deactivationComment = deactivationComment;
      }
      public String getUserIDStatus() {
          return userIDStatus;
      }
      public void setUserIDStatus(String userIDStatus) {
          this.userIDStatus = userIDStatus;
      }
      public String getUserPasswordStatus() {
          return userPasswordStatus;
      }
      public void setUserPasswordStatus(String userPasswordStatus) {
          this.userPasswordStatus = userPasswordStatus;
      }
  
      public String getUserEmailID() {
          return userEmailID;
      }
      public void setUserEmailID(String userEmailID) {
          this.userEmailID = userEmailID;
      }
      public String getUserAccountID() {
          return userAccountID;
      }
      public void setUserAccountID(String userAccountID) {
          this.userAccountID = userAccountID;
      }
      public String getUserAccountName() {
          return userAccountName;
      }
      public void setUserAccountName(String userAccountName) {
          this.userAccountName = userAccountName;
      }
      public String getUserID() {
          return userID;
      }
      public void setUserID(String userID) {
          this.userID = userID;
      }
      public String getUserPassword() {
          return userPassword;
      }
      public void setUserPassword(String userPassword) {
          this.userPassword = userPassword;
      }
      public String getUserRole() {
          return userRole;
      }
      public void setUserRole(String userRole) {
          this.userRole = userRole;
      }
      public String getUserStatus() {
          return userStatus;
      }
      public void setUserStatus(String userStatus) {
          this.userStatus = userStatus;
      }
      public String getUserLogStatus() {
          return userLogStatus;
      }
      public void setUserLogStatus(String userLogStatus) {
          this.userLogStatus = userLogStatus;
      }
      public String getUserName() {
          return userName;
      }
      public void setUserName(String userName) {
          this.userName = userName;
      }
  
  }
  </code></pre>
  
  <p>The above classes are my Row Mapper and Model class.i do not know how to write  junit test class for Row Mapper class .please any one guide me how to write junit test  for these classes.</p>
  
  <p>Hi here is my Junit test code for above classes.</p>
  
  <pre><code>public class UserRowMapperTest {
     UserRowMapper userRowMapper=null;
  
      @Before
      public void runBeforeEachTest(){
          userRowMapper= new UserRowMapper();
  
      }
      @After
      public void runAfterEachTest(){
          userRowMapper=null;
      }
      @Test
      public void testMapRow(){
          userRowMapper.mapRow(resultSet, line);
      }    
  }
  </code></pre>