package org.atgpcm.system.service; import org.atgpcm.system.domain.SysAppletsConfig; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; /** * @Description: * @Author: ldg * @Date: 2020/12/10 * * <dependency> * <groupId>org.springframework.boot</groupId> * * <artifactId>spring-boot-starter-test</artifactId> * * </dependency> * * * 如果项目中引入了websocket * @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) * * 原因 用@SpringBootTest(classes= {Pcm*******Application.class}) * 会报 Caused by: java.lang.IllegalStateException: javax.websocket.server.ServerContainer not availabl 错 */ @RunWith(SpringRunner.class) //@SpringBootTest(classes= {PcmServiceAdminApplication.class}) @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) public class SysFunctionServiceTest { @Autowired private SysFunctionService sysFunctionService; @Test public void getAppletsConfig() { SysAppletsConfig sysAppletsConfig = new SysAppletsConfig(); sysAppletsConfig.setId(1); sysFunctionService.getAppletsConfig(sysAppletsConfig); } }