|
1 | 1 | package com.oronaminc.join.emoji.service; |
2 | 2 |
|
3 | | -import static org.assertj.core.api.Assertions.assertThat; |
4 | | -import static org.assertj.core.api.Assertions.assertThatThrownBy; |
5 | | -import static org.mockito.ArgumentMatchers.any; |
6 | | -import static org.mockito.Mockito.when; |
| 3 | +import static org.assertj.core.api.Assertions.*; |
| 4 | +import static org.mockito.ArgumentMatchers.*; |
| 5 | +import static org.mockito.Mockito.*; |
| 6 | + |
| 7 | +import org.junit.jupiter.api.DisplayName; |
| 8 | +import org.junit.jupiter.api.Test; |
| 9 | +import org.junit.jupiter.api.extension.ExtendWith; |
| 10 | +import org.mockito.InjectMocks; |
| 11 | +import org.mockito.Mock; |
| 12 | +import org.mockito.junit.jupiter.MockitoExtension; |
| 13 | +import org.springframework.test.util.ReflectionTestUtils; |
7 | 14 |
|
8 | 15 | import com.oronaminc.join.answer.domain.Answer; |
9 | 16 | import com.oronaminc.join.answer.service.AnswerReader; |
|
21 | 28 | import com.oronaminc.join.room.domain.Room; |
22 | 29 | import com.oronaminc.join.room.service.RoomReader; |
23 | 30 | import com.oronaminc.join.websocket.common.EventType; |
24 | | -import org.junit.jupiter.api.DisplayName; |
25 | | -import org.junit.jupiter.api.Test; |
26 | | -import org.junit.jupiter.api.extension.ExtendWith; |
27 | | -import org.mockito.InjectMocks; |
28 | | -import org.mockito.Mock; |
29 | | -import org.mockito.junit.jupiter.MockitoExtension; |
30 | | -import org.springframework.test.util.ReflectionTestUtils; |
31 | 31 |
|
32 | 32 | @ExtendWith(MockitoExtension.class) |
33 | 33 | class EmojiServiceTests { |
@@ -81,7 +81,7 @@ void toggleEmoji_createRoomEmoji_success() { |
81 | 81 |
|
82 | 82 | // when |
83 | 83 | EmojiResponse response = emojiService.createEmoji(memberId, |
84 | | - new EmojiRequest(targetType, targetId)); |
| 84 | + new EmojiRequest(targetType, targetId, memberId)); |
85 | 85 |
|
86 | 86 | // then |
87 | 87 | assertThat(response.event()).isEqualTo(EventType.CREATE); |
@@ -119,7 +119,7 @@ void toggleEmoji_createQuestionEmoji_success() { |
119 | 119 |
|
120 | 120 | // when |
121 | 121 | EmojiResponse response = emojiService.createEmoji(memberId, |
122 | | - new EmojiRequest(targetType, targetId)); |
| 122 | + new EmojiRequest(targetType, targetId, memberId)); |
123 | 123 |
|
124 | 124 | // then |
125 | 125 | assertThat(response.event()).isEqualTo(EventType.CREATE); |
@@ -157,7 +157,7 @@ void toggleEmoji_createAnswerEmoji_success() { |
157 | 157 |
|
158 | 158 | // when |
159 | 159 | EmojiResponse response = emojiService.createEmoji(memberId, |
160 | | - new EmojiRequest(targetType, targetId)); |
| 160 | + new EmojiRequest(targetType, targetId, memberId)); |
161 | 161 |
|
162 | 162 | // then |
163 | 163 | assertThat(response.event()).isEqualTo(EventType.CREATE); |
@@ -194,7 +194,7 @@ void toggleEmoji_createRoomEmoji_fail() { |
194 | 194 | // then |
195 | 195 | assertThatThrownBy( |
196 | 196 | () -> { |
197 | | - emojiService.createEmoji(memberId, new EmojiRequest(targetType, targetId)); |
| 197 | + emojiService.createEmoji(memberId, new EmojiRequest(targetType, targetId, memberId)); |
198 | 198 | } |
199 | 199 | ).isInstanceOf(ErrorException.class); |
200 | 200 |
|
@@ -226,7 +226,7 @@ void toggleEmoji_deleteRoomEmoji_success() { |
226 | 226 |
|
227 | 227 | // when |
228 | 228 | EmojiResponse response = emojiService.deleteEmoji(memberId, |
229 | | - new EmojiRequest(targetType, targetId)); |
| 229 | + new EmojiRequest(targetType, targetId, memberId)); |
230 | 230 |
|
231 | 231 | // then |
232 | 232 | assertThat(response.event()).isEqualTo(EventType.DELETE); |
@@ -262,7 +262,7 @@ void toggleEmoji_deleteQuestionEmoji_success() { |
262 | 262 |
|
263 | 263 | // when |
264 | 264 | EmojiResponse response = emojiService.deleteEmoji(memberId, |
265 | | - new EmojiRequest(targetType, targetId)); |
| 265 | + new EmojiRequest(targetType, targetId, memberId)); |
266 | 266 |
|
267 | 267 | // then |
268 | 268 | assertThat(response.event()).isEqualTo(EventType.DELETE); |
@@ -298,7 +298,7 @@ void toggleEmoji_deleteAnswerEmoji_success() { |
298 | 298 |
|
299 | 299 | // when |
300 | 300 | EmojiResponse response = emojiService.deleteEmoji(memberId, |
301 | | - new EmojiRequest(targetType, targetId)); |
| 301 | + new EmojiRequest(targetType, targetId, memberId)); |
302 | 302 |
|
303 | 303 | // then |
304 | 304 | assertThat(response.event()).isEqualTo(EventType.DELETE); |
@@ -335,7 +335,7 @@ void toggleEmoji_deleteRoomEmoji_fail() { |
335 | 335 | // then |
336 | 336 | assertThatThrownBy( |
337 | 337 | () -> { |
338 | | - emojiService.deleteEmoji(memberId, new EmojiRequest(targetType, targetId)); |
| 338 | + emojiService.deleteEmoji(memberId, new EmojiRequest(targetType, targetId, memberId)); |
339 | 339 | } |
340 | 340 | ).isInstanceOf(ErrorException.class); |
341 | 341 |
|
|
0 commit comments