|
3 | 3 | import static com.tnt.common.constant.ImageConstant.TRAINEE_DEFAULT_IMAGE;
|
4 | 4 | import static com.tnt.domain.member.MemberType.TRAINEE;
|
5 | 5 | import static com.tnt.domain.member.MemberType.TRAINER;
|
6 |
| -import static java.util.Objects.requireNonNull; |
7 | 6 | import static org.assertj.core.api.Assertions.assertThat;
|
8 | 7 | import static org.junit.jupiter.api.Assertions.assertThrows;
|
9 | 8 | import static org.mockito.ArgumentMatchers.anyString;
|
10 | 9 | import static org.mockito.BDDMockito.any;
|
11 | 10 | import static org.mockito.BDDMockito.given;
|
12 | 11 | import static org.springframework.http.MediaType.IMAGE_JPEG_VALUE;
|
13 | 12 |
|
14 |
| -import java.awt.Color; |
15 |
| -import java.awt.Graphics2D; |
16 | 13 | import java.awt.image.BufferedImage;
|
17 | 14 | import java.io.ByteArrayOutputStream;
|
18 | 15 | import java.io.IOException;
|
|
26 | 23 | import org.mockito.Mock;
|
27 | 24 | import org.mockito.junit.jupiter.MockitoExtension;
|
28 | 25 | import org.springframework.mock.web.MockMultipartFile;
|
29 |
| -import org.springframework.test.util.ReflectionTestUtils; |
30 | 26 |
|
31 | 27 | import com.tnt.common.error.exception.ImageException;
|
32 | 28 | import com.tnt.infrastructure.s3.S3Adapter;
|
@@ -83,28 +79,4 @@ void upload_profile_image_unsupported_format_error() throws IOException {
|
83 | 79 | // when & then
|
84 | 80 | assertThrows(ImageException.class, () -> s3Service.uploadProfileImage(image, TRAINER));
|
85 | 81 | }
|
86 |
| - |
87 |
| - @Test |
88 |
| - @DisplayName("orientation이 3일 때 이미지 180도 회전 성공") |
89 |
| - void rotate_image_orientation_3_success() { |
90 |
| - // given |
91 |
| - BufferedImage originalImage = new BufferedImage(100, 100, BufferedImage.TYPE_INT_RGB); |
92 |
| - Graphics2D graphics = originalImage.createGraphics(); |
93 |
| - |
94 |
| - // 위쪽은 흰색, 아래쪽은 검은색으로 채워서 회전 확인이 가능하도록 함 |
95 |
| - graphics.setColor(Color.WHITE); |
96 |
| - graphics.fillRect(0, 0, 100, 50); |
97 |
| - graphics.setColor(Color.BLACK); |
98 |
| - graphics.fillRect(0, 50, 100, 50); |
99 |
| - graphics.dispose(); |
100 |
| - |
101 |
| - // when |
102 |
| - BufferedImage rotatedImage = ReflectionTestUtils.invokeMethod(s3Service, "rotateImageByOrientation", |
103 |
| - originalImage, 3); |
104 |
| - |
105 |
| - // then |
106 |
| - // 회전 후에는 위쪽이 검은색, 아래쪽이 흰색이어야 함 |
107 |
| - assertThat(requireNonNull(rotatedImage).getRGB(50, 25)).isEqualTo(Color.BLACK.getRGB()); // 원래 아래쪽 색 |
108 |
| - assertThat(requireNonNull(rotatedImage).getRGB(50, 75)).isEqualTo(Color.WHITE.getRGB()); // 원래 위쪽 색 |
109 |
| - } |
110 | 82 | }
|
0 commit comments