From cbd8fcd4ff5311ddc889039106d63fd51bd561c9 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Thu, 14 Jan 2021 08:09:48 +0300 Subject: tests: use multipart mock constructor with original filename --- src/test/java/com/juick/server/tests/ServerTests.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/test/java/com') diff --git a/src/test/java/com/juick/server/tests/ServerTests.java b/src/test/java/com/juick/server/tests/ServerTests.java index 33b0f0da..cea3818e 100644 --- a/src/test/java/com/juick/server/tests/ServerTests.java +++ b/src/test/java/com/juick/server/tests/ServerTests.java @@ -89,6 +89,7 @@ import org.springframework.core.io.Resource; import org.springframework.http.*; import org.springframework.http.client.ClientHttpRequestFactory; import org.springframework.jdbc.core.JdbcTemplate; +import org.springframework.mock.web.MockMultipartFile; import org.springframework.test.context.TestPropertySource; import org.springframework.test.context.junit.jupiter.SpringExtension; import org.springframework.test.web.client.MockRestServiceServer; @@ -2077,7 +2078,7 @@ public class ServerTests { ClassPathResource newAvatar = new ClassPathResource("static/durov.png"); byte[] newAvatarData = IOUtils.toByteArray(newAvatar.getInputStream()); mockMvc.perform(MockMvcRequestBuilders.multipart("/api/me/upload") - .file("avatar", newAvatarData) + .file(new MockMultipartFile("avatar", "durov.png", "image/png", newAvatarData)) .with(httpBasic(freefdName, freefdPassword)) ).andExpect(status().isOk()); String newHash = DigestUtils.md5DigestAsHex(newAvatarData); -- cgit v1.2.3