diff --git a/gradle.properties b/gradle.properties index d8822f1..be1c805 100644 --- a/gradle.properties +++ b/gradle.properties @@ -6,7 +6,7 @@ ktlintVersion=11.0.0 springBootVersion=2.7.11 springDependencyManagementVersion=1.0.15.RELEASE # project -applicationVersion=0.3.0 +applicationVersion=0.3.1 projectGroup=com.mealkitary # test kotestVersion=4.4.3 diff --git a/mealkitary-api/src/main/kotlin/com/mealkitary/common/utils/HttpResponseUtils.kt b/mealkitary-api/src/main/kotlin/com/mealkitary/common/utils/HttpResponseUtils.kt index b9dd6b5..fac3280 100644 --- a/mealkitary-api/src/main/kotlin/com/mealkitary/common/utils/HttpResponseUtils.kt +++ b/mealkitary-api/src/main/kotlin/com/mealkitary/common/utils/HttpResponseUtils.kt @@ -11,21 +11,23 @@ class HttpResponseUtils { fun createResourceUri(resourceId: UUID): URI { val uriComponents = ServletUriComponentsBuilder.fromCurrentRequest().build() - val scheme = uriComponents.scheme - val host = uriComponents.host - val path = uriComponents.path + val scheme = removeSlash(uriComponents.scheme) + val host = removeSlash(uriComponents.host) + val path = removeSlash(uriComponents.path) - return URI.create("$scheme://$host$path/$resourceId") + return URI.create("$scheme://$host/$path/$resourceId") } fun createResourceUri(path: String, resourceId: UUID): URI { val uriComponents = ServletUriComponentsBuilder.fromCurrentRequest().build() - val scheme = uriComponents.scheme - val host = uriComponents.host + val scheme = removeSlash(uriComponents.scheme) + val host = removeSlash(uriComponents.host) return URI.create("$scheme://$host/$path/$resourceId") } + private fun removeSlash(str: String?) = str?.replace("/", "") + fun mapToResponseEntity(emptiableList: List): ResponseEntity> { if (emptiableList.isEmpty()) { return ResponseEntity.noContent().build() diff --git a/mealkitary-api/src/test/kotlin/com/mealkitary/reservation/adapter/input/web/GetReservationControllerTest.kt b/mealkitary-api/src/test/kotlin/com/mealkitary/reservation/adapter/input/web/GetReservationControllerTest.kt index 2cedc7b..30b66ed 100644 --- a/mealkitary-api/src/test/kotlin/com/mealkitary/reservation/adapter/input/web/GetReservationControllerTest.kt +++ b/mealkitary-api/src/test/kotlin/com/mealkitary/reservation/adapter/input/web/GetReservationControllerTest.kt @@ -10,7 +10,10 @@ import org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get import org.springframework.test.web.servlet.result.MockMvcResultMatchers.content import org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath import org.springframework.test.web.servlet.result.MockMvcResultMatchers.status +import java.time.LocalDate import java.time.LocalDateTime +import java.time.LocalTime +import java.time.format.DateTimeFormatter import java.util.UUID class GetReservationControllerTest : WebIntegrationTestSupport() { @@ -18,7 +21,9 @@ class GetReservationControllerTest : WebIntegrationTestSupport() { @Test fun `api integration test - getOneReservation`() { val reservationId = UUID.randomUUID() - val reserveAt = LocalDateTime.now() + val reserveAt = LocalDateTime.of( + LocalDate.of(2023, 6, 23), LocalTime.of(6, 30) + ) every { getReservationQuery.loadOneReservationById(reservationId) } answers { ReservationResponse( reservationId, @@ -48,7 +53,7 @@ class GetReservationControllerTest : WebIntegrationTestSupport() { .andExpect(content().contentType(MediaType.APPLICATION_JSON)) .andExpect(jsonPath("$.reservationId").value(reservationId.toString())) .andExpect(jsonPath("$.shopName").value("집밥뚝딱 안양점")) - .andExpect(jsonPath("$.reserveAt").value(reserveAt.toString())) + .andExpect(jsonPath("$.reserveAt").value(reserveAt.format(DateTimeFormatter.ISO_DATE_TIME))) .andExpect(jsonPath("$.status").value("PAID")) .andExpect(jsonPath("$.reservedProduct[0].productId").value(1L)) .andExpect(jsonPath("$.reservedProduct[0].name").value("부대찌개"))