|
25 | 25 | import umc.teumteum.server.global.util.S3Util; |
26 | 26 |
|
27 | 27 | import java.time.Duration; |
| 28 | +import java.time.LocalDate; |
| 29 | +import java.time.LocalTime; |
28 | 30 | import java.util.List; |
29 | 31 | import java.util.Optional; |
30 | 32 |
|
@@ -94,16 +96,25 @@ void all_types_mapped_and_converted() { |
94 | 96 | User testFriend4 = mock(User.class); when(testFriend4.getProfileImageName()).thenReturn("tf4.png"); |
95 | 97 |
|
96 | 98 | // 관련 엔티티 mock, repodisoty stubbing |
| 99 | + TeumRequest acceptedRequest = mock(TeumRequest.class); |
| 100 | + when(acceptedRequest.getDate()).thenReturn(LocalDate.now()); |
| 101 | + when(acceptedRequest.getStartTime()).thenReturn(LocalTime.of(10, 0)); |
| 102 | + |
97 | 103 | TeumResponse teumResponse_related_accepted = mock(TeumResponse.class); |
98 | 104 | when(teumResponse_related_accepted.getReceiverUser()).thenReturn(testFriend1); |
| 105 | + when(teumResponse_related_accepted.getTeumRequest()).thenReturn(acceptedRequest); |
99 | 106 | when(teumResponseRepository.findById(101L)).thenReturn(Optional.of(teumResponse_related_accepted)); |
100 | 107 |
|
| 108 | + TeumRequest canceledRequest = mock(TeumRequest.class); |
| 109 | + |
101 | 110 | TeumResponse tuemResponse_related_canceled = mock(TeumResponse.class); |
102 | 111 | when(tuemResponse_related_canceled.getReceiverUser()).thenReturn(testFriend2); |
103 | 112 | when(teumResponseRepository.findById(102L)).thenReturn(Optional.of(tuemResponse_related_canceled)); |
104 | 113 |
|
105 | 114 | TeumRequest teumRequest = mock(TeumRequest.class); |
106 | 115 | when(teumRequest.getUser()).thenReturn(testFriend3); |
| 116 | + when(teumRequest.getDate()).thenReturn(LocalDate.now()); |
| 117 | + when(teumRequest.getStartTime()).thenReturn(LocalTime.of(12, 0)); |
107 | 118 | when(teumRequestRepository.findById(103L)).thenReturn(Optional.of(teumRequest)); |
108 | 119 |
|
109 | 120 | Friend friend = mock(Friend.class); |
@@ -155,6 +166,8 @@ void filter_when_related_not_found() { |
155 | 166 | when(testFriend.getProfileImageName()).thenReturn("tf1.png"); |
156 | 167 | TeumRequest tq = mock(TeumRequest.class); |
157 | 168 | when(tq.getUser()).thenReturn(testFriend); |
| 169 | + when(tq.getDate()).thenReturn(LocalDate.now()); |
| 170 | + when(tq.getStartTime()).thenReturn(LocalTime.of(10, 0)); |
158 | 171 |
|
159 | 172 | when(teumRequestRepository.findById(201L)).thenReturn(Optional.of(tq)); |
160 | 173 | when(friendRepository.findById(202L)).thenReturn(Optional.empty()); |
@@ -229,7 +242,10 @@ void verify_presigned_url() { |
229 | 242 |
|
230 | 243 | User testFriend = mock(User.class); |
231 | 244 | when(testFriend.getProfileImageName()).thenReturn("tf1.png"); |
232 | | - TeumRequest tq = mock(TeumRequest.class); when(tq.getUser()).thenReturn(testFriend); |
| 245 | + TeumRequest tq = mock(TeumRequest.class); |
| 246 | + when(tq.getUser()).thenReturn(testFriend); |
| 247 | + when(tq.getDate()).thenReturn(LocalDate.now()); |
| 248 | + when(tq.getStartTime()).thenReturn(LocalTime.of(10, 0)); |
233 | 249 | when(teumRequestRepository.findById(401L)).thenReturn(Optional.of(tq)); |
234 | 250 |
|
235 | 251 |
|
|
0 commit comments