Skip to content

Commit

Permalink
Formatting changes
Browse files Browse the repository at this point in the history
  • Loading branch information
probation-integration-bot[bot] authored Nov 21, 2024
1 parent d7305ae commit 3c2334e
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -176,12 +176,12 @@ class CreateAppointmentIntegrationTests {
val response = mockMvc.perform(
post("/appointment/${person.crn}")
.withToken()
.withJson(appointment))
.withJson(appointment)
)
.andDo(print())
.andExpect(MockMvcResultMatchers.status().isCreated)
.andReturn().response.contentAsJson<AppointmentDetail>()


val dateNowPlusOneDay = LocalDate.now().plusDays(1).format(DeliusDateFormatter)
val dateNowPlusTwoDays = LocalDate.now().plusDays(2).format(DeliusDateFormatter)
val dateNowPlusThreeDays = LocalDate.now().plusDays(3).format(DeliusDateFormatter)
Expand All @@ -192,7 +192,8 @@ class CreateAppointmentIntegrationTests {
mockMvc.perform(
post("/appointment/${person.crn}")
.withToken()
.withJson(appointment))
.withJson(appointment)
)
.andExpect(MockMvcResultMatchers.status().isConflict)
.andExpect(jsonPath("$.message", equalTo(errorMsg)))

Expand All @@ -210,16 +211,18 @@ class CreateAppointmentIntegrationTests {
val overlapAppointmentResponse = mockMvc.perform(
post("/appointment/${person.crn}")
.withToken()
.withJson(overlapAppointment))
.withJson(overlapAppointment)
)
.andDo(print())
.andExpect(MockMvcResultMatchers.status().isCreated)
.andReturn().response.contentAsJson<AppointmentDetail>()

val appointments = appointmentRepository.findAllById(response.appointments.map { it.id }) + appointmentRepository.findAllById(overlapAppointmentResponse.appointments.map { it.id })
val appointments =
appointmentRepository.findAllById(response.appointments.map { it.id }) + appointmentRepository.findAllById(
overlapAppointmentResponse.appointments.map { it.id })

assertThat(appointments.size, equalTo(6))
appointmentRepository.deleteAll(appointments)

}

companion object {
Expand Down Expand Up @@ -278,5 +281,4 @@ class CreateAppointmentIntegrationTests {
)
)
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,13 @@ class SentenceAppointmentService(
}

if (!createAppointment.createOverlappingAppointment && overlappingAppointments.isNotEmpty()) {
throw ConflictException("Appointment(s) conflicts with an existing future appointment ${objectMapper.writeValueAsString(overlappingAppointments)}")
throw ConflictException(
"Appointment(s) conflicts with an existing future appointment ${
objectMapper.writeValueAsString(
overlappingAppointments
)
}"
)
}

val appointments = createAppointments.map { it.withManager(om, userAndLocation) }
Expand Down

0 comments on commit 3c2334e

Please sign in to comment.