@Test
  public void testExtendsResultMapSelect() throws Exception {
    EmpVO vo = new EmpVO();
    // 7369,'SMITH','CLERK',7902,'1980-12-17',800,NULL,20
    vo.setEmpNo(new BigDecimal(7369));

    // select
    EmpExtendsDeptVO resultVO =
        empDAO.selectEmpExtendsDept("selectEmpExtendsDeptUsingResultMap", vo);

    // check
    assertNotNull(resultVO);
    // resultMap extends test (extends empResult)
    assertEquals(new BigDecimal(7369), resultVO.getEmpNo());
    assertEquals("SMITH", resultVO.getEmpName());
    assertEquals("CLERK", resultVO.getJob());
    assertEquals(new BigDecimal(7902), resultVO.getMgr());
    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd", java.util.Locale.getDefault());
    assertEquals(sdf.parse("1980-12-17"), resultVO.getHireDate());
    assertEquals(new BigDecimal(800), resultVO.getSal());
    // nullValue test - <result property="comm"
    // column="COMM" .. nullValue="0" />
    assertEquals(new BigDecimal(0), resultVO.getComm());
    assertEquals(new BigDecimal(20), resultVO.getDeptNo());

    assertEquals("RESEARCH", resultVO.getDeptName());
    assertEquals("DALLAS", resultVO.getLoc());
  }
Ejemplo n.º 2
0
  @Test
  public void testFetchSize() throws Exception {
    // 검색조건 없이 전체 EMP 리스트 조회

    // select
    List<EmpVO> resultList = empDAO.selectEmpList("selectEmpUsingFetchSize", null);

    // check
    assertNotNull(resultList);
    assertEquals(14, resultList.size());
    assertEquals(new BigDecimal(7369), resultList.get(0).getEmpNo());
    assertEquals(new BigDecimal(7499), resultList.get(1).getEmpNo());
    assertEquals(new BigDecimal(7521), resultList.get(2).getEmpNo());
    assertEquals(new BigDecimal(7566), resultList.get(3).getEmpNo());
    assertEquals(new BigDecimal(7654), resultList.get(4).getEmpNo());
    assertEquals(new BigDecimal(7698), resultList.get(5).getEmpNo());
    assertEquals(new BigDecimal(7782), resultList.get(6).getEmpNo());
    assertEquals(new BigDecimal(7788), resultList.get(7).getEmpNo());
    assertEquals(new BigDecimal(7839), resultList.get(8).getEmpNo());
    assertEquals(new BigDecimal(7844), resultList.get(9).getEmpNo());
    assertEquals(new BigDecimal(7876), resultList.get(10).getEmpNo());
    assertEquals(new BigDecimal(7900), resultList.get(11).getEmpNo());
    assertEquals(new BigDecimal(7902), resultList.get(12).getEmpNo());
    assertEquals(new BigDecimal(7934), resultList.get(13).getEmpNo());
  }