org.apache.httpcomponents
httpcore
4.4.9
org.springframework
spring-test
5.2.9.RELEASE
org.springframework.
mock
.jndi.ExpectedLookupTemplate.class
org.springframework.
mock
.jndi.SimpleNamingContext.class
org.springframework.
mock
.jndi.SimpleNamingContextBuilder.class
org.springframework.
mock
.web.DelegatingServletInputStream.class
org.springframework.
mock
.web.DelegatingServletOutputStream.class
org.springframework.
mock
.web.HeaderValueHolder.class
org.springframework.
mock
.web.
Mock
ExpressionEvaluator.class
org.springframework.
mock
.web.
Mock
FilterChain.class
org.springframework.
mock
.web.
Mock
FilterConfig.class
org.springframework.
mock
.web.
Mock
HttpServletRequest.class
org.springframework.
mock
.web.
Mock
HttpServletResponse.class
org.springframework.
mock
.web.
Mock
HttpSession.class
org.springframework.
mock
.web.
Mock
Multipart
File
.class
org.springframework.
mock
.web.
Mock
Multipart
HttpServletRequest.class
org.springframework.
mock
.web.
Mock
PageContext.class
org.springframework.
mock
.web.
Mock
RequestDispatcher.class
org.springframework.
mock
.web.
Mock
ServletConfig.class
org.springframework.
mock
.web.
Mock
ServletContext.class
org.springframework.
mock
.web.PassThroughFilterChain.class
org.springframework.
mock
.web.portlet.
Mock
ActionRequest.class
org.springframework.
mock
.web.portlet.
Mock
ActionResponse.class
org.springframework.
mock
.web.portlet.
Mock
Multipart
ActionRequest.class
org.springframework.
mock
.web.portlet.
Mock
PortalContext.class
org.springframework.
mock
.web.portlet.
Mock
PortletConfig.class
org.springframework.
mock
.web.portlet.
Mock
PortletContext.class
org.springframework.
mock
.web.portlet.
Mock
PortletPreferences.class
org.springframework.
mock
.web.portlet.
Mock
PortletRequest.class
org.springframework.
mock
.web.portlet.
Mock
PortletRequestDispatcher.class
org.springframework.
mock
.web.portlet.
Mock
PortletResponse.class
org.springframework.
mock
.web.portlet.
Mock
PortletSession.class
org.springframework.
mock
.web.portlet.
Mock
PortletURL.class
org.springframework.
mock
.web.portlet.
Mock
RenderRequest.class
org.springframework.
mock
.web.portlet.
Mock
RenderResponse.class
org.springframework.test.AbstractDependencyInjectionSpringContextTests.class
org.springframework.test.AbstractSingleSpringContextTests.class
org.springframework.test.AbstractSpringContextTests.class
org.springframework.test.AbstractTransactionalDataSourceSpringContextTests.class
org.springframework.test.AbstractTransactionalSpringContextTests.class
org.springframework.test.AssertThrows.class
org.springframework.test.ConditionalTestCase.class
org.springframework.test.annotation.AbstractAnnotationAwareTransactionalTests.class
org.springframework.test.annotation.DirtiesContext.class
org.springframework.test.annotation.ExpectedException.class
org.springframework.test.annotation.IfPro
file
Value.class
org.springframework.test.annotation.NotTransactional.class
org.springframework.test.annotation.Pro
file
ValueSource.class
org.springframework.test.annotation.Repeat.class
org.springframework.test.annotation.SystemPro
file
ValueSource.class
org.springframework.test.annotation.Timed.class
org.springframework.test.jpa.AbstractAspectjJpaTests.class
org.springframework.test.jpa.AbstractJpaTests.class
org.springframework.test.jpa.OrmXmlOverridingShadowingClassLoader.class
org.springframework.test.web.AbstractModelAndViewTests.class
file
转
Multipart
File
的时候会用到
Mock
Multipart
File
当你导入spring-test
依赖
的时候 会跟某些
依赖
冲突(暂未找到具体是哪个冲突)
解决方法 重写一个类去实现
Multipart
File
接口
直接用
Mock
Multipart
File
的源码
public class
Multipart
File
Dto implements
Multipart
File
{
private final String name;
private String origi
项目
开发
中需要将
file
转化为
Multipart
File
,网上百度发现使用org.springframework.
mock
.web.
Mock
Multipart
File
可以
File
file
3 = new
File
(
file
Map.get("
file
").toString());
File
InputStream in_
file
= new
File
InputStream(
file
3);...
import
java
.io.
File
;
import
java
.io.
File
InputStream;
import org.springframework.web.
multipart
.
Multipart
File
;
import org.springframework.
mock
.web.
Mock
Multipart
File
;
import org.apache.h...
ClassPathResource resource = new ClassPathResource("XXX.js");
Mock
Multipart
File
m
file
= new
Mock
Multipart
File
("
file
", "XXX.js", "png", resource.getInputStream());
MvcResult mvcResult =
mock
Mvc.perform(
Mock
MvcRequestBuilders.
multipart
("/XX..
<dependency>
<groupId>org.power
mock
</groupId>
<artifactId>power
mock
-api-
mock
ito2</artifactId>
public class MyHttpClient {
public static void main(String[] args) {
OkHttpClient client = new OkHttpClient();
// 在这里使用OkHttpClient进行HTTP请求
希望这可以帮助到你!如果还有其他问题,请随时提问。
CSDN-Ada助手:
java MockMultipartFile 引入pom依赖
CSDN-Ada助手:
minio上传文件后支持预览
态度决定一下: