title: writing Junit test case for DAO
body: <p>I'm new to using Mybatis3 for developing a web application. I have DAO Impl class and related Mapper.xml . I want to write Junit case for DAO.If anyone is able to help me,
   I would be extremely grateful.</p>
  
  <p>Here's what I have:</p>
  
  <p><strong>Customer-mapper.xml</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;!DOCTYPE mapper
      PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
      "http://mybatis.org/dtd/mybatis-3-mapper.dtd"&gt;
  &lt;mapper namespace="customer"&gt;
      &lt;insert id="newCustomer" parameterType="com.yell.hibu.domain.Customer"&gt;
          INSERT INTO CUSTOMER(CUSTOMER_ID, NAME, EMAIL_ID,GRAPHIC_NAME,MOBILE,DOB,LANGUAGE,CITY,COUNTRY) values(#{customerID},#{customerName},#{emailID},#{userFileFileName},#{mobileNo},#{dob},#{language},#{city},#{country})
      &lt;/insert&gt;
  
      &lt;select id="selectCustomer" resultMap="customer"&gt;
            SELECT * FROM CUSTOMER WHERE CUSTOMER_ID = #{customerID};
          &lt;/select&gt;
  
               &lt;resultMap type="com.yell.hibu.domain.Customer" id="customer"&gt;
               &lt;result property="customerID" column="CUSTOMER_ID" /&gt;
                   &lt;result property="customerName" column="NAME" /&gt;
                   &lt;result property="emailID" column="EMAIL_ID" /&gt;
                   &lt;result property="userFileFileName" column="GRAPHIC_NAME" /&gt;
                   &lt;result property="mobileNo" column="MOBILE" /&gt;
                   &lt;result property="dob" column="DOB" /&gt;
                   &lt;result property="language" column="LANGUAGE" /&gt;
                   &lt;result property="city" column="CITY" /&gt;
                   &lt;result property="country" column="COUNTRY" /&gt;
  
          &lt;/resultMap&gt;
  &lt;/mapper&gt;
  </code></pre>
  
  <p><strong>DAOImpl.java</strong></p>
  
  <pre><code>package com.yell.hibu.dao;
  
  import org.apache.log4j.Logger;
  import org.mybatis.spring.support.SqlSessionDaoSupport;
  
  import com.yell.hibu.domain.Customer;
  
      public class CustomerDaoImpl extends SqlSessionDaoSupport implements CustomerDao{
  
          private final Logger logger= Logger.getLogger(this.getClass());
  
          public void insertCustomer(Customer customer) {
              logger.info("Entered into CustomerDaoImpl :: insertCustomer()");
              getSqlSession().insert("customer.newCustomer", customer);
              logger.info("leaving from CustomerDaoImpl :: insertCustomer()");
  
          }
  
      }
  </code></pre>