test: fileService的mock
This commit is contained in:
@@ -327,7 +327,7 @@ public class BaseTest {
|
||||
}
|
||||
|
||||
@Slf4j
|
||||
public static class TestQiniuFileServiceImpl implements FileManager {
|
||||
public static class TestFileManager implements FileManager {
|
||||
@Override
|
||||
public FileResponse uploadFile(InputStream is, String fileName) {
|
||||
FileResponse response = new FileResponse();
|
||||
|
||||
@@ -116,8 +116,7 @@ public class UserControllerTest extends BaseTest {
|
||||
assertNotNull(inputStream);
|
||||
|
||||
// mock 实现类
|
||||
// FIXME :: mock 时不应该为 qiniuService
|
||||
// mockInjectInstance(userService, "fileService", (FileService) TestQiniuFileServiceImpl::new);
|
||||
mockInjectInstance(userService, "fileService", (FileService) TestFileManager::new);
|
||||
|
||||
MockMultipartFile file = new MockMultipartFile("file", "logo.png", MediaType.IMAGE_PNG_VALUE, inputStream);
|
||||
getMockData(multipart("/user/imgUpload").file(file), userLogin()).andDo(result -> {
|
||||
|
||||
Reference in New Issue
Block a user