-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #68 from le2sky/develop
[배포] v0.4.0(PR#63, PR#65, PR#67)
- Loading branch information
Showing
76 changed files
with
1,045 additions
and
234 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
.../input/web/AcceptReservationController.kt → ...vation/web/AcceptReservationController.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...ter/input/web/GetReservationController.kt → ...servation/web/GetReservationController.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
...ter/input/web/PayReservationController.kt → ...servation/web/PayReservationController.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
mealkitary-api/src/main/kotlin/com/mealkitary/reservation/web/RejectReservationController.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package com.mealkitary.reservation.web | ||
|
||
import com.mealkitary.common.utils.UUIDUtils | ||
import com.mealkitary.reservation.application.port.input.RejectReservationUseCase | ||
import org.springframework.http.ResponseEntity | ||
import org.springframework.web.bind.annotation.PathVariable | ||
import org.springframework.web.bind.annotation.PostMapping | ||
import org.springframework.web.bind.annotation.RequestMapping | ||
import org.springframework.web.bind.annotation.RestController | ||
|
||
@RestController | ||
@RequestMapping("/reservations") | ||
class RejectReservationController( | ||
private val rejectReservationUseCase: RejectReservationUseCase | ||
) { | ||
|
||
@PostMapping("/{reservationId}/reject") | ||
fun rejectReservation(@PathVariable("reservationId") reservationId: String): ResponseEntity<Unit> { | ||
rejectReservationUseCase.reject(UUIDUtils.fromString(reservationId)) | ||
|
||
return ResponseEntity.noContent().build() | ||
} | ||
} |
4 changes: 2 additions & 2 deletions
4
...ter/input/web/ReserveProductController.kt → ...servation/web/ReserveProductController.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...t/web/request/PayReservationWebRequest.kt → ...n/web/request/PayReservationWebRequest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...t/web/request/ReserveProductWebRequest.kt → ...n/web/request/ReserveProductWebRequest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...r/input/web/request/ReservedWebProduct.kt → ...rvation/web/request/ReservedWebProduct.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...adapter/input/web/GetProductController.kt → ...alkitary/shop/web/GetProductController.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
.../input/web/GetReservableTimeController.kt → ...y/shop/web/GetReservableTimeController.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...op/adapter/input/web/GetShopController.kt → .../mealkitary/shop/web/GetShopController.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
mealkitary-api/src/test/kotlin/com/docs/reservation/AcceptReservationControllerDocsTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
mealkitary-api/src/test/kotlin/com/docs/reservation/GetReservationControllerDocsTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
mealkitary-api/src/test/kotlin/com/docs/reservation/PayReservationControllerDocsTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
mealkitary-api/src/test/kotlin/com/docs/reservation/RejectReservationControllerDocsTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package com.docs.reservation | ||
|
||
import com.docs.RestDocsSupport | ||
import com.mealkitary.reservation.application.port.input.RejectReservationUseCase | ||
import com.mealkitary.reservation.web.RejectReservationController | ||
import io.mockk.every | ||
import io.mockk.mockk | ||
import org.springframework.restdocs.mockmvc.MockMvcRestDocumentation.document | ||
import org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders | ||
import org.springframework.restdocs.operation.preprocess.Preprocessors.preprocessRequest | ||
import org.springframework.restdocs.operation.preprocess.Preprocessors.preprocessResponse | ||
import org.springframework.restdocs.operation.preprocess.Preprocessors.prettyPrint | ||
import org.springframework.restdocs.request.RequestDocumentation.parameterWithName | ||
import org.springframework.restdocs.request.RequestDocumentation.pathParameters | ||
import org.springframework.test.web.servlet.result.MockMvcResultMatchers.status | ||
import java.util.UUID | ||
|
||
class RejectReservationControllerDocsTest : RestDocsSupport() { | ||
|
||
private val rejectReservationUseCase = mockk<RejectReservationUseCase>() | ||
|
||
@Test | ||
fun `api docs test - rejectReservation`() { | ||
val id = UUID.randomUUID() | ||
every { rejectReservationUseCase.reject(any()) }.answers { } | ||
|
||
mvc.perform( | ||
RestDocumentationRequestBuilders.post("/reservations/{reservationId}/reject", id) | ||
) | ||
.andExpect(status().isNoContent) | ||
.andDo( | ||
document( | ||
"reservation-post-reject", | ||
preprocessRequest(prettyPrint()), | ||
preprocessResponse(prettyPrint()), | ||
pathParameters( | ||
parameterWithName("reservationId").description("거절 대상 예약의 식별자") | ||
), | ||
) | ||
) | ||
} | ||
|
||
override fun initController() = RejectReservationController(rejectReservationUseCase) | ||
} |
6 changes: 3 additions & 3 deletions
6
mealkitary-api/src/test/kotlin/com/docs/reservation/ReserveProductControllerDocsTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
mealkitary-api/src/test/kotlin/com/docs/shop/GetProductControllerDocsTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
mealkitary-api/src/test/kotlin/com/docs/shop/GetReservableTimeControllerDocsTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
mealkitary-api/src/test/kotlin/com/docs/shop/GetShopControllerDocsTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...ut/web/AcceptReservationControllerTest.kt → ...on/web/AcceptReservationControllerTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...input/web/GetReservationControllerTest.kt → ...ation/web/GetReservationControllerTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
...input/web/PayReservationControllerTest.kt → ...ation/web/PayReservationControllerTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
...ary-api/src/test/kotlin/com/mealkitary/reservation/web/RejectReservationControllerTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package com.mealkitary.reservation.web | ||
|
||
import com.mealkitary.WebIntegrationTestSupport | ||
import com.mealkitary.common.exception.EntityNotFoundException | ||
import io.mockk.every | ||
import org.springframework.test.web.servlet.request.MockMvcRequestBuilders | ||
import org.springframework.test.web.servlet.result.MockMvcResultMatchers | ||
import java.util.UUID | ||
|
||
class RejectReservationControllerTest : WebIntegrationTestSupport() { | ||
|
||
@Test | ||
fun `api integration test - rejectReservation`() { | ||
val id = UUID.randomUUID() | ||
every { rejectReservationUseCase.reject(any()) } answers {} | ||
|
||
mvc.perform( | ||
MockMvcRequestBuilders.post("/reservations/{reservationId}/reject", id.toString()) | ||
) | ||
.andExpect(MockMvcResultMatchers.status().isNoContent) | ||
} | ||
|
||
@Test | ||
fun `api integration test - 예약 식별자가 UUID 형태가 아니라면 400 에러를 발생한다`() { | ||
mvc.perform( | ||
MockMvcRequestBuilders.post("/reservations/{reservationId}/reject", "invalid-uuid-test") | ||
) | ||
.andExpect(MockMvcResultMatchers.status().isBadRequest) | ||
.andExpect(MockMvcResultMatchers.jsonPath("$.status").value("400")) | ||
.andExpect(MockMvcResultMatchers.jsonPath("$.message").value("잘못된 UUID 형식입니다.")) | ||
} | ||
|
||
@Test | ||
fun `api integration test - 내부에서 EntityNotFound 에러가 발생하면 404 에러를 발생한다`() { | ||
val id = UUID.randomUUID() | ||
every { rejectReservationUseCase.reject(any()) }.throws(EntityNotFoundException("존재하지 않는 예약입니다.")) | ||
|
||
mvc.perform( | ||
MockMvcRequestBuilders.post("/reservations/{reservationId}/reject", id.toString()) | ||
) | ||
.andExpect(MockMvcResultMatchers.status().isNotFound) | ||
.andExpect(MockMvcResultMatchers.jsonPath("$.status").value("404")) | ||
.andExpect(MockMvcResultMatchers.jsonPath("$.message").value("존재하지 않는 예약입니다.")) | ||
} | ||
} |
6 changes: 3 additions & 3 deletions
6
...input/web/ReserveProductControllerTest.kt → ...ation/web/ReserveProductControllerTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...ter/input/web/GetProductControllerTest.kt → ...tary/shop/web/GetProductControllerTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...ut/web/GetReservableTimeControllerTest.kt → ...op/web/GetReservableTimeControllerTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...dapter/input/web/GetShopControllerTest.kt → ...lkitary/shop/web/GetShopControllerTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.