From 1e14ed565c7e6019c99b40ab1f6aefbcdb09688d Mon Sep 17 00:00:00 2001 From: jrmartino Date: Tue, 27 Oct 2020 13:23:10 -0400 Subject: [PATCH 1/2] update some tests to fix errors --- .../business/appointment/AppointmentDAO.java | 6 +- .../service/AppointmentServiceTest.java | 38 +++--- .../service/AppointmentUtilitiesTest.java | 120 +++++++++--------- .../service/ClosingDayServiceTest.java | 12 +- .../appointment/service/SlotServiceTest.java | 30 ++--- .../appointment/service/UtilitiesTest.java | 32 ++--- .../service/WorkingDayServiceTest.java | 4 +- 7 files changed, 121 insertions(+), 121 deletions(-) diff --git a/src/java/fr/paris/lutece/plugins/appointment/business/appointment/AppointmentDAO.java b/src/java/fr/paris/lutece/plugins/appointment/business/appointment/AppointmentDAO.java index 049c57b2a..5719d38b9 100644 --- a/src/java/fr/paris/lutece/plugins/appointment/business/appointment/AppointmentDAO.java +++ b/src/java/fr/paris/lutece/plugins/appointment/business/appointment/AppointmentDAO.java @@ -222,7 +222,7 @@ public Appointment findByReference( String strReference, Plugin plugin ) @Override public List findByFilter( AppointmentFilterDTO appointmentFilter, Plugin plugin ) { - List listAppointment = new ArrayList( ); + List listAppointment = new ArrayList<>(); DAOUtil daoUtil = new DAOUtil( getSqlQueryFromFilter( appointmentFilter ), plugin ); addFilterParametersToDAOUtil( appointmentFilter, daoUtil ); daoUtil.executeQuery( ); @@ -431,7 +431,7 @@ private Appointment buildAppointmentHeavy( DAOUtil daoUtil ) /** * Build a daoUtil object with the query and all the attributes of the Appointment * - * @param suery + * @param query * the query * @param appointment * the Appointment @@ -445,7 +445,7 @@ private Appointment buildAppointmentHeavy( DAOUtil daoUtil ) private DAOUtil buildDaoUtil( String query, Appointment appointment, Plugin plugin, boolean isInsert ) { int nIndex = 1; - DAOUtil daoUtil = null; + DAOUtil daoUtil; if ( isInsert ) { daoUtil = new DAOUtil( query, Statement.RETURN_GENERATED_KEYS, plugin ); diff --git a/src/test/java/fr/paris/lutece/plugins/appointment/service/AppointmentServiceTest.java b/src/test/java/fr/paris/lutece/plugins/appointment/service/AppointmentServiceTest.java index bc1be7c93..1d25917c5 100644 --- a/src/test/java/fr/paris/lutece/plugins/appointment/service/AppointmentServiceTest.java +++ b/src/test/java/fr/paris/lutece/plugins/appointment/service/AppointmentServiceTest.java @@ -25,7 +25,7 @@ public void testAppointmentAndNbRemainingPlaces( ) // Build the form int nIdForm = FormService.createAppointmentForm( FormServiceTest.buildAppointmentForm( ) ); - Slot slot = SlotTest.buildSlot( nIdForm, LocalDateTime.parse( "2018-12-03T10:00" ), LocalDateTime.parse( "2018-12-03T10:30" ), 1, 1, 0, 1, + Slot slot = SlotTest.buildSlot( nIdForm, LocalDateTime.parse( "2022-12-03T10:00" ), LocalDateTime.parse( "2022-12-03T10:30" ), 1, 1, 0, 1, Boolean.TRUE, Boolean.TRUE ); slot = SlotService.saveSlot( slot ); @@ -55,7 +55,7 @@ public void testAppointmentAndNbRemainingPlaces2( ) // Build the form int nIdForm = FormService.createAppointmentForm( FormServiceTest.buildAppointmentForm( ) ); - Slot slot = SlotTest.buildSlot( nIdForm, LocalDateTime.parse( "2018-12-03T10:00" ), LocalDateTime.parse( "2018-12-03T10:30" ), 2, 2, 0, 2, + Slot slot = SlotTest.buildSlot( nIdForm, LocalDateTime.parse( "2022-12-03T10:00" ), LocalDateTime.parse( "2022-12-03T10:30" ), 2, 2, 0, 2, Boolean.TRUE, Boolean.TRUE ); slot = SlotService.saveSlot( slot ); @@ -85,7 +85,7 @@ public void testAppointmentAndNbRemainingPlaces3( ) // Build the form int nIdForm = FormService.createAppointmentForm( FormServiceTest.buildAppointmentForm( ) ); - Slot slot = SlotTest.buildSlot( nIdForm, LocalDateTime.parse( "2018-12-03T10:00" ), LocalDateTime.parse( "2018-12-03T10:30" ), 2, 2, 0, 2, + Slot slot = SlotTest.buildSlot( nIdForm, LocalDateTime.parse( "2022-12-03T10:00" ), LocalDateTime.parse( "2022-12-03T10:30" ), 2, 2, 0, 2, Boolean.TRUE, Boolean.TRUE ); slot = SlotService.saveSlot( slot ); @@ -115,7 +115,7 @@ public void testAppointmentAndNbPotentialRemainingPlaces( ) // Build the form int nIdForm = FormService.createAppointmentForm( FormServiceTest.buildAppointmentForm( ) ); - Slot slot = SlotTest.buildSlot( nIdForm, LocalDateTime.parse( "2018-12-03T10:00" ), LocalDateTime.parse( "2018-12-03T10:30" ), 1, 1, 0, 1, + Slot slot = SlotTest.buildSlot( nIdForm, LocalDateTime.parse( "2022-12-03T10:00" ), LocalDateTime.parse( "2022-12-03T10:30" ), 1, 1, 0, 1, Boolean.TRUE, Boolean.TRUE ); slot = SlotService.saveSlot( slot ); @@ -145,7 +145,7 @@ public void testAppointmentAndNbPotentialRemainingPlaces2( ) // Build the form int nIdForm = FormService.createAppointmentForm( FormServiceTest.buildAppointmentForm( ) ); - Slot slot = SlotTest.buildSlot( nIdForm, LocalDateTime.parse( "2018-12-03T10:00" ), LocalDateTime.parse( "2018-12-03T10:30" ), 2, 2, 0, 2, + Slot slot = SlotTest.buildSlot( nIdForm, LocalDateTime.parse( "2022-12-03T10:00" ), LocalDateTime.parse( "2022-12-03T10:30" ), 2, 2, 0, 2, Boolean.TRUE, Boolean.TRUE ); slot = SlotService.saveSlot( slot ); @@ -176,7 +176,7 @@ public void testAppointmentAndNbPotentialRemainingPlaces3( ) // Build the form int nIdForm = FormService.createAppointmentForm( FormServiceTest.buildAppointmentForm( ) ); - Slot slot = SlotTest.buildSlot( nIdForm, LocalDateTime.parse( "2018-12-03T10:00" ), LocalDateTime.parse( "2018-12-03T10:30" ), 2, 2, 0, 2, + Slot slot = SlotTest.buildSlot( nIdForm, LocalDateTime.parse( "2022-12-03T10:00" ), LocalDateTime.parse( "2022-12-03T10:30" ), 2, 2, 0, 2, Boolean.TRUE, Boolean.TRUE ); slot = SlotService.saveSlot( slot ); @@ -206,7 +206,7 @@ public void testAppointmentAndNbPlacesTaken( ) // Build the form int nIdForm = FormService.createAppointmentForm( FormServiceTest.buildAppointmentForm( ) ); - Slot slot = SlotTest.buildSlot( nIdForm, LocalDateTime.parse( "2018-12-03T10:00" ), LocalDateTime.parse( "2018-12-03T10:30" ), 1, 1, 0, 1, + Slot slot = SlotTest.buildSlot( nIdForm, LocalDateTime.parse( "2022-12-03T10:00" ), LocalDateTime.parse( "2022-12-03T10:30" ), 1, 1, 0, 1, Boolean.TRUE, Boolean.TRUE ); slot = SlotService.saveSlot( slot ); @@ -236,7 +236,7 @@ public void testAppointmentAndNbPlacesTaken2( ) // Build the form int nIdForm = FormService.createAppointmentForm( FormServiceTest.buildAppointmentForm( ) ); - Slot slot = SlotTest.buildSlot( nIdForm, LocalDateTime.parse( "2018-12-03T10:00" ), LocalDateTime.parse( "2018-12-03T10:30" ), 2, 2, 0, 2, + Slot slot = SlotTest.buildSlot( nIdForm, LocalDateTime.parse( "2022-12-03T10:00" ), LocalDateTime.parse( "2022-12-03T10:30" ), 2, 2, 0, 2, Boolean.TRUE, Boolean.TRUE ); slot = SlotService.saveSlot( slot ); @@ -266,7 +266,7 @@ public void testAppointmentAndNbPlacesTaken3( ) // Build the form int nIdForm = FormService.createAppointmentForm( FormServiceTest.buildAppointmentForm( ) ); - Slot slot = SlotTest.buildSlot( nIdForm, LocalDateTime.parse( "2018-12-03T10:00" ), LocalDateTime.parse( "2018-12-03T10:30" ), 2, 2, 0, 2, + Slot slot = SlotTest.buildSlot( nIdForm, LocalDateTime.parse( "2022-12-03T10:00" ), LocalDateTime.parse( "2022-12-03T10:30" ), 2, 2, 0, 2, Boolean.TRUE, Boolean.TRUE ); slot = SlotService.saveSlot( slot ); @@ -296,7 +296,7 @@ public void testMultipleAppointmentsOnSameSlot( ) // Build the form int nIdForm = FormService.createAppointmentForm( FormServiceTest.buildAppointmentForm( ) ); - Slot slot = SlotTest.buildSlot( nIdForm, LocalDateTime.parse( "2018-12-03T10:00" ), LocalDateTime.parse( "2018-12-03T10:30" ), 2, 2, 0, 2, + Slot slot = SlotTest.buildSlot( nIdForm, LocalDateTime.parse( "2022-12-03T10:00" ), LocalDateTime.parse( "2022-12-03T10:30" ), 2, 2, 0, 2, Boolean.TRUE, Boolean.TRUE ); slot = SlotService.saveSlot( slot ); @@ -338,7 +338,7 @@ public void testMultipleAppointmentsOnSameSlot2( ) // Build the form int nIdForm = FormService.createAppointmentForm( FormServiceTest.buildAppointmentForm( ) ); - Slot slot = SlotTest.buildSlot( nIdForm, LocalDateTime.parse( "2018-12-03T10:00" ), LocalDateTime.parse( "2018-12-03T10:30" ), 3, 3, 0, 3, + Slot slot = SlotTest.buildSlot( nIdForm, LocalDateTime.parse( "2022-12-03T10:00" ), LocalDateTime.parse( "2022-12-03T10:30" ), 3, 3, 0, 3, Boolean.TRUE, Boolean.TRUE ); slot = SlotService.saveSlot( slot ); @@ -379,7 +379,7 @@ public void testMultipleAppointmentsOnSameSlot3( ) // Build the form int nIdForm = FormService.createAppointmentForm( FormServiceTest.buildAppointmentForm( ) ); - Slot slot = SlotTest.buildSlot( nIdForm, LocalDateTime.parse( "2018-12-03T10:00" ), LocalDateTime.parse( "2018-12-03T10:30" ), 3, 3, 0, 3, + Slot slot = SlotTest.buildSlot( nIdForm, LocalDateTime.parse( "2022-12-03T10:00" ), LocalDateTime.parse( "2022-12-03T10:30" ), 3, 3, 0, 3, Boolean.TRUE, Boolean.TRUE ); slot = SlotService.saveSlot( slot ); @@ -419,7 +419,7 @@ public void testRemoveAppointmentAndCheckNbRemainingPlaces( ) // Build the form int nIdForm = FormService.createAppointmentForm( FormServiceTest.buildAppointmentForm( ) ); - Slot slot = SlotTest.buildSlot( nIdForm, LocalDateTime.parse( "2018-12-03T10:00" ), LocalDateTime.parse( "2018-12-03T10:30" ), 1, 1, 0, 1, + Slot slot = SlotTest.buildSlot( nIdForm, LocalDateTime.parse( "2022-12-03T10:00" ), LocalDateTime.parse( "2022-12-03T10:30" ), 1, 1, 0, 1, Boolean.TRUE, Boolean.TRUE ); slot = SlotService.saveSlot( slot ); @@ -455,7 +455,7 @@ public void testRemoveAppointmentAndCheckNbRemainingPlaces2( ) // Build the form int nIdForm = FormService.createAppointmentForm( FormServiceTest.buildAppointmentForm( ) ); - Slot slot = SlotTest.buildSlot( nIdForm, LocalDateTime.parse( "2018-12-03T10:00" ), LocalDateTime.parse( "2018-12-03T10:30" ), 2, 2, 0, 2, + Slot slot = SlotTest.buildSlot( nIdForm, LocalDateTime.parse( "2022-12-03T10:00" ), LocalDateTime.parse( "2022-12-03T10:30" ), 2, 2, 0, 2, Boolean.TRUE, Boolean.TRUE ); slot = SlotService.saveSlot( slot ); @@ -491,7 +491,7 @@ public void testRemoveAppointmentAndCheckNbRemainingPlaces3( ) // Build the form int nIdForm = FormService.createAppointmentForm( FormServiceTest.buildAppointmentForm( ) ); - Slot slot = SlotTest.buildSlot( nIdForm, LocalDateTime.parse( "2018-12-03T10:00" ), LocalDateTime.parse( "2018-12-03T10:30" ), 2, 2, 0, 2, + Slot slot = SlotTest.buildSlot( nIdForm, LocalDateTime.parse( "2022-12-03T10:00" ), LocalDateTime.parse( "2022-12-03T10:30" ), 2, 2, 0, 2, Boolean.TRUE, Boolean.TRUE ); slot = SlotService.saveSlot( slot ); @@ -538,7 +538,7 @@ public void testRemoveAppointmentAndCheckNbRemainingPlaces4( ) // Build the form int nIdForm = FormService.createAppointmentForm( FormServiceTest.buildAppointmentForm( ) ); - Slot slot = SlotTest.buildSlot( nIdForm, LocalDateTime.parse( "2018-12-03T10:00" ), LocalDateTime.parse( "2018-12-03T10:30" ), 3, 3, 0, 3, + Slot slot = SlotTest.buildSlot( nIdForm, LocalDateTime.parse( "2022-12-03T10:00" ), LocalDateTime.parse( "2022-12-03T10:30" ), 3, 3, 0, 3, Boolean.TRUE, Boolean.TRUE ); slot = SlotService.saveSlot( slot ); @@ -585,7 +585,7 @@ public void testCancelAppointment( ) // Build the form int nIdForm = FormService.createAppointmentForm( FormServiceTest.buildAppointmentForm( ) ); - Slot slot = SlotTest.buildSlot( nIdForm, LocalDateTime.parse( "2018-12-03T10:00" ), LocalDateTime.parse( "2018-12-03T10:30" ), 2, 2, 0, 2, + Slot slot = SlotTest.buildSlot( nIdForm, LocalDateTime.parse( "2022-12-03T10:00" ), LocalDateTime.parse( "2022-12-03T10:30" ), 2, 2, 0, 2, Boolean.TRUE, Boolean.TRUE ); slot = SlotService.saveSlot( slot ); @@ -624,7 +624,7 @@ public void testCancelAppointment2( ) // Build the form int nIdForm = FormService.createAppointmentForm( FormServiceTest.buildAppointmentForm( ) ); - Slot slot = SlotTest.buildSlot( nIdForm, LocalDateTime.parse( "2018-12-03T10:00" ), LocalDateTime.parse( "2018-12-03T10:30" ), 2, 2, 0, 2, + Slot slot = SlotTest.buildSlot( nIdForm, LocalDateTime.parse( "2022-12-03T10:00" ), LocalDateTime.parse( "2022-12-03T10:30" ), 2, 2, 0, 2, Boolean.TRUE, Boolean.TRUE ); slot = SlotService.saveSlot( slot ); @@ -674,7 +674,7 @@ public void testCancelAppointment3( ) // Build the form int nIdForm = FormService.createAppointmentForm( FormServiceTest.buildAppointmentForm( ) ); - Slot slot = SlotTest.buildSlot( nIdForm, LocalDateTime.parse( "2018-12-03T10:00" ), LocalDateTime.parse( "2018-12-03T10:30" ), 3, 3, 0, 3, + Slot slot = SlotTest.buildSlot( nIdForm, LocalDateTime.parse( "2022-12-03T10:00" ), LocalDateTime.parse( "2022-12-03T10:30" ), 3, 3, 0, 3, Boolean.TRUE, Boolean.TRUE ); slot = SlotService.saveSlot( slot ); diff --git a/src/test/java/fr/paris/lutece/plugins/appointment/service/AppointmentUtilitiesTest.java b/src/test/java/fr/paris/lutece/plugins/appointment/service/AppointmentUtilitiesTest.java index b784c3601..ed7b73dbe 100644 --- a/src/test/java/fr/paris/lutece/plugins/appointment/service/AppointmentUtilitiesTest.java +++ b/src/test/java/fr/paris/lutece/plugins/appointment/service/AppointmentUtilitiesTest.java @@ -37,15 +37,15 @@ public class AppointmentUtilitiesTest extends LuteceTestCase public void testNbDaysBetweenTwoAppointments( ) { AppointmentFormDTO appointmentForm = FormServiceTest.buildAppointmentForm( ); - appointmentForm.setDateStartValidity( Date.valueOf( LocalDate.parse( "2018-06-04" ) ) ); - appointmentForm.setDateEndValidity( Date.valueOf( LocalDate.parse( "2018-06-30" ) ) ); + appointmentForm.setDateStartValidity( Date.valueOf( LocalDate.parse( "2022-06-04" ) ) ); + appointmentForm.setDateEndValidity( Date.valueOf( LocalDate.parse( "2022-06-30" ) ) ); appointmentForm.setNbDaysBeforeNewAppointment( 2 ); // Build the form int nIdForm = FormService.createAppointmentForm( FormServiceTest.buildAppointmentForm( ) ); appointmentForm.setIdForm( nIdForm ); - Slot slot1 = SlotTest.buildSlot( nIdForm, LocalDateTime.parse( "2018-06-04T10:00" ), LocalDateTime.parse( "2018-06-04T10:30" ), 3, 3, 0, 3, + Slot slot1 = SlotTest.buildSlot( nIdForm, LocalDateTime.parse( "2022-06-04T10:00" ), LocalDateTime.parse( "2022-06-04T10:30" ), 3, 3, 0, 3, Boolean.TRUE, Boolean.TRUE ); slot1 = SlotService.saveSlot( slot1 ); @@ -60,7 +60,7 @@ public void testNbDaysBetweenTwoAppointments( ) fail( e.getLocalizedMessage( ) ); } - Slot slot2 = SlotTest.buildSlot( nIdForm, LocalDateTime.parse( "2018-06-05T10:00" ), LocalDateTime.parse( "2018-06-05T10:30" ), 3, 3, 0, 3, + Slot slot2 = SlotTest.buildSlot( nIdForm, LocalDateTime.parse( "2022-06-05T10:00" ), LocalDateTime.parse( "2022-06-05T10:30" ), 3, 3, 0, 3, Boolean.TRUE, Boolean.TRUE ); slot2 = SlotService.saveSlot( slot2 ); @@ -79,15 +79,15 @@ public void testNbDaysBetweenTwoAppointments( ) public void testNbDaysBetweenTwoAppointments2( ) { AppointmentFormDTO appointmentForm = FormServiceTest.buildAppointmentForm( ); - appointmentForm.setDateStartValidity( Date.valueOf( LocalDate.parse( "2018-06-04" ) ) ); - appointmentForm.setDateEndValidity( Date.valueOf( LocalDate.parse( "2018-06-30" ) ) ); + appointmentForm.setDateStartValidity( Date.valueOf( LocalDate.parse( "2022-06-04" ) ) ); + appointmentForm.setDateEndValidity( Date.valueOf( LocalDate.parse( "2022-06-30" ) ) ); appointmentForm.setNbDaysBeforeNewAppointment( 2 ); // Build the form int nIdForm = FormService.createAppointmentForm( FormServiceTest.buildAppointmentForm( ) ); appointmentForm.setIdForm( nIdForm ); - Slot slot1 = SlotTest.buildSlot( nIdForm, LocalDateTime.parse( "2018-06-04T10:00" ), LocalDateTime.parse( "2018-06-04T10:30" ), 3, 3, 0, 3, + Slot slot1 = SlotTest.buildSlot( nIdForm, LocalDateTime.parse( "2022-06-04T10:00" ), LocalDateTime.parse( "2022-06-04T10:30" ), 3, 3, 0, 3, Boolean.TRUE, Boolean.TRUE ); slot1 = SlotService.saveSlot( slot1 ); @@ -102,7 +102,7 @@ public void testNbDaysBetweenTwoAppointments2( ) fail( e.getLocalizedMessage( ) ); } - Slot slot2 = SlotTest.buildSlot( nIdForm, LocalDateTime.parse( "2018-06-15T10:00" ), LocalDateTime.parse( "2018-06-15T10:30" ), 3, 3, 0, 3, + Slot slot2 = SlotTest.buildSlot( nIdForm, LocalDateTime.parse( "2022-06-15T10:00" ), LocalDateTime.parse( "2022-06-15T10:30" ), 3, 3, 0, 3, Boolean.TRUE, Boolean.TRUE ); slot2 = SlotService.saveSlot( slot2 ); @@ -121,15 +121,15 @@ public void testNbDaysBetweenTwoAppointments2( ) public void testNbDaysBetweenTwoAppointments3( ) { AppointmentFormDTO appointmentForm = FormServiceTest.buildAppointmentForm( ); - appointmentForm.setDateStartValidity( Date.valueOf( LocalDate.parse( "2018-06-04" ) ) ); - appointmentForm.setDateEndValidity( Date.valueOf( LocalDate.parse( "2018-06-30" ) ) ); + appointmentForm.setDateStartValidity( Date.valueOf( LocalDate.parse( "2022-06-04" ) ) ); + appointmentForm.setDateEndValidity( Date.valueOf( LocalDate.parse( "2022-06-30" ) ) ); appointmentForm.setNbDaysBeforeNewAppointment( 2 ); // Build the form int nIdForm = FormService.createAppointmentForm( FormServiceTest.buildAppointmentForm( ) ); appointmentForm.setIdForm( nIdForm ); - Slot slot1 = SlotTest.buildSlot( nIdForm, LocalDateTime.parse( "2018-06-04T10:00" ), LocalDateTime.parse( "2018-06-04T10:30" ), 3, 3, 0, 3, + Slot slot1 = SlotTest.buildSlot( nIdForm, LocalDateTime.parse( "2022-06-04T10:00" ), LocalDateTime.parse( "2022-06-04T10:30" ), 3, 3, 0, 3, Boolean.TRUE, Boolean.TRUE ); slot1 = SlotService.saveSlot( slot1 ); @@ -144,7 +144,7 @@ public void testNbDaysBetweenTwoAppointments3( ) fail( e.getLocalizedMessage( ) ); } - Slot slot2 = SlotTest.buildSlot( nIdForm, LocalDateTime.parse( "2018-06-15T10:00" ), LocalDateTime.parse( "2018-06-15T10:30" ), 3, 3, 0, 3, + Slot slot2 = SlotTest.buildSlot( nIdForm, LocalDateTime.parse( "2022-06-15T10:00" ), LocalDateTime.parse( "2022-06-15T10:30" ), 3, 3, 0, 3, Boolean.TRUE, Boolean.TRUE ); slot2 = SlotService.saveSlot( slot2 ); @@ -159,7 +159,7 @@ public void testNbDaysBetweenTwoAppointments3( ) fail( e.getLocalizedMessage( ) ); } - Slot slot3 = SlotTest.buildSlot( nIdForm, LocalDateTime.parse( "2018-06-16T10:00" ), LocalDateTime.parse( "2018-06-16T10:30" ), 3, 3, 0, 3, + Slot slot3 = SlotTest.buildSlot( nIdForm, LocalDateTime.parse( "2022-06-16T10:00" ), LocalDateTime.parse( "2022-06-16T10:30" ), 3, 3, 0, 3, Boolean.TRUE, Boolean.TRUE ); slot3 = SlotService.saveSlot( slot3 ); @@ -178,15 +178,15 @@ public void testNbDaysBetweenTwoAppointments3( ) public void testNbDaysBetweenTwoAppointments4( ) { AppointmentFormDTO appointmentForm = FormServiceTest.buildAppointmentForm( ); - appointmentForm.setDateStartValidity( Date.valueOf( LocalDate.parse( "2018-06-04" ) ) ); - appointmentForm.setDateEndValidity( Date.valueOf( LocalDate.parse( "2018-06-30" ) ) ); + appointmentForm.setDateStartValidity( Date.valueOf( LocalDate.parse( "2022-06-04" ) ) ); + appointmentForm.setDateEndValidity( Date.valueOf( LocalDate.parse( "2022-06-30" ) ) ); appointmentForm.setNbDaysBeforeNewAppointment( 2 ); // Build the form int nIdForm = FormService.createAppointmentForm( FormServiceTest.buildAppointmentForm( ) ); appointmentForm.setIdForm( nIdForm ); - Slot slot1 = SlotTest.buildSlot( nIdForm, LocalDateTime.parse( "2018-06-04T10:00" ), LocalDateTime.parse( "2018-06-04T10:30" ), 3, 3, 0, 3, + Slot slot1 = SlotTest.buildSlot( nIdForm, LocalDateTime.parse( "2022-06-04T10:00" ), LocalDateTime.parse( "2022-06-04T10:30" ), 3, 3, 0, 3, Boolean.TRUE, Boolean.TRUE ); slot1 = SlotService.saveSlot( slot1 ); @@ -201,7 +201,7 @@ public void testNbDaysBetweenTwoAppointments4( ) fail( e.getLocalizedMessage( ) ); } - Slot slot2 = SlotTest.buildSlot( nIdForm, LocalDateTime.parse( "2018-06-15T10:00" ), LocalDateTime.parse( "2018-06-15T10:30" ), 3, 3, 0, 3, + Slot slot2 = SlotTest.buildSlot( nIdForm, LocalDateTime.parse( "2022-06-15T10:00" ), LocalDateTime.parse( "2022-06-15T10:30" ), 3, 3, 0, 3, Boolean.TRUE, Boolean.TRUE ); slot2 = SlotService.saveSlot( slot2 ); @@ -216,7 +216,7 @@ public void testNbDaysBetweenTwoAppointments4( ) fail( e.getLocalizedMessage( ) ); } - Slot slot3 = SlotTest.buildSlot( nIdForm, LocalDateTime.parse( "2018-06-07T10:00" ), LocalDateTime.parse( "2018-06-07T10:30" ), 3, 3, 0, 3, + Slot slot3 = SlotTest.buildSlot( nIdForm, LocalDateTime.parse( "2022-06-07T10:00" ), LocalDateTime.parse( "2022-06-07T10:30" ), 3, 3, 0, 3, Boolean.TRUE, Boolean.TRUE ); slot3 = SlotService.saveSlot( slot3 ); @@ -235,8 +235,8 @@ public void testNbDaysBetweenTwoAppointments4( ) public void testNbDaysBetweenTwoAppointments5( ) { AppointmentFormDTO appointmentForm = FormServiceTest.buildAppointmentForm( ); - appointmentForm.setDateStartValidity( Date.valueOf( LocalDate.parse( "2018-06-04" ) ) ); - appointmentForm.setDateEndValidity( Date.valueOf( LocalDate.parse( "2018-06-30" ) ) ); + appointmentForm.setDateStartValidity( Date.valueOf( LocalDate.parse( "2022-06-04" ) ) ); + appointmentForm.setDateEndValidity( Date.valueOf( LocalDate.parse( "2022-06-30" ) ) ); appointmentForm.setNbDaysBeforeNewAppointment( 2 ); @@ -244,7 +244,7 @@ public void testNbDaysBetweenTwoAppointments5( ) int nIdForm = FormService.createAppointmentForm( FormServiceTest.buildAppointmentForm( ) ); appointmentForm.setIdForm( nIdForm ); - Slot slot1 = SlotTest.buildSlot( nIdForm, LocalDateTime.parse( "2018-06-04T10:00" ), LocalDateTime.parse( "2018-06-04T10:30" ), 3, 3, 0, 3, + Slot slot1 = SlotTest.buildSlot( nIdForm, LocalDateTime.parse( "2022-06-04T10:00" ), LocalDateTime.parse( "2022-06-04T10:30" ), 3, 3, 0, 3, Boolean.TRUE, Boolean.TRUE ); slot1 = SlotService.saveSlot( slot1 ); @@ -259,7 +259,7 @@ public void testNbDaysBetweenTwoAppointments5( ) fail( e.getLocalizedMessage( ) ); } - Slot slot2 = SlotTest.buildSlot( nIdForm, LocalDateTime.parse( "2018-06-15T10:00" ), LocalDateTime.parse( "2018-06-15T10:30" ), 3, 3, 0, 3, + Slot slot2 = SlotTest.buildSlot( nIdForm, LocalDateTime.parse( "2022-06-15T10:00" ), LocalDateTime.parse( "2022-06-15T10:30" ), 3, 3, 0, 3, Boolean.TRUE, Boolean.TRUE ); slot2 = SlotService.saveSlot( slot2 ); @@ -274,7 +274,7 @@ public void testNbDaysBetweenTwoAppointments5( ) fail( e.getLocalizedMessage( ) ); } - Slot slot3 = SlotTest.buildSlot( nIdForm, LocalDateTime.parse( "2018-06-14T10:00" ), LocalDateTime.parse( "2018-06-14T10:30" ), 3, 3, 0, 3, + Slot slot3 = SlotTest.buildSlot( nIdForm, LocalDateTime.parse( "2022-06-14T10:00" ), LocalDateTime.parse( "2022-06-14T10:30" ), 3, 3, 0, 3, Boolean.TRUE, Boolean.TRUE ); slot3 = SlotService.saveSlot( slot3 ); @@ -293,15 +293,15 @@ public void testNbDaysBetweenTwoAppointments5( ) public void testCheckNbMaxAppointmentsOnAGivenPeriod( ) { AppointmentFormDTO appointmentForm = FormServiceTest.buildAppointmentForm( ); - appointmentForm.setDateStartValidity( Date.valueOf( LocalDate.parse( "2018-06-04" ) ) ); - appointmentForm.setDateEndValidity( Date.valueOf( LocalDate.parse( "2018-06-30" ) ) ); + appointmentForm.setDateStartValidity( Date.valueOf( LocalDate.parse( "2022-06-04" ) ) ); + appointmentForm.setDateEndValidity( Date.valueOf( LocalDate.parse( "2022-06-30" ) ) ); appointmentForm.setNbMaxAppointmentsPerUser( 2 ); appointmentForm.setNbDaysForMaxAppointmentsPerUser( 7 ); // Build the form int nIdForm = FormService.createAppointmentForm( FormServiceTest.buildAppointmentForm( ) ); appointmentForm.setIdForm( nIdForm ); - Slot slot1 = SlotTest.buildSlot( nIdForm, LocalDateTime.parse( "2018-06-04T10:00" ), LocalDateTime.parse( "2018-06-04T10:30" ), 3, 3, 0, 3, + Slot slot1 = SlotTest.buildSlot( nIdForm, LocalDateTime.parse( "2022-06-04T10:00" ), LocalDateTime.parse( "2022-06-04T10:30" ), 3, 3, 0, 3, Boolean.TRUE, Boolean.TRUE ); slot1 = SlotService.saveSlot( slot1 ); @@ -316,7 +316,7 @@ public void testCheckNbMaxAppointmentsOnAGivenPeriod( ) fail( e.getLocalizedMessage( ) ); } - Slot slot2 = SlotTest.buildSlot( nIdForm, LocalDateTime.parse( "2018-06-05T10:00" ), LocalDateTime.parse( "2018-06-05T10:30" ), 3, 3, 0, 3, + Slot slot2 = SlotTest.buildSlot( nIdForm, LocalDateTime.parse( "2022-06-05T10:00" ), LocalDateTime.parse( "2022-06-05T10:30" ), 3, 3, 0, 3, Boolean.TRUE, Boolean.TRUE ); slot2 = SlotService.saveSlot( slot2 ); @@ -331,7 +331,7 @@ public void testCheckNbMaxAppointmentsOnAGivenPeriod( ) fail( e.getLocalizedMessage( ) ); } - Slot slot3 = SlotTest.buildSlot( nIdForm, LocalDateTime.parse( "2018-06-07T10:00" ), LocalDateTime.parse( "2018-06-07T10:30" ), 3, 3, 0, 3, + Slot slot3 = SlotTest.buildSlot( nIdForm, LocalDateTime.parse( "2022-06-07T10:00" ), LocalDateTime.parse( "2022-06-07T10:30" ), 3, 3, 0, 3, Boolean.TRUE, Boolean.TRUE ); slot3 = SlotService.saveSlot( slot3 ); @@ -349,15 +349,15 @@ public void testCheckNbMaxAppointmentsOnAGivenPeriod( ) public void testCheckNbMaxAppointmentsOnAGivenPeriod2( ) { AppointmentFormDTO appointmentForm = FormServiceTest.buildAppointmentForm( ); - appointmentForm.setDateStartValidity( Date.valueOf( LocalDate.parse( "2018-06-04" ) ) ); - appointmentForm.setDateEndValidity( Date.valueOf( LocalDate.parse( "2018-06-30" ) ) ); + appointmentForm.setDateStartValidity( Date.valueOf( LocalDate.parse( "2022-06-04" ) ) ); + appointmentForm.setDateEndValidity( Date.valueOf( LocalDate.parse( "2022-06-30" ) ) ); appointmentForm.setNbMaxAppointmentsPerUser( 3 ); appointmentForm.setNbDaysForMaxAppointmentsPerUser( 7 ); // Build the form int nIdForm = FormService.createAppointmentForm( FormServiceTest.buildAppointmentForm( ) ); appointmentForm.setIdForm( nIdForm ); - Slot slot1 = SlotTest.buildSlot( nIdForm, LocalDateTime.parse( "2018-06-04T10:00" ), LocalDateTime.parse( "2018-06-04T10:30" ), 3, 3, 0, 3, + Slot slot1 = SlotTest.buildSlot( nIdForm, LocalDateTime.parse( "2022-06-04T10:00" ), LocalDateTime.parse( "2022-06-04T10:30" ), 3, 3, 0, 3, Boolean.TRUE, Boolean.TRUE ); slot1 = SlotService.saveSlot( slot1 ); @@ -372,7 +372,7 @@ public void testCheckNbMaxAppointmentsOnAGivenPeriod2( ) fail( e.getLocalizedMessage( ) ); } - Slot slot2 = SlotTest.buildSlot( nIdForm, LocalDateTime.parse( "2018-06-05T10:00" ), LocalDateTime.parse( "2018-06-05T10:30" ), 3, 3, 0, 3, + Slot slot2 = SlotTest.buildSlot( nIdForm, LocalDateTime.parse( "2022-06-05T10:00" ), LocalDateTime.parse( "2022-06-05T10:30" ), 3, 3, 0, 3, Boolean.TRUE, Boolean.TRUE ); slot2 = SlotService.saveSlot( slot2 ); @@ -387,7 +387,7 @@ public void testCheckNbMaxAppointmentsOnAGivenPeriod2( ) fail( e.getLocalizedMessage( ) ); } - Slot slot3 = SlotTest.buildSlot( nIdForm, LocalDateTime.parse( "2018-06-07T10:00" ), LocalDateTime.parse( "2018-06-07T10:30" ), 3, 3, 0, 3, + Slot slot3 = SlotTest.buildSlot( nIdForm, LocalDateTime.parse( "2022-06-07T10:00" ), LocalDateTime.parse( "2022-06-07T10:30" ), 3, 3, 0, 3, Boolean.TRUE, Boolean.TRUE ); slot3 = SlotService.saveSlot( slot3 ); @@ -405,15 +405,15 @@ public void testCheckNbMaxAppointmentsOnAGivenPeriod2( ) public void testCheckAndReturnNbBookedSeats( ) { AppointmentFormDTO appointmentForm = FormServiceTest.buildAppointmentForm( ); - appointmentForm.setDateStartValidity( Date.valueOf( LocalDate.parse( "2018-06-04" ) ) ); - appointmentForm.setDateEndValidity( Date.valueOf( LocalDate.parse( "2018-06-30" ) ) ); + appointmentForm.setDateStartValidity( Date.valueOf( LocalDate.parse( "2022-06-04" ) ) ); + appointmentForm.setDateEndValidity( Date.valueOf( LocalDate.parse( "2022-06-30" ) ) ); appointmentForm.setMaxPeoplePerAppointment( 2 ); appointmentForm.setMaxCapacityPerSlot( 3 ); // Build the form int nIdForm = FormService.createAppointmentForm( FormServiceTest.buildAppointmentForm( ) ); appointmentForm.setIdForm( nIdForm ); - Slot slot1 = SlotTest.buildSlot( nIdForm, LocalDateTime.parse( "2018-06-04T10:00" ), LocalDateTime.parse( "2018-06-04T10:30" ), 3, 3, 0, 3, + Slot slot1 = SlotTest.buildSlot( nIdForm, LocalDateTime.parse( "2022-06-04T10:00" ), LocalDateTime.parse( "2022-06-04T10:30" ), 3, 3, 0, 3, Boolean.TRUE, Boolean.TRUE ); slot1 = SlotService.saveSlot( slot1 ); @@ -445,15 +445,15 @@ public void testCheckAndReturnNbBookedSeats( ) public void testCheckAndReturnNbBookedSeats2( ) { AppointmentFormDTO appointmentForm = FormServiceTest.buildAppointmentForm( ); - appointmentForm.setDateStartValidity( Date.valueOf( LocalDate.parse( "2018-06-04" ) ) ); - appointmentForm.setDateEndValidity( Date.valueOf( LocalDate.parse( "2018-06-30" ) ) ); + appointmentForm.setDateStartValidity( Date.valueOf( LocalDate.parse( "2022-06-04" ) ) ); + appointmentForm.setDateEndValidity( Date.valueOf( LocalDate.parse( "2022-06-30" ) ) ); appointmentForm.setMaxPeoplePerAppointment( 2 ); appointmentForm.setMaxCapacityPerSlot( 3 ); // Build the form int nIdForm = FormService.createAppointmentForm( FormServiceTest.buildAppointmentForm( ) ); appointmentForm.setIdForm( nIdForm ); - Slot slot1 = SlotTest.buildSlot( nIdForm, LocalDateTime.parse( "2018-06-04T10:00" ), LocalDateTime.parse( "2018-06-04T10:30" ), 3, 3, 0, 3, + Slot slot1 = SlotTest.buildSlot( nIdForm, LocalDateTime.parse( "2022-06-04T10:00" ), LocalDateTime.parse( "2022-06-04T10:30" ), 3, 3, 0, 3, Boolean.TRUE, Boolean.TRUE ); slot1 = SlotService.saveSlot( slot1 ); @@ -503,12 +503,12 @@ public void testGetMaxTimeToDisplay( ) public void testCheckNoAppointmentsImpacted( ) { AppointmentFormDTO appointmentForm1 = FormServiceTest.buildAppointmentForm( ); - appointmentForm1.setDateStartValidity( Date.valueOf( LocalDate.parse( "2018-06-04" ) ) ); - appointmentForm1.setDateEndValidity( Date.valueOf( LocalDate.parse( "2018-06-30" ) ) ); + appointmentForm1.setDateStartValidity( Date.valueOf( LocalDate.parse( "2022-06-04" ) ) ); + appointmentForm1.setDateEndValidity( Date.valueOf( LocalDate.parse( "2022-06-30" ) ) ); // Build the form int nIdForm = FormService.createAppointmentForm( FormServiceTest.buildAppointmentForm( ) ); appointmentForm1.setIdForm( nIdForm ); - Slot slot1 = SlotTest.buildSlot( nIdForm, LocalDateTime.parse( "2018-06-25T10:00" ), LocalDateTime.parse( "2018-06-25T10:30" ), 3, 3, 0, 3, + Slot slot1 = SlotTest.buildSlot( nIdForm, LocalDateTime.parse( "2022-06-25T10:00" ), LocalDateTime.parse( "2022-06-25T10:30" ), 3, 3, 0, 3, Boolean.TRUE, Boolean.TRUE ); slot1 = SlotService.saveSlot( slot1 ); @@ -524,7 +524,7 @@ public void testCheckNoAppointmentsImpacted( ) fail( e.getLocalizedMessage( ) ); } - Slot slot2 = SlotTest.buildSlot( nIdForm, LocalDateTime.parse( "2018-06-26T17:00" ), LocalDateTime.parse( "2018-06-26T17:30" ), 3, 3, 0, 3, + Slot slot2 = SlotTest.buildSlot( nIdForm, LocalDateTime.parse( "2022-06-26T17:00" ), LocalDateTime.parse( "2022-06-26T17:30" ), 3, 3, 0, 3, Boolean.TRUE, Boolean.TRUE ); slot2 = SlotService.saveSlot( slot2 ); @@ -540,8 +540,8 @@ public void testCheckNoAppointmentsImpacted( ) } AppointmentFormDTO appointmentForm2 = FormServiceTest.buildAppointmentForm( ); - appointmentForm2.setDateStartValidity( Date.valueOf( LocalDate.parse( "2018-06-04" ) ) ); - appointmentForm2.setDateEndValidity( Date.valueOf( LocalDate.parse( "2018-06-30" ) ) ); + appointmentForm2.setDateStartValidity( Date.valueOf( LocalDate.parse( "2022-06-04" ) ) ); + appointmentForm2.setDateEndValidity( Date.valueOf( LocalDate.parse( "2022-06-30" ) ) ); appointmentForm2.setIsOpenMonday( Boolean.FALSE ); appointmentForm2.setIsOpenTuesday( Boolean.TRUE ); appointmentForm2.setIsOpenWednesday( Boolean.TRUE ); @@ -550,7 +550,7 @@ public void testCheckNoAppointmentsImpacted( ) appointmentForm2.setIsOpenSaturday( Boolean.FALSE ); appointmentForm2.setIsOpenSunday( Boolean.FALSE ); - LocalDate dateOfModification = LocalDate.parse( "2018-06-20" ); + LocalDate dateOfModification = LocalDate.parse( "2022-06-20" ); LocalDateTime endingDateTimeOfSearch = LocalDateTime.of( LocalDate.of( 9999, 12, 31 ), LocalTime.of( 23, 59 ) ); List listSlotsImpacted = SlotService.findSlotsByIdFormAndDateRange( nIdForm, dateOfModification.atStartOfDay( ), endingDateTimeOfSearch ); List listAppointmentsImpacted = AppointmentService.findListAppointmentByListSlot( listSlotsImpacted ); @@ -563,12 +563,12 @@ public void testCheckNoAppointmentsImpacted( ) public void testCheckNoAppointmentsImpacted2( ) { AppointmentFormDTO appointmentForm = FormServiceTest.buildAppointmentForm( ); - appointmentForm.setDateStartValidity( Date.valueOf( LocalDate.parse( "2018-06-04" ) ) ); - appointmentForm.setDateEndValidity( Date.valueOf( LocalDate.parse( "2018-06-30" ) ) ); + appointmentForm.setDateStartValidity( Date.valueOf( LocalDate.parse( "2022-06-04" ) ) ); + appointmentForm.setDateEndValidity( Date.valueOf( LocalDate.parse( "2022-06-30" ) ) ); // Build the form int nIdForm = FormService.createAppointmentForm( FormServiceTest.buildAppointmentForm( ) ); appointmentForm.setIdForm( nIdForm ); - Slot slot1 = SlotTest.buildSlot( nIdForm, LocalDateTime.parse( "2018-06-24T10:00" ), LocalDateTime.parse( "2018-06-24T10:30" ), 3, 3, 0, 3, + Slot slot1 = SlotTest.buildSlot( nIdForm, LocalDateTime.parse( "2022-06-24T10:00" ), LocalDateTime.parse( "2022-06-24T10:30" ), 3, 3, 0, 3, Boolean.TRUE, Boolean.TRUE ); slot1 = SlotService.saveSlot( slot1 ); @@ -583,7 +583,7 @@ public void testCheckNoAppointmentsImpacted2( ) fail( e.getLocalizedMessage( ) ); } - Slot slot2 = SlotTest.buildSlot( nIdForm, LocalDateTime.parse( "2018-06-25T10:00" ), LocalDateTime.parse( "2018-06-25T10:30" ), 3, 3, 0, 3, + Slot slot2 = SlotTest.buildSlot( nIdForm, LocalDateTime.parse( "2022-06-25T10:00" ), LocalDateTime.parse( "2022-06-25T10:30" ), 3, 3, 0, 3, Boolean.TRUE, Boolean.TRUE ); slot2 = SlotService.saveSlot( slot2 ); @@ -599,8 +599,8 @@ public void testCheckNoAppointmentsImpacted2( ) } AppointmentFormDTO appointmentForm2 = FormServiceTest.buildAppointmentForm( ); - appointmentForm2.setDateStartValidity( Date.valueOf( LocalDate.parse( "2018-06-04" ) ) ); - appointmentForm2.setDateEndValidity( Date.valueOf( LocalDate.parse( "2018-06-30" ) ) ); + appointmentForm2.setDateStartValidity( Date.valueOf( LocalDate.parse( "2022-06-04" ) ) ); + appointmentForm2.setDateEndValidity( Date.valueOf( LocalDate.parse( "2022-06-30" ) ) ); appointmentForm2.setIsOpenMonday( Boolean.FALSE ); appointmentForm2.setIsOpenTuesday( Boolean.TRUE ); appointmentForm2.setIsOpenWednesday( Boolean.TRUE ); @@ -609,7 +609,7 @@ public void testCheckNoAppointmentsImpacted2( ) appointmentForm2.setIsOpenSaturday( Boolean.FALSE ); appointmentForm2.setIsOpenSunday( Boolean.FALSE ); - LocalDate dateOfModification = LocalDate.parse( "2018-06-26" ); + LocalDate dateOfModification = LocalDate.parse( "2022-06-26" ); LocalDateTime endingDateTimeOfSearch = LocalDateTime.of( LocalDate.of( 9999, 12, 31 ), LocalTime.of( 23, 59 ) ); List listSlotsImpacted = SlotService.findSlotsByIdFormAndDateRange( nIdForm, dateOfModification.atStartOfDay( ), endingDateTimeOfSearch ); List listAppointmentsImpacted = AppointmentService.findListAppointmentByListSlot( listSlotsImpacted ); @@ -625,13 +625,13 @@ public void testCheckNoAppointmentsImpacted2( ) public void testCheckNoValidatedAppointmentsOnThisSlot( ) { AppointmentFormDTO appointmentForm = FormServiceTest.buildAppointmentForm( ); - appointmentForm.setDateStartValidity( Date.valueOf( LocalDate.parse( "2018-06-04" ) ) ); - appointmentForm.setDateEndValidity( Date.valueOf( LocalDate.parse( "2018-06-30" ) ) ); + appointmentForm.setDateStartValidity( Date.valueOf( LocalDate.parse( "2022-06-04" ) ) ); + appointmentForm.setDateEndValidity( Date.valueOf( LocalDate.parse( "2022-06-30" ) ) ); // Build the form int nIdForm = FormService.createAppointmentForm( FormServiceTest.buildAppointmentForm( ) ); appointmentForm.setIdForm( nIdForm ); - Slot slot1 = SlotTest.buildSlot( nIdForm, LocalDateTime.parse( "2018-06-25T10:00" ), LocalDateTime.parse( "2018-06-25T10:30" ), 3, 3, 0, 3, + Slot slot1 = SlotTest.buildSlot( nIdForm, LocalDateTime.parse( "2022-06-25T10:00" ), LocalDateTime.parse( "2022-06-25T10:30" ), 3, 3, 0, 3, Boolean.TRUE, Boolean.TRUE ); slot1 = SlotService.saveSlot( slot1 ); @@ -657,13 +657,13 @@ public void testCheckNoValidatedAppointmentsOnThisSlot( ) public void testCheckNoValidatedAppointmentsOnThisSlot2( ) { AppointmentFormDTO appointmentForm = FormServiceTest.buildAppointmentForm( ); - appointmentForm.setDateStartValidity( Date.valueOf( LocalDate.parse( "2018-06-04" ) ) ); - appointmentForm.setDateEndValidity( Date.valueOf( LocalDate.parse( "2018-06-30" ) ) ); + appointmentForm.setDateStartValidity( Date.valueOf( LocalDate.parse( "2022-06-04" ) ) ); + appointmentForm.setDateEndValidity( Date.valueOf( LocalDate.parse( "2022-06-30" ) ) ); // Build the form int nIdForm = FormService.createAppointmentForm( FormServiceTest.buildAppointmentForm( ) ); appointmentForm.setIdForm( nIdForm ); - Slot slot1 = SlotTest.buildSlot( nIdForm, LocalDateTime.parse( "2018-06-25T10:00" ), LocalDateTime.parse( "2018-06-25T10:30" ), 3, 3, 0, 3, + Slot slot1 = SlotTest.buildSlot( nIdForm, LocalDateTime.parse( "2022-06-25T10:00" ), LocalDateTime.parse( "2022-06-25T10:30" ), 3, 3, 0, 3, Boolean.TRUE, Boolean.TRUE ); slot1 = SlotService.saveSlot( slot1 ); @@ -693,7 +693,7 @@ public void testCheckNoValidatedAppointmentsOnThisSlot2( ) public void testFindSlotsImpactedByThisTimeSlot( ) { AppointmentFormDTO appointmentForm = FormServiceTest.buildAppointmentForm( ); - appointmentForm.setDateStartValidity( Date.valueOf( LocalDate.parse( "2018-06-04" ) ) ); + appointmentForm.setDateStartValidity( Date.valueOf( LocalDate.parse( "2022-06-04" ) ) ); appointmentForm.setDateEndValidity( Date.valueOf( LocalDate.parse( "2025-06-30" ) ) ); // Build the form int nIdForm = FormService.createAppointmentForm( FormServiceTest.buildAppointmentForm( ) ); diff --git a/src/test/java/fr/paris/lutece/plugins/appointment/service/ClosingDayServiceTest.java b/src/test/java/fr/paris/lutece/plugins/appointment/service/ClosingDayServiceTest.java index fac6474fa..26ef123f3 100644 --- a/src/test/java/fr/paris/lutece/plugins/appointment/service/ClosingDayServiceTest.java +++ b/src/test/java/fr/paris/lutece/plugins/appointment/service/ClosingDayServiceTest.java @@ -17,14 +17,14 @@ public void testFindListDateOfClosingDayByIdFormAndDateRange( ) // Build the form int nIdForm = FormService.createAppointmentForm( FormServiceTest.buildAppointmentForm( ) ); List listClosingDays = new ArrayList<>( ); - listClosingDays.add( LocalDate.parse( "2018-05-01" ) ); - listClosingDays.add( LocalDate.parse( "2018-05-08" ) ); - listClosingDays.add( LocalDate.parse( "2018-07-14" ) ); - listClosingDays.add( LocalDate.parse( "2018-08-15" ) ); + listClosingDays.add( LocalDate.parse( "2022-05-01" ) ); + listClosingDays.add( LocalDate.parse( "2022-05-08" ) ); + listClosingDays.add( LocalDate.parse( "2022-07-14" ) ); + listClosingDays.add( LocalDate.parse( "2022-08-15" ) ); ClosingDayService.saveListClosingDay( nIdForm, listClosingDays ); - List listClosingDaysFound = ClosingDayService.findListDateOfClosingDayByIdFormAndDateRange( nIdForm, LocalDate.parse( "2018-06-01" ), - LocalDate.parse( "2018-09-01" ) ); + List listClosingDaysFound = ClosingDayService.findListDateOfClosingDayByIdFormAndDateRange( nIdForm, LocalDate.parse( "2022-06-01" ), + LocalDate.parse( "2022-09-01" ) ); assertEquals( 2, listClosingDaysFound.size( ) ); FormService.removeForm( nIdForm ); diff --git a/src/test/java/fr/paris/lutece/plugins/appointment/service/SlotServiceTest.java b/src/test/java/fr/paris/lutece/plugins/appointment/service/SlotServiceTest.java index 07254dd04..cc9f1ddd5 100644 --- a/src/test/java/fr/paris/lutece/plugins/appointment/service/SlotServiceTest.java +++ b/src/test/java/fr/paris/lutece/plugins/appointment/service/SlotServiceTest.java @@ -19,15 +19,15 @@ public class SlotServiceTest extends LuteceTestCase { - // Check that there are 180 open slots from the 3/12/2018 to the 14/12/2018 + // Check that there are 180 open slots from the 3/12/2022 to the 14/12/2022 // With open days from Monday to Friday public void testOpenSlots( ) { // Build the form AppointmentFormDTO appointmentForm = FormServiceTest.buildAppointmentForm( ); - appointmentForm.setDateStartValidity( Date.valueOf( LocalDate.parse( "2018-12-01" ) ) ); - appointmentForm.setDateStartValidity( Date.valueOf( LocalDate.parse( "2018-12-31" ) ) ); + appointmentForm.setDateStartValidity( Date.valueOf( LocalDate.parse( "2022-12-01" ) ) ); + appointmentForm.setDateStartValidity( Date.valueOf( LocalDate.parse( "2022-12-31" ) ) ); appointmentForm.setIsOpenMonday( Boolean.TRUE ); appointmentForm.setIsOpenTuesday( Boolean.TRUE ); @@ -40,7 +40,7 @@ public void testOpenSlots( ) int nIdForm = FormService.createAppointmentForm( appointmentForm ); // Get all the week definitions HashMap mapWeekDefinition = WeekDefinitionService.findAllWeekDefinition( nIdForm ); - List listSlots = SlotService.buildListSlot( nIdForm, mapWeekDefinition, LocalDate.parse( "2018-12-03" ), LocalDate.parse( "2018-12-14" ) ); + List listSlots = SlotService.buildListSlot( nIdForm, mapWeekDefinition, LocalDate.parse( "2022-12-03" ), LocalDate.parse( "2022-12-14" ) ); assertEquals( 180, listSlots.stream( ).filter( s -> s.getIsOpen( ) ).collect( Collectors.toList( ) ).size( ) ); @@ -51,8 +51,8 @@ public void testOpenSlotsWithSpecificSlotsClosed( ) { // Build the form AppointmentFormDTO appointmentForm = FormServiceTest.buildAppointmentForm( ); - appointmentForm.setDateStartValidity( Date.valueOf( LocalDate.parse( "2018-12-01" ) ) ); - appointmentForm.setDateStartValidity( Date.valueOf( LocalDate.parse( "2018-12-31" ) ) ); + appointmentForm.setDateStartValidity( Date.valueOf( LocalDate.parse( "2022-12-01" ) ) ); + appointmentForm.setDateStartValidity( Date.valueOf( LocalDate.parse( "2022-12-31" ) ) ); appointmentForm.setIsOpenMonday( Boolean.TRUE ); appointmentForm.setIsOpenTuesday( Boolean.TRUE ); @@ -65,19 +65,19 @@ public void testOpenSlotsWithSpecificSlotsClosed( ) // Get all the week definitions HashMap mapWeekDefinition = WeekDefinitionService.findAllWeekDefinition( nIdForm ); - Slot slotSpecificClosed1 = SlotTest.buildSlot( nIdForm, LocalDateTime.parse( "2018-12-03T09:00" ), LocalDateTime.parse( "2018-12-03T09:30" ), 1, 1, 0, + Slot slotSpecificClosed1 = SlotTest.buildSlot( nIdForm, LocalDateTime.parse( "2022-12-03T09:00" ), LocalDateTime.parse( "2022-12-03T09:30" ), 1, 1, 0, 1, Boolean.FALSE, Boolean.TRUE ); slotSpecificClosed1 = SlotService.saveSlot( slotSpecificClosed1 ); - Slot slotSpecificClosed2 = SlotTest.buildSlot( nIdForm, LocalDateTime.parse( "2018-12-04T09:00" ), LocalDateTime.parse( "2018-12-04T09:30" ), 1, 1, 0, + Slot slotSpecificClosed2 = SlotTest.buildSlot( nIdForm, LocalDateTime.parse( "2022-12-04T09:00" ), LocalDateTime.parse( "2022-12-04T09:30" ), 1, 1, 0, 1, Boolean.FALSE, Boolean.TRUE ); slotSpecificClosed2 = SlotService.saveSlot( slotSpecificClosed2 ); - Slot slotSpecificClosed3 = SlotTest.buildSlot( nIdForm, LocalDateTime.parse( "2018-12-05T10:00" ), LocalDateTime.parse( "2018-12-04T10:30" ), 1, 1, 0, + Slot slotSpecificClosed3 = SlotTest.buildSlot( nIdForm, LocalDateTime.parse( "2022-12-05T10:00" ), LocalDateTime.parse( "2022-12-04T10:30" ), 1, 1, 0, 1, Boolean.FALSE, Boolean.TRUE ); slotSpecificClosed3 = SlotService.saveSlot( slotSpecificClosed3 ); - List listSlots = SlotService.buildListSlot( nIdForm, mapWeekDefinition, LocalDate.parse( "2018-12-03" ), LocalDate.parse( "2018-12-14" ) ); + List listSlots = SlotService.buildListSlot( nIdForm, mapWeekDefinition, LocalDate.parse( "2022-12-03" ), LocalDate.parse( "2022-12-14" ) ); assertEquals( 177, listSlots.stream( ).filter( s -> s.getIsOpen( ) ).collect( Collectors.toList( ) ).size( ) ); @@ -88,8 +88,8 @@ public void testOpenSlotsWithSpecificLargeSlots( ) { // Build the form AppointmentFormDTO appointmentForm = FormServiceTest.buildAppointmentForm( ); - appointmentForm.setDateStartValidity( Date.valueOf( LocalDate.parse( "2018-12-01" ) ) ); - appointmentForm.setDateStartValidity( Date.valueOf( LocalDate.parse( "2018-12-31" ) ) ); + appointmentForm.setDateStartValidity( Date.valueOf( LocalDate.parse( "2022-12-01" ) ) ); + appointmentForm.setDateStartValidity( Date.valueOf( LocalDate.parse( "2022-12-31" ) ) ); appointmentForm.setIsOpenMonday( Boolean.TRUE ); appointmentForm.setIsOpenTuesday( Boolean.TRUE ); @@ -102,15 +102,15 @@ public void testOpenSlotsWithSpecificLargeSlots( ) // Get all the week definitions HashMap mapWeekDefinition = WeekDefinitionService.findAllWeekDefinition( nIdForm ); - Slot slotSpecific1 = SlotTest.buildSlot( nIdForm, LocalDateTime.parse( "2018-12-03T09:00" ), LocalDateTime.parse( "2018-12-03T10:00" ), 1, 1, 0, 1, + Slot slotSpecific1 = SlotTest.buildSlot( nIdForm, LocalDateTime.parse( "2022-12-03T09:00" ), LocalDateTime.parse( "2022-12-03T10:00" ), 1, 1, 0, 1, Boolean.TRUE, Boolean.TRUE ); slotSpecific1 = SlotService.saveSlot( slotSpecific1 ); - Slot slotSpecific2 = SlotTest.buildSlot( nIdForm, LocalDateTime.parse( "2018-12-04T10:00" ), LocalDateTime.parse( "2018-12-04T11:30" ), 1, 1, 0, 1, + Slot slotSpecific2 = SlotTest.buildSlot( nIdForm, LocalDateTime.parse( "2022-12-04T10:00" ), LocalDateTime.parse( "2022-12-04T11:30" ), 1, 1, 0, 1, Boolean.TRUE, Boolean.TRUE ); slotSpecific2 = SlotService.saveSlot( slotSpecific2 ); - List listSlots = SlotService.buildListSlot( nIdForm, mapWeekDefinition, LocalDate.parse( "2018-12-03" ), LocalDate.parse( "2018-12-14" ) ); + List listSlots = SlotService.buildListSlot( nIdForm, mapWeekDefinition, LocalDate.parse( "2022-12-03" ), LocalDate.parse( "2022-12-14" ) ); assertEquals( 177, listSlots.stream( ).filter( s -> s.getIsOpen( ) ).collect( Collectors.toList( ) ).size( ) ); diff --git a/src/test/java/fr/paris/lutece/plugins/appointment/service/UtilitiesTest.java b/src/test/java/fr/paris/lutece/plugins/appointment/service/UtilitiesTest.java index 7a1b3ef19..07eba3e7b 100644 --- a/src/test/java/fr/paris/lutece/plugins/appointment/service/UtilitiesTest.java +++ b/src/test/java/fr/paris/lutece/plugins/appointment/service/UtilitiesTest.java @@ -19,15 +19,15 @@ public class UtilitiesTest extends LuteceTestCase @Test public void testGetClosestDateInPast( ) { - LocalDate localDate1 = LocalDate.parse( "2018-06-05" ); - LocalDate localDate2 = LocalDate.parse( "2018-06-10" ); - LocalDate localDate3 = LocalDate.parse( "2018-06-25" ); + LocalDate localDate1 = LocalDate.parse( "2022-06-05" ); + LocalDate localDate2 = LocalDate.parse( "2022-06-10" ); + LocalDate localDate3 = LocalDate.parse( "2022-06-25" ); List listDates = new ArrayList<>( ); listDates.add( localDate1 ); listDates.add( localDate2 ); listDates.add( localDate3 ); - assertEquals( localDate2, Utilities.getClosestDateInPast( listDates, LocalDate.parse( "2018-06-15" ) ) ); + assertEquals( localDate2, Utilities.getClosestDateInPast( listDates, LocalDate.parse( "2022-06-15" ) ) ); } /** @@ -36,15 +36,15 @@ public void testGetClosestDateInPast( ) @Test public void testGetClosestDateTimeInFuture( ) { - LocalDateTime localDateTime1 = LocalDateTime.parse( "2018-06-05T10:15" ); - LocalDateTime localDateTime2 = LocalDateTime.parse( "2018-06-10T10:30" ); - LocalDateTime localDateTime3 = LocalDateTime.parse( "2018-06-25T11:15" ); + LocalDateTime localDateTime1 = LocalDateTime.parse( "2022-06-05T10:15" ); + LocalDateTime localDateTime2 = LocalDateTime.parse( "2022-06-10T10:30" ); + LocalDateTime localDateTime3 = LocalDateTime.parse( "2022-06-25T11:15" ); List listDateTime = new ArrayList<>( ); listDateTime.add( localDateTime1 ); listDateTime.add( localDateTime2 ); listDateTime.add( localDateTime3 ); - assertEquals( localDateTime3, Utilities.getClosestDateTimeInFuture( listDateTime, LocalDateTime.parse( "2018-06-10T12:30" ) ) ); + assertEquals( localDateTime3, Utilities.getClosestDateTimeInFuture( listDateTime, LocalDateTime.parse( "2022-06-10T12:30" ) ) ); } /** @@ -58,16 +58,16 @@ public void testGetDateFormatter() { AppointmentPlugin.setPluginLocale( Locale.ENGLISH ); Utilities.resetDateFormatter(); DateTimeFormatter formatterEn = Utilities.getDateFormatter(); - LocalDateTime localDateTimeEn = LocalDateTime.parse( "2018-06-25T00:00" ); + LocalDateTime localDateTimeEn = LocalDateTime.parse( "2022-06-25T00:00" ); String strDateEn = localDateTimeEn.format(formatterEn); - assertEquals( "2018-06-25" , strDateEn ); + assertEquals( "2022-06-25" , strDateEn ); AppointmentPlugin.setPluginLocale( Locale.FRENCH ); Utilities.resetDateFormatter(); DateTimeFormatter formatterFr = Utilities.getDateFormatter(); - LocalDateTime localDateTimeFr = LocalDateTime.parse( "2018-06-25T00:00" ); + LocalDateTime localDateTimeFr = LocalDateTime.parse( "2022-06-25T00:00" ); String strDateFr = localDateTimeFr.format(formatterFr); - assertEquals( "2018-06-25" , strDateFr ); + assertEquals( "2022-06-25" , strDateFr ); } @@ -82,16 +82,16 @@ public void testGetTimeFormatter() { AppointmentPlugin.setPluginLocale( Locale.ENGLISH ); Utilities.resetTimeFormatter(); DateTimeFormatter formatterEn = Utilities.getTimeFormatter(); - LocalDateTime localDateTimeEn = LocalDateTime.parse( "2018-06-25T00:00" ); + LocalDateTime localDateTimeEn = LocalDateTime.parse( "2022-06-25T00:00" ); String strDateEn = localDateTimeEn.format(formatterEn); - assertEquals( "00:00" , strDateEn ); + assertEquals( "00:00:00" , strDateEn ); AppointmentPlugin.setPluginLocale( Locale.FRENCH ); Utilities.resetTimeFormatter(); DateTimeFormatter formatterFr = Utilities.getTimeFormatter(); - LocalDateTime localDateTimeFr = LocalDateTime.parse( "2018-06-25T00:00" ); + LocalDateTime localDateTimeFr = LocalDateTime.parse( "2022-06-25T00:00" ); String strDateFr = localDateTimeFr.format(formatterFr); - assertEquals( "00:00" , strDateFr ); + assertEquals( "00:00:00" , strDateFr ); } diff --git a/src/test/java/fr/paris/lutece/plugins/appointment/service/WorkingDayServiceTest.java b/src/test/java/fr/paris/lutece/plugins/appointment/service/WorkingDayServiceTest.java index 79423b3a6..62f276bf7 100644 --- a/src/test/java/fr/paris/lutece/plugins/appointment/service/WorkingDayServiceTest.java +++ b/src/test/java/fr/paris/lutece/plugins/appointment/service/WorkingDayServiceTest.java @@ -27,7 +27,7 @@ public void testGetMaxEndingTimeOfAListOfWorkingDay( ) AppointmentFormDTO appointmentForm2 = FormServiceTest.buildAppointmentForm( ); appointmentForm2.setIdForm( nIdForm ); appointmentForm2.setTimeEnd( "20:00" ); - LocalDate dateOfModification = LocalDate.parse( "2018-06-20" ); + LocalDate dateOfModification = LocalDate.parse( "2022-06-20" ); FormService.updateAdvancedParameters( appointmentForm2, dateOfModification ); List listWeekDefinition = WeekDefinitionService.findListWeekDefinition( nIdForm ); @@ -122,7 +122,7 @@ public void testGetMinStartingTimeOfAListOfWorkingDay( ) AppointmentFormDTO appointmentForm2 = FormServiceTest.buildAppointmentForm( ); appointmentForm2.setIdForm( nIdForm ); appointmentForm2.setTimeStart( "10:00" ); - LocalDate dateOfModification = LocalDate.parse( "2018-06-20" ); + LocalDate dateOfModification = LocalDate.parse( "2022-06-20" ); FormService.updateAdvancedParameters( appointmentForm2, dateOfModification ); List listWeekDefinition = WeekDefinitionService.findListWeekDefinition( nIdForm ); From aab27fe88eb5d04d5c3a49c57d861d0061808560 Mon Sep 17 00:00:00 2001 From: jrmartino Date: Tue, 27 Oct 2020 13:23:39 -0400 Subject: [PATCH 2/2] add a docker-compose.yml file for testing --- docker-compose.yml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 docker-compose.yml diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 000000000..e5983b8ea --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,19 @@ +version: '2' + +services: + mysql-test: + container_name: mysql-lutece-test + image: mysql:8 + env_file: .env + restart: always + # The native password plugin is required by the lutece container entrypoint script + command: mysqld --default-authentication-plugin=mysql_native_password --skip-mysqlx + ports: + - "3306:3306" + volumes: + - db:/var/lib/mysql + - ./.secrets/:/run/secrets/ + +volumes: + db: + driver: local