-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathReservationControllerTest.java
More file actions
578 lines (493 loc) · 25.6 KB
/
Copy pathReservationControllerTest.java
File metadata and controls
578 lines (493 loc) · 25.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
package com.devoops.reservation.controller;
import com.devoops.reservation.config.RoleAuthorizationInterceptor;
import com.devoops.reservation.config.UserContext;
import com.devoops.reservation.config.UserContextResolver;
import com.devoops.reservation.dto.response.ReservationResponse;
import com.devoops.reservation.dto.response.ReservationWithGuestInfoResponse;
import com.devoops.reservation.entity.ReservationStatus;
import com.devoops.reservation.exception.ForbiddenException;
import com.devoops.reservation.exception.GlobalExceptionHandler;
import com.devoops.reservation.exception.InvalidReservationException;
import com.devoops.reservation.exception.ReservationNotFoundException;
import com.devoops.reservation.service.ReservationService;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Nested;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.junit.jupiter.MockitoExtension;
import org.springframework.http.MediaType;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.doNothing;
import static org.mockito.Mockito.doThrow;
import static org.mockito.Mockito.when;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*;
@ExtendWith(MockitoExtension.class)
class ReservationControllerTest {
private MockMvc mockMvc;
@Mock
private ReservationService reservationService;
@InjectMocks
private ReservationController reservationController;
private final ObjectMapper objectMapper = new ObjectMapper();
private static final UUID GUEST_ID = UUID.randomUUID();
private static final UUID HOST_ID = UUID.randomUUID();
private static final UUID ACCOMMODATION_ID = UUID.randomUUID();
private static final UUID RESERVATION_ID = UUID.randomUUID();
@BeforeEach
void setUp() {
mockMvc = MockMvcBuilders.standaloneSetup(reservationController)
.setControllerAdvice(new GlobalExceptionHandler())
.setCustomArgumentResolvers(new UserContextResolver())
.addInterceptors(new RoleAuthorizationInterceptor())
.build();
}
private ReservationResponse createResponse() {
return new ReservationResponse(
RESERVATION_ID, ACCOMMODATION_ID, "Test Accommodation",
GUEST_ID, "John Doe", HOST_ID, "Jane Host",
LocalDate.now().plusDays(10), LocalDate.now().plusDays(15),
2, new BigDecimal("1000.00"), ReservationStatus.PENDING,
LocalDateTime.now(), LocalDateTime.now()
);
}
private ReservationResponse createApprovedResponse() {
return new ReservationResponse(
RESERVATION_ID, ACCOMMODATION_ID, "Test Accommodation",
GUEST_ID, "John Doe", HOST_ID, "Jane Host",
LocalDate.now().plusDays(10), LocalDate.now().plusDays(15),
2, new BigDecimal("1000.00"), ReservationStatus.APPROVED,
LocalDateTime.now(), LocalDateTime.now()
);
}
private ReservationResponse createRejectedResponse() {
return new ReservationResponse(
RESERVATION_ID, ACCOMMODATION_ID, "Test Accommodation",
GUEST_ID, "John Doe", HOST_ID, "Jane Host",
LocalDate.now().plusDays(10), LocalDate.now().plusDays(15),
2, new BigDecimal("1000.00"), ReservationStatus.REJECTED,
LocalDateTime.now(), LocalDateTime.now()
);
}
private ReservationWithGuestInfoResponse createResponseWithGuestInfo() {
return ReservationWithGuestInfoResponse.from(createResponse(), 2L);
}
private Map<String, Object> validCreateRequest() {
return Map.of(
"accommodationId", ACCOMMODATION_ID.toString(),
"startDate", LocalDate.now().plusDays(10).toString(),
"endDate", LocalDate.now().plusDays(15).toString(),
"guestCount", 2
);
}
@Nested
@DisplayName("POST /api/reservation")
class CreateEndpoint {
@Test
@DisplayName("With valid request returns 201")
void create_WithValidRequest_Returns201() throws Exception {
when(reservationService.create(any(), any(UserContext.class)))
.thenReturn(createResponse());
mockMvc.perform(post("/api/reservation")
.header("X-User-Id", GUEST_ID.toString())
.header("X-User-Role", "GUEST")
.contentType(MediaType.APPLICATION_JSON)
.content(objectMapper.writeValueAsString(validCreateRequest())))
.andExpect(status().isCreated())
.andExpect(jsonPath("$.id").value(RESERVATION_ID.toString()))
.andExpect(jsonPath("$.status").value("PENDING"));
}
@Test
@DisplayName("With missing auth headers returns 401")
void create_WithMissingAuthHeaders_Returns401() throws Exception {
mockMvc.perform(post("/api/reservation")
.contentType(MediaType.APPLICATION_JSON)
.content(objectMapper.writeValueAsString(validCreateRequest())))
.andExpect(status().isUnauthorized());
}
@Test
@DisplayName("With HOST role returns 403")
void create_WithHostRole_Returns403() throws Exception {
mockMvc.perform(post("/api/reservation")
.header("X-User-Id", HOST_ID.toString())
.header("X-User-Role", "HOST")
.contentType(MediaType.APPLICATION_JSON)
.content(objectMapper.writeValueAsString(validCreateRequest())))
.andExpect(status().isForbidden());
}
@Test
@DisplayName("With missing accommodationId returns 400")
void create_WithMissingAccommodationId_Returns400() throws Exception {
var request = Map.of(
"startDate", LocalDate.now().plusDays(10).toString(),
"endDate", LocalDate.now().plusDays(15).toString(),
"guestCount", 2
);
mockMvc.perform(post("/api/reservation")
.header("X-User-Id", GUEST_ID.toString())
.header("X-User-Role", "GUEST")
.contentType(MediaType.APPLICATION_JSON)
.content(objectMapper.writeValueAsString(request)))
.andExpect(status().isBadRequest());
}
@Test
@DisplayName("With invalid guest count returns 400")
void create_WithInvalidGuestCount_Returns400() throws Exception {
var request = Map.of(
"accommodationId", ACCOMMODATION_ID.toString(),
"startDate", LocalDate.now().plusDays(10).toString(),
"endDate", LocalDate.now().plusDays(15).toString(),
"guestCount", 0
);
mockMvc.perform(post("/api/reservation")
.header("X-User-Id", GUEST_ID.toString())
.header("X-User-Role", "GUEST")
.contentType(MediaType.APPLICATION_JSON)
.content(objectMapper.writeValueAsString(request)))
.andExpect(status().isBadRequest());
}
@Test
@DisplayName("With overlapping reservation returns 400")
void create_WithOverlappingReservation_Returns400() throws Exception {
when(reservationService.create(any(), any(UserContext.class)))
.thenThrow(new InvalidReservationException("overlap with an existing approved reservation"));
mockMvc.perform(post("/api/reservation")
.header("X-User-Id", GUEST_ID.toString())
.header("X-User-Role", "GUEST")
.contentType(MediaType.APPLICATION_JSON)
.content(objectMapper.writeValueAsString(validCreateRequest())))
.andExpect(status().isBadRequest());
}
}
@Nested
@DisplayName("GET /api/reservation/{id}")
class GetByIdEndpoint {
@Test
@DisplayName("With existing ID and guest role returns 200")
void getById_WithExistingIdAndGuestRole_Returns200() throws Exception {
when(reservationService.getById(eq(RESERVATION_ID), any(UserContext.class)))
.thenReturn(createResponse());
mockMvc.perform(get("/api/reservation/{id}", RESERVATION_ID)
.header("X-User-Id", GUEST_ID.toString())
.header("X-User-Role", "GUEST"))
.andExpect(status().isOk())
.andExpect(jsonPath("$.id").value(RESERVATION_ID.toString()));
}
@Test
@DisplayName("With existing ID and host role returns 200")
void getById_WithExistingIdAndHostRole_Returns200() throws Exception {
when(reservationService.getById(eq(RESERVATION_ID), any(UserContext.class)))
.thenReturn(createResponse());
mockMvc.perform(get("/api/reservation/{id}", RESERVATION_ID)
.header("X-User-Id", HOST_ID.toString())
.header("X-User-Role", "HOST"))
.andExpect(status().isOk())
.andExpect(jsonPath("$.id").value(RESERVATION_ID.toString()));
}
@Test
@DisplayName("With non-existing ID returns 404")
void getById_WithNonExistingId_Returns404() throws Exception {
UUID id = UUID.randomUUID();
when(reservationService.getById(eq(id), any(UserContext.class)))
.thenThrow(new ReservationNotFoundException("Not found"));
mockMvc.perform(get("/api/reservation/{id}", id)
.header("X-User-Id", GUEST_ID.toString())
.header("X-User-Role", "GUEST"))
.andExpect(status().isNotFound());
}
@Test
@DisplayName("With unauthorized user returns 403")
void getById_WithUnauthorizedUser_Returns403() throws Exception {
when(reservationService.getById(eq(RESERVATION_ID), any(UserContext.class)))
.thenThrow(new ForbiddenException("Access denied"));
mockMvc.perform(get("/api/reservation/{id}", RESERVATION_ID)
.header("X-User-Id", UUID.randomUUID().toString())
.header("X-User-Role", "GUEST"))
.andExpect(status().isForbidden());
}
}
@Nested
@DisplayName("GET /api/reservation/guest")
class GetByGuestEndpoint {
@Test
@DisplayName("Returns 200 with list")
void getByGuest_Returns200WithList() throws Exception {
when(reservationService.getByGuestId(any(UserContext.class)))
.thenReturn(List.of(createResponse()));
mockMvc.perform(get("/api/reservation/guest")
.header("X-User-Id", GUEST_ID.toString())
.header("X-User-Role", "GUEST"))
.andExpect(status().isOk())
.andExpect(jsonPath("$[0].id").value(RESERVATION_ID.toString()));
}
@Test
@DisplayName("With HOST role returns 403")
void getByGuest_WithHostRole_Returns403() throws Exception {
mockMvc.perform(get("/api/reservation/guest")
.header("X-User-Id", HOST_ID.toString())
.header("X-User-Role", "HOST"))
.andExpect(status().isForbidden());
}
}
@Nested
@DisplayName("GET /api/reservation/host")
class GetByHostEndpoint {
@Test
@DisplayName("Returns 200 with list including guest cancellation count")
void getByHost_Returns200WithList() throws Exception {
when(reservationService.getByHostIdWithGuestInfo(any(UserContext.class)))
.thenReturn(List.of(createResponseWithGuestInfo()));
mockMvc.perform(get("/api/reservation/host")
.header("X-User-Id", HOST_ID.toString())
.header("X-User-Role", "HOST"))
.andExpect(status().isOk())
.andExpect(jsonPath("$[0].id").value(RESERVATION_ID.toString()))
.andExpect(jsonPath("$[0].guestCancellationCount").value(2));
}
@Test
@DisplayName("With GUEST role returns 403")
void getByHost_WithGuestRole_Returns403() throws Exception {
mockMvc.perform(get("/api/reservation/host")
.header("X-User-Id", GUEST_ID.toString())
.header("X-User-Role", "GUEST"))
.andExpect(status().isForbidden());
}
}
@Nested
@DisplayName("DELETE /api/reservation/{id}")
class DeleteEndpoint {
@Test
@DisplayName("With valid request returns 204")
void delete_WithValidRequest_Returns204() throws Exception {
doNothing().when(reservationService).deleteRequest(eq(RESERVATION_ID), any(UserContext.class));
mockMvc.perform(delete("/api/reservation/{id}", RESERVATION_ID)
.header("X-User-Id", GUEST_ID.toString())
.header("X-User-Role", "GUEST"))
.andExpect(status().isNoContent());
}
@Test
@DisplayName("With non-existing ID returns 404")
void delete_WithNonExistingId_Returns404() throws Exception {
UUID id = UUID.randomUUID();
doThrow(new ReservationNotFoundException("Not found"))
.when(reservationService).deleteRequest(eq(id), any(UserContext.class));
mockMvc.perform(delete("/api/reservation/{id}", id)
.header("X-User-Id", GUEST_ID.toString())
.header("X-User-Role", "GUEST"))
.andExpect(status().isNotFound());
}
@Test
@DisplayName("With wrong owner returns 403")
void delete_WithWrongOwner_Returns403() throws Exception {
doThrow(new ForbiddenException("Not the owner"))
.when(reservationService).deleteRequest(eq(RESERVATION_ID), any(UserContext.class));
mockMvc.perform(delete("/api/reservation/{id}", RESERVATION_ID)
.header("X-User-Id", UUID.randomUUID().toString())
.header("X-User-Role", "GUEST"))
.andExpect(status().isForbidden());
}
@Test
@DisplayName("With non-pending status returns 400")
void delete_WithNonPendingStatus_Returns400() throws Exception {
doThrow(new InvalidReservationException("Only pending requests can be deleted"))
.when(reservationService).deleteRequest(eq(RESERVATION_ID), any(UserContext.class));
mockMvc.perform(delete("/api/reservation/{id}", RESERVATION_ID)
.header("X-User-Id", GUEST_ID.toString())
.header("X-User-Role", "GUEST"))
.andExpect(status().isBadRequest());
}
@Test
@DisplayName("With HOST role returns 403")
void delete_WithHostRole_Returns403() throws Exception {
mockMvc.perform(delete("/api/reservation/{id}", RESERVATION_ID)
.header("X-User-Id", HOST_ID.toString())
.header("X-User-Role", "HOST"))
.andExpect(status().isForbidden());
}
}
@Nested
@DisplayName("POST /api/reservation/{id}/cancel")
class CancelEndpoint {
@Test
@DisplayName("With valid request returns 204")
void cancel_WithValidRequest_Returns204() throws Exception {
doNothing().when(reservationService).cancelReservation(eq(RESERVATION_ID), any(UserContext.class));
mockMvc.perform(post("/api/reservation/{id}/cancel", RESERVATION_ID)
.header("X-User-Id", GUEST_ID.toString())
.header("X-User-Role", "GUEST"))
.andExpect(status().isNoContent());
}
@Test
@DisplayName("With non-existing ID returns 404")
void cancel_WithNonExistingId_Returns404() throws Exception {
UUID id = UUID.randomUUID();
doThrow(new ReservationNotFoundException("Not found"))
.when(reservationService).cancelReservation(eq(id), any(UserContext.class));
mockMvc.perform(post("/api/reservation/{id}/cancel", id)
.header("X-User-Id", GUEST_ID.toString())
.header("X-User-Role", "GUEST"))
.andExpect(status().isNotFound());
}
@Test
@DisplayName("With wrong owner returns 403")
void cancel_WithWrongOwner_Returns403() throws Exception {
doThrow(new ForbiddenException("Not the owner"))
.when(reservationService).cancelReservation(eq(RESERVATION_ID), any(UserContext.class));
mockMvc.perform(post("/api/reservation/{id}/cancel", RESERVATION_ID)
.header("X-User-Id", UUID.randomUUID().toString())
.header("X-User-Role", "GUEST"))
.andExpect(status().isForbidden());
}
@Test
@DisplayName("With non-approved status returns 400")
void cancel_WithNonApprovedStatus_Returns400() throws Exception {
doThrow(new InvalidReservationException("Only approved reservations can be cancelled"))
.when(reservationService).cancelReservation(eq(RESERVATION_ID), any(UserContext.class));
mockMvc.perform(post("/api/reservation/{id}/cancel", RESERVATION_ID)
.header("X-User-Id", GUEST_ID.toString())
.header("X-User-Role", "GUEST"))
.andExpect(status().isBadRequest());
}
@Test
@DisplayName("With less than 1 day before start returns 400")
void cancel_WithTooLate_Returns400() throws Exception {
doThrow(new InvalidReservationException("at least 1 day before"))
.when(reservationService).cancelReservation(eq(RESERVATION_ID), any(UserContext.class));
mockMvc.perform(post("/api/reservation/{id}/cancel", RESERVATION_ID)
.header("X-User-Id", GUEST_ID.toString())
.header("X-User-Role", "GUEST"))
.andExpect(status().isBadRequest());
}
@Test
@DisplayName("With HOST role returns 403")
void cancel_WithHostRole_Returns403() throws Exception {
mockMvc.perform(post("/api/reservation/{id}/cancel", RESERVATION_ID)
.header("X-User-Id", HOST_ID.toString())
.header("X-User-Role", "HOST"))
.andExpect(status().isForbidden());
}
}
@Nested
@DisplayName("PUT /api/reservation/{id}/approve")
class ApproveEndpoint {
@Test
@DisplayName("With valid request returns 200")
void approve_WithValidRequest_Returns200() throws Exception {
when(reservationService.approveReservation(eq(RESERVATION_ID), any(UserContext.class)))
.thenReturn(createApprovedResponse());
mockMvc.perform(put("/api/reservation/{id}/approve", RESERVATION_ID)
.header("X-User-Id", HOST_ID.toString())
.header("X-User-Role", "HOST"))
.andExpect(status().isOk())
.andExpect(jsonPath("$.id").value(RESERVATION_ID.toString()))
.andExpect(jsonPath("$.status").value("APPROVED"));
}
@Test
@DisplayName("With GUEST role returns 403")
void approve_WithGuestRole_Returns403() throws Exception {
mockMvc.perform(put("/api/reservation/{id}/approve", RESERVATION_ID)
.header("X-User-Id", GUEST_ID.toString())
.header("X-User-Role", "GUEST"))
.andExpect(status().isForbidden());
}
@Test
@DisplayName("With non-existing ID returns 404")
void approve_WithNonExistingId_Returns404() throws Exception {
UUID id = UUID.randomUUID();
when(reservationService.approveReservation(eq(id), any(UserContext.class)))
.thenThrow(new ReservationNotFoundException("Not found"));
mockMvc.perform(put("/api/reservation/{id}/approve", id)
.header("X-User-Id", HOST_ID.toString())
.header("X-User-Role", "HOST"))
.andExpect(status().isNotFound());
}
@Test
@DisplayName("With wrong host returns 403")
void approve_WithWrongHost_Returns403() throws Exception {
when(reservationService.approveReservation(eq(RESERVATION_ID), any(UserContext.class)))
.thenThrow(new ForbiddenException("Not the host"));
mockMvc.perform(put("/api/reservation/{id}/approve", RESERVATION_ID)
.header("X-User-Id", UUID.randomUUID().toString())
.header("X-User-Role", "HOST"))
.andExpect(status().isForbidden());
}
@Test
@DisplayName("With non-pending status returns 400")
void approve_WithNonPendingStatus_Returns400() throws Exception {
when(reservationService.approveReservation(eq(RESERVATION_ID), any(UserContext.class)))
.thenThrow(new InvalidReservationException("Only pending reservations can be approved"));
mockMvc.perform(put("/api/reservation/{id}/approve", RESERVATION_ID)
.header("X-User-Id", HOST_ID.toString())
.header("X-User-Role", "HOST"))
.andExpect(status().isBadRequest());
}
}
@Nested
@DisplayName("PUT /api/reservation/{id}/reject")
class RejectEndpoint {
@Test
@DisplayName("With valid request returns 200")
void reject_WithValidRequest_Returns200() throws Exception {
when(reservationService.rejectReservation(eq(RESERVATION_ID), any(UserContext.class)))
.thenReturn(createRejectedResponse());
mockMvc.perform(put("/api/reservation/{id}/reject", RESERVATION_ID)
.header("X-User-Id", HOST_ID.toString())
.header("X-User-Role", "HOST"))
.andExpect(status().isOk())
.andExpect(jsonPath("$.id").value(RESERVATION_ID.toString()))
.andExpect(jsonPath("$.status").value("REJECTED"));
}
@Test
@DisplayName("With GUEST role returns 403")
void reject_WithGuestRole_Returns403() throws Exception {
mockMvc.perform(put("/api/reservation/{id}/reject", RESERVATION_ID)
.header("X-User-Id", GUEST_ID.toString())
.header("X-User-Role", "GUEST"))
.andExpect(status().isForbidden());
}
@Test
@DisplayName("With non-existing ID returns 404")
void reject_WithNonExistingId_Returns404() throws Exception {
UUID id = UUID.randomUUID();
when(reservationService.rejectReservation(eq(id), any(UserContext.class)))
.thenThrow(new ReservationNotFoundException("Not found"));
mockMvc.perform(put("/api/reservation/{id}/reject", id)
.header("X-User-Id", HOST_ID.toString())
.header("X-User-Role", "HOST"))
.andExpect(status().isNotFound());
}
@Test
@DisplayName("With wrong host returns 403")
void reject_WithWrongHost_Returns403() throws Exception {
when(reservationService.rejectReservation(eq(RESERVATION_ID), any(UserContext.class)))
.thenThrow(new ForbiddenException("Not the host"));
mockMvc.perform(put("/api/reservation/{id}/reject", RESERVATION_ID)
.header("X-User-Id", UUID.randomUUID().toString())
.header("X-User-Role", "HOST"))
.andExpect(status().isForbidden());
}
@Test
@DisplayName("With non-pending status returns 400")
void reject_WithNonPendingStatus_Returns400() throws Exception {
when(reservationService.rejectReservation(eq(RESERVATION_ID), any(UserContext.class)))
.thenThrow(new InvalidReservationException("Only pending reservations can be rejected"));
mockMvc.perform(put("/api/reservation/{id}/reject", RESERVATION_ID)
.header("X-User-Id", HOST_ID.toString())
.header("X-User-Role", "HOST"))
.andExpect(status().isBadRequest());
}
}
}