From 5654ec4eec57cd7f5ae77bff6fd1e3905e1e18c9 Mon Sep 17 00:00:00 2001 From: Enrico Date: Wed, 22 May 2024 12:48:26 +0200 Subject: [PATCH] Fix review comments --- .../webapi/controller/DatesBindingTest.java | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/dhis-2/dhis-web-api/src/test/java/org/hisp/dhis/webapi/controller/DatesBindingTest.java b/dhis-2/dhis-web-api/src/test/java/org/hisp/dhis/webapi/controller/DatesBindingTest.java index 2757a6d73463..00f19e11f48a 100644 --- a/dhis-2/dhis-web-api/src/test/java/org/hisp/dhis/webapi/controller/DatesBindingTest.java +++ b/dhis-2/dhis-web-api/src/test/java/org/hisp/dhis/webapi/controller/DatesBindingTest.java @@ -63,7 +63,7 @@ public void setUp() { @Test void shouldReturnADateAtTheEndOfTheDayWhenAnEndDateIsPassedWithoutTime() throws Exception { - mockMvc.perform(get(ENDPOINT).param("before", "2001-06-17")).andExpect(status().isOk()); + mockMvc.perform(get(ENDPOINT).param("end", "2001-06-17")).andExpect(status().isOk()); assertNull(actualStartDateTime); assertEquals("2001-06-17T23:59:59", DateUtils.toLongDate(actualEndDateTime)); @@ -71,9 +71,7 @@ void shouldReturnADateAtTheEndOfTheDayWhenAnEndDateIsPassedWithoutTime() throws @Test void shouldReturnADateWithTimeWhenAnEndDateIsPassedWithTime() throws Exception { - mockMvc - .perform(get(ENDPOINT).param("before", "2001-06-17T16:45:34")) - .andExpect(status().isOk()); + mockMvc.perform(get(ENDPOINT).param("end", "2001-06-17T16:45:34")).andExpect(status().isOk()); assertNull(actualStartDateTime); assertEquals("2001-06-17T16:45:34", DateUtils.toLongDate(actualEndDateTime)); @@ -81,7 +79,7 @@ void shouldReturnADateWithTimeWhenAnEndDateIsPassedWithTime() throws Exception { @Test void shouldReturnADateAtTheStartOfTheDayWhenAnStartDateIsPassedWithoutTime() throws Exception { - mockMvc.perform(get(ENDPOINT).param("after", "2001-06-17")).andExpect(status().isOk()); + mockMvc.perform(get(ENDPOINT).param("start", "2001-06-17")).andExpect(status().isOk()); assertEquals("2001-06-17T00:00:00", DateUtils.toLongDate(actualStartDateTime)); assertNull(actualEndDateTime); @@ -89,7 +87,7 @@ void shouldReturnADateAtTheStartOfTheDayWhenAnStartDateIsPassedWithoutTime() thr @Test void shouldReturnADateWithTimeWhenAnStartDateIsPassedWithTime() throws Exception { - mockMvc.perform(get(ENDPOINT).param("after", "2001-06-17T16:45:34")).andExpect(status().isOk()); + mockMvc.perform(get(ENDPOINT).param("start", "2001-06-17T16:45:34")).andExpect(status().isOk()); assertEquals("2001-06-17T16:45:34", DateUtils.toLongDate(actualStartDateTime)); assertNull(actualEndDateTime); @@ -99,8 +97,8 @@ void shouldReturnADateWithTimeWhenAnStartDateIsPassedWithTime() throws Exception private class BindingController { @GetMapping(value = ENDPOINT) public @ResponseBody WebMessage getDefault(Params params) { - actualStartDateTime = applyIfNotNull(params.getAfter(), StartDateTime::toDate); - actualEndDateTime = applyIfNotNull(params.getBefore(), EndDateTime::toDate); + actualStartDateTime = applyIfNotNull(params.getStart(), StartDateTime::toDate); + actualEndDateTime = applyIfNotNull(params.getEnd(), EndDateTime::toDate); return ok(); } } @@ -108,8 +106,8 @@ private class BindingController { @NoArgsConstructor @Data private class Params { - private StartDateTime after; + private StartDateTime start; - private EndDateTime before; + private EndDateTime end; } }