Skip to content

Commit

Permalink
Merge pull request #61 from le2sky/develop
Browse files Browse the repository at this point in the history
[배포] v0.3.1(PR#60)
  • Loading branch information
le2sky authored Aug 27, 2023
2 parents a4f62b4 + ed4bb13 commit 4bb8d89
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 9 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 <T> mapToResponseEntity(emptiableList: List<T>): ResponseEntity<List<T>> {
if (emptiableList.isEmpty()) {
return ResponseEntity.noContent().build()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,20 @@ 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() {

@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,
Expand Down Expand Up @@ -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("부대찌개"))
Expand Down

0 comments on commit 4bb8d89

Please sign in to comment.