1. 程式人生 > >maven專案中測試程式碼

maven專案中測試程式碼

1 在src/test/java中新建測試的java類 以下是一段測試程式碼
package com.nufront.euht.test;

import java.util.List;

import org.apache.log4j.Logger;
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 com.alibaba.fastjson.JSON;
import com.nufront.euht.model.CapEau;
import com.nufront.euht.model.SysLog;
import com.nufront.euht.service.sys.SysLogServiceI;
import com.nufront.euht.util.PageParameter;
import com.nufront.euht.util.UuidUtil;

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = { "classpath:spring.xml", 
		"classpath:spring-mybatis.xml" })
public class SysLogTest {
  
	private static final Logger logger = Logger.getLogger(SysLogTest.class);

	@Autowired
	private SysLogServiceI service;
	
	
	
	@Test
	public void test() throws Exception {
		//addData();
		findData();
	}
}