1.添加依赖
sping-test和junit的相关依赖(另还有必须的spring依赖)
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>4.1.3.RELEASE</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
</dependency>
写例子
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = "classpath*:mvc-dispatcher-servlet.xml")
public class RemoteAITest {
@Resource
AiService service;
/**
* c测试获取问题答案
*/
@Test
public void getAnswerFormAI(){
System.out.print("你好");
}
/**
* 测试点评
*/
@Test
public void addlike2AI(){
// service.isLike("1","1");
}
}