package platform; import java.util.List;
import java.util.UUID; import javax.annotation.Resource; import org.apache.commons.codec.digest.DigestUtils;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.web.WebAppConfiguration;
import com.xxx.xxx.model.ProjectInfo;
import com.xxx.xxx.service.ProjectInfoService; @RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = {"classpath:applicationContext.xml"})
@WebAppConfiguration
public class JunitTest {
// @Resource
@Autowired
private ProjectInfoService projectInfoService; @Test
public void demo2(){
ProjectInfo projectInfo = projectInfoService.findProjectInfoById("ID");
System.out.println(projectInfo.getName());
}
}
不写单元测试的程序员不是好程序员。