1.先导入pom.xml
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>4.3.7.RELEASE</version>
<scope>test</scope>
</dependency>
2.test类
@ContextConfiguration(locations = {"classpath:applicationContext.xml"})
@RunWith(value = SpringJUnit4ClassRunner.class)
public class test {
@Autowired
private QuestionListService questionListService;
@Test
public void testQuestionList(){
List<Exam> examByPage = questionListService.findExamByPage(1, 5);
for (Exam exam : examByPage) {
System.out.println("exam = " + exam.getExId());
System.out.println("exam = " + exam.getKnowPoint().getKpointDes());
}
}