diff --git a/src/test/kotlin/pt/up/fe/ni/website/backend/utils/ValidationTester.kt b/src/test/kotlin/pt/up/fe/ni/website/backend/utils/ValidationTester.kt index 55c850f4..170980cd 100644 --- a/src/test/kotlin/pt/up/fe/ni/website/backend/utils/ValidationTester.kt +++ b/src/test/kotlin/pt/up/fe/ni/website/backend/utils/ValidationTester.kt @@ -1,5 +1,6 @@ package pt.up.fe.ni.website.backend.utils +import java.time.LocalDate import org.springframework.http.MediaType import org.springframework.test.web.servlet.ResultActions import org.springframework.test.web.servlet.result.MockMvcResultMatchers.content @@ -112,13 +113,18 @@ class ValidationTester( } fun isPastDate() { + // get the current date and offset it by 1 day + val tomorrow = LocalDate.now() + .plusDays(1) + .toString() + val params = requiredFields.toMutableMap() - params[param] = "01-01-3000" // TODO: use a date in the future instead of hard coded + params[param] = tomorrow req(params) .expectValidationError() .andExpectAll( jsonPath("$.errors[0].message").value("must be a past date"), - jsonPath("$.errors[0].value").value("01-01-3000") + jsonPath("$.errors[0].value").value(tomorrow) ) }