반응형
package com.nakanara; import static org.junit.Assert.*; import java.util.HashMap; import java.util.Map; import javax.annotation.Resource; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.test.context.transaction.TransactionConfiguration; import org.springframework.transaction.annotation.Transactional; import com.nakanara.service.UserService; import com.nakanara.service.UserVO; @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(locations={ "classpath:egovframework/spring/com/context-datasource.xml", "classpath:egovframework/spring/com/context-aspect.xml", "classpath:egovframework/spring/com/context-common.xml", "classpath:egovframework/spring/com/context-excel.xml", "classpath:egovframework/spring/com/context-idgen.xml", "classpath:egovframework/spring/com/context-mail.xml", "classpath:egovframework/spring/com/context-properties.xml", // "classpath:egovframework/spring/com/context-security.xml", "classpath:egovframework/spring/com/context-sqlMap.xml", "classpath:egovframework/spring/com/context-transaction.xml", "classpath:egovframework/spring/com/context-validator.xml" }) @Transactional @TransactionConfiguration(transactionManager="txManager" , defaultRollback=true) public class UserTest { @Resource(name="userService") private UserService userService; Log logger = LogFactory.getLog(this.getClass()); @Test public void 사용자입력테스트() throws Exception{ int count = userService.selectUserCnt("TEST_001"); logger.info("Count=" + count); UserVO userVO = new UserVO(); userVO.Name(“TEST_001”); userService.saveUser(userVO); count = userService. selectUserCnt ("TEST_001"); logger.info("Count=" + count); logger.info("입력="+ userService); assertEquals("입력 여부=" , count, 1); } }
반응형
'FullStack > 21. Java' 카테고리의 다른 글
[알고리즘] Stack (0) | 2014.03.24 |
---|---|
META-INF 폴더 (0) | 2013.03.27 |
java.lang.NoSuchMethodError: org.slf4j.helpers.MessageFormatter.arrayFormat (0) | 2013.03.11 |
Nexus 저장소 변경하기 (0) | 2013.03.07 |
데이터베이스 쿼리 로그 log4jdbc (2) | 2012.10.11 |