title: JUnit + Mockito how to test DAO layer
body: <p>I am using Spring, SpringMVC, Mybatis in the project.<br>
  First time to play with Mockito.<br></p>
  
  <p>Before using Mockito, the test code looked like this<br></p>
  
  <pre><code>@Test
  @Transactional
  @Rollback
  public void setNewUnifyPriceRoom() throws Exception {
      Map reqMap = new HashMap();
      reqMap.put("typeId", 21);
      reqMap.put("roomId", 19);
  
      roomDockingsMapper.setNewUnifyPriceRoom(reqMap);
  
      String isUnifyPriceRoom = roomDockingsMapper.isUnifyPriceRoom(19, 21);
      Assert.assertEquals("Y", isUnifyPriceRoom);
  }
  </code></pre>
  
  <p>Then I found Mockito since I did not want to touch database during testing. I tried to write a BeforeClass as a data provider. However, I got stuck when I tried to return something after I did the <strong><em>setNewUnifyPriceRoom</em></strong> action</p>
  
  <pre><code> private static RoomDockingsMapper mockRoomDockingsMapper;
      @BeforeClass
      public static void setup(){
          Map reqMap = new HashMap();
          reqMap.put("typeId", 21);
          reqMap.put("roomId", 19);
          mockRoomDockingsMapper = mock(RoomDockingsMapper.class);
          when(mockRoomDockingsMapper.setNewUnifyPriceRoom(reqMap)).thenReturn(??????);
      }
  </code></pre>
  
  <p>Basically what I want to do is after do <strong><em>setNewUnifyPriceRoom</em></strong>, then in the thenReturn section to set <strong><em>isUnifyPriceRoom</em></strong> method return "Y".</p>
  
  <p>Any help will be appreciated.</p>