Skip to content

Commit

Permalink
test: [#30] 상품 업로드 테스트 코드 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
jupyter471 committed Oct 14, 2024
1 parent 53656ff commit 9ab22aa
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.helpmeCookies.product.service;

import com.helpmeCookies.global.utils.AwsS3FileUtils;
import com.helpmeCookies.product.dto.FileUploadResponse;
import com.helpmeCookies.product.entity.Category;
import com.helpmeCookies.product.entity.Product;
import com.helpmeCookies.product.repository.ProductImageRepository;
Expand All @@ -16,6 +17,7 @@
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Optional;
Expand Down Expand Up @@ -56,10 +58,12 @@ void uploadMultiFiles() throws IOException {
MockMultipartFile file2 = new MockMultipartFile("test2","img2.jpg","image/jpeg","image content".getBytes());
List<MultipartFile> files = Arrays.asList(file1,file2);

List<String> expected = Arrays.asList("url1","url2");
List<FileUploadResponse> expected = new ArrayList<>();
expected.add(new FileUploadResponse("url1","1111"));
expected.add(new FileUploadResponse("url2","2222"));
when(awsS3FileUtils.uploadMultiImages(files)).thenReturn(expected);

List<String> actual = productImageService.uploadMultiFiles(1L,files);
List<FileUploadResponse> actual = productImageService.uploadMultiFiles(1L,files);
assertEquals(2,actual.size(), "배열의 크기는 2여야함");
}
}

0 comments on commit 9ab22aa

Please sign in to comment.