package com.njcn; import com.njcn.gather.EntranceApplication; import com.njcn.gather.report.pojo.DevReportParam; import com.njcn.gather.report.service.IPqReportService; import com.njcn.http.util.RestTemplateUtil; 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.http.ResponseEntity; import org.springframework.test.context.junit4.SpringRunner; import org.springframework.test.context.web.WebAppConfiguration; import java.io.File; import java.util.HashMap; /** * @author hongawen * @version 1.0.0 * @date 2021年12月10日 15:05 */ @RunWith(SpringRunner.class) @WebAppConfiguration @SpringBootTest(classes = EntranceApplication.class) public class BaseJunitTest { @Autowired private IPqReportService pqReportService; @Autowired private RestTemplateUtil restTemplateUtil; @Test public void test() { File file = new File("D:\\report\\PQS_882B4\\5555.docx"); try{ ResponseEntity stringResponseEntity = restTemplateUtil.uploadFile("http://localhost:18082/api/file/upload",file); }catch (Exception runtimeException){ System.out.println(runtimeException.getMessage()); } } }