自媒体文章审核单元测试
package com.heima.wemedia.test.service; import com.heima.wemedia.WemediaApplication; import com.heima.wemedia.service.WmNewsAutoScanService; 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; @SpringBootTest(classes = WemediaApplication.class) @RunWith(SpringRunner.class) public class WmNewsArticleScanServiceTest { @Autowired private WmNewsAutoScanService wmNewsAutoScanService; @Test public void autoScanTest(){ wmNewsAutoScanService.autoScanWmNews(6232); } }
当程序运行响应较慢时,由于Feign客户端默认连接超时时间是10s,默认读取超时时间是60s,程序过慢会自动断开。因此要根据实际情况设置Feign客户端的connectTimeout和readTimeout。