diff --git a/.gitignore b/.gitignore index b763203f..29fdf3fc 100644 --- a/.gitignore +++ b/.gitignore @@ -7,6 +7,7 @@ build/ !**/src/main/**/build/ !**/src/test/**/build/ docs/ +static/ ### STS ### .apt_generated diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index 449647da..9c2b6289 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -17,7 +17,7 @@ server.error.whitelabel.enabled=false # Jackson spring.jackson.default-property-inclusion=non_null spring.jackson.deserialization.fail-on-null-creator-properties=true -spring.jackson.date-format=dd-MM-yyyy +spring.jackson.date-format=dd-MM-yyyy HH:mm spring.jackson.time-zone=Europe/Lisbon # Auth Config diff --git a/src/test/kotlin/pt/up/fe/ni/website/backend/controller/EventControllerTest.kt b/src/test/kotlin/pt/up/fe/ni/website/backend/controller/EventControllerTest.kt index 894959a6..1104958e 100644 --- a/src/test/kotlin/pt/up/fe/ni/website/backend/controller/EventControllerTest.kt +++ b/src/test/kotlin/pt/up/fe/ni/website/backend/controller/EventControllerTest.kt @@ -72,8 +72,8 @@ internal class EventControllerTest @Autowired constructor( "cool-image.png", "https://docs.google.com/forms", DateInterval( - TestUtils.createDate(2022, Calendar.JULY, 28), - TestUtils.createDate(2022, Calendar.JULY, 30) + TestUtils.createDate(2022, Calendar.JULY, 28, 10, 30), + TestUtils.createDate(2022, Calendar.JULY, 30, 11, 30) ), "FEUP", "Great Events" diff --git a/src/test/kotlin/pt/up/fe/ni/website/backend/controller/ProjectControllerTest.kt b/src/test/kotlin/pt/up/fe/ni/website/backend/controller/ProjectControllerTest.kt index b5e53364..1ab9e633 100644 --- a/src/test/kotlin/pt/up/fe/ni/website/backend/controller/ProjectControllerTest.kt +++ b/src/test/kotlin/pt/up/fe/ni/website/backend/controller/ProjectControllerTest.kt @@ -1153,7 +1153,7 @@ internal class ProjectControllerTest @Autowired constructor( .andDocumentErrorResponse(documentation, hasRequestPayload = true) }, requiredFields = mapOf( - "date" to "22-07-2021", + "date" to "22-07-2021 00:00", "description" to "test description" ) ) diff --git a/src/test/kotlin/pt/up/fe/ni/website/backend/utils/TestUtils.kt b/src/test/kotlin/pt/up/fe/ni/website/backend/utils/TestUtils.kt index 4d5289f0..c0a736ab 100644 --- a/src/test/kotlin/pt/up/fe/ni/website/backend/utils/TestUtils.kt +++ b/src/test/kotlin/pt/up/fe/ni/website/backend/utils/TestUtils.kt @@ -1,15 +1,13 @@ package pt.up.fe.ni.website.backend.utils -import java.util.Calendar -import java.util.Date -import java.util.TimeZone +import java.util.* import org.springframework.test.context.transaction.TestTransaction class TestUtils { companion object { - fun createDate(year: Int, month: Int, day: Int): Date { + fun createDate(year: Int, month: Int, day: Int, hour: Int = 0, minute: Int = 0): Date { return Calendar.getInstance(TimeZone.getTimeZone("UTC")) - .apply { set(year, month, day, 0, 0, 0) } + .apply { set(year, month, day, hour, minute, 0) } .time } 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 1ff0dc0e..8bfba595 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,6 +1,6 @@ package pt.up.fe.ni.website.backend.utils -import java.time.LocalDate +import java.time.LocalDateTime import java.time.format.DateTimeFormatter import org.springframework.http.MediaType import org.springframework.test.web.servlet.ResultActions @@ -115,8 +115,8 @@ class ValidationTester( fun isPastDate() { // get the current date and offset it by 1 day - val timeFormatter = DateTimeFormatter.ofPattern("dd-MM-yyyy") - val tomorrow = LocalDate.now() + val timeFormatter = DateTimeFormatter.ofPattern("dd-MM-yyyy HH:mm") + val tomorrow = LocalDateTime.now() .plusDays(1) .format(timeFormatter) .toString() @@ -141,8 +141,8 @@ class ValidationTester( ) params[param] = mapOf( - "startDate" to "09-01-2023", - "endDate" to "08-01-2023" + "startDate" to "09-01-2023 00:00", + "endDate" to "08-01-2023 00:00" ) req(params) .expectValidationError()