@@ -37,12 +37,12 @@ class FindByUuid {
3737 @ Test
3838 void happy_path () {
3939 // given
40- CampsiteEntity campsite = testDataGenerator .createCampsiteEntity ();
41- BookingEntity booking = testDataGenerator .createBookingEntity (campsite .getId ());
40+ CampsiteEntity campsiteEntity = testDataGenerator .createCampsiteEntity ();
41+ BookingEntity bookingEntity = testDataGenerator .createBookingEntity (campsiteEntity .getId ());
4242 // when
43- Optional <BookingEntity > result = classUnderTest .findByUuid (booking .getUuid ());
43+ Optional <BookingEntity > result = classUnderTest .findByUuid (bookingEntity .getUuid ());
4444 // then
45- assertThat (result ).hasValue (booking );
45+ assertThat (result ).hasValue (bookingEntity );
4646 }
4747 }
4848
@@ -53,14 +53,15 @@ class FindForDateRange {
5353 @ DisplayNamePrefix ("SE|-|----|-|--" )
5454 void given_booking_dates_before_range_start_date__then_no_booking_found () {
5555 // given
56- CampsiteEntity campsite = testDataGenerator .createCampsiteEntity ();
57- BookingEntity booking = testDataGenerator .createBookingEntity (campsite .getId (), 1 , 2 );
56+ CampsiteEntity campsiteEntity = testDataGenerator .createCampsiteEntity ();
57+ BookingEntity bookingEntity =
58+ testDataGenerator .createBookingEntity (campsiteEntity .getId (), 1 , 2 );
5859 // when
5960 List <BookingEntity > result =
6061 classUnderTest .findForDateRange (
61- booking .getStartDate ().plusDays (3 ),
62- booking .getStartDate ().plusDays (4 ),
63- campsite .getId ());
62+ bookingEntity .getStartDate ().plusDays (3 ),
63+ bookingEntity .getStartDate ().plusDays (4 ),
64+ campsiteEntity .getId ());
6465 // then
6566 assertThat (result ).isEmpty ();
6667 }
@@ -70,14 +71,15 @@ void given_booking_dates_before_range_start_date__then_no_booking_found() {
7071 void
7172 given_booking_start_date_before_range_start_date_and_booking_end_date_equals_to_range_start_date__then_no_booking_found () {
7273 // given
73- CampsiteEntity campsite = testDataGenerator .createCampsiteEntity ();
74- BookingEntity booking = testDataGenerator .createBookingEntity (campsite .getId (), 1 , 2 );
74+ CampsiteEntity campsiteEntity = testDataGenerator .createCampsiteEntity ();
75+ BookingEntity bookingEntity =
76+ testDataGenerator .createBookingEntity (campsiteEntity .getId (), 1 , 2 );
7577 // when
7678 List <BookingEntity > result =
7779 classUnderTest .findForDateRange (
78- booking .getStartDate ().plusDays (2 ),
79- booking .getStartDate ().plusDays (3 ),
80- campsite .getId ());
80+ bookingEntity .getStartDate ().plusDays (2 ),
81+ bookingEntity .getStartDate ().plusDays (3 ),
82+ campsiteEntity .getId ());
8183 // then
8284 assertThat (result ).isEmpty ();
8385 }
@@ -87,132 +89,140 @@ void given_booking_dates_before_range_start_date__then_no_booking_found() {
8789 void
8890 given_booking_start_date_before_range_start_date_and_booking_end_date_within_range_dates__then_booking_found () {
8991 // given
90- CampsiteEntity campsite = testDataGenerator .createCampsiteEntity ();
91- BookingEntity booking = testDataGenerator .createBookingEntity (campsite .getId (), 1 , 3 );
92+ CampsiteEntity campsiteEntity = testDataGenerator .createCampsiteEntity ();
93+ BookingEntity bookingEntity =
94+ testDataGenerator .createBookingEntity (campsiteEntity .getId (), 1 , 3 );
9295 // when
9396 List <BookingEntity > result =
9497 classUnderTest .findForDateRange (
95- booking .getStartDate ().plusDays (2 ),
96- booking .getStartDate ().plusDays (4 ),
97- campsite .getId ());
98+ bookingEntity .getStartDate ().plusDays (2 ),
99+ bookingEntity .getStartDate ().plusDays (4 ),
100+ campsiteEntity .getId ());
98101 // then
99- assertThat (result ).hasSize (1 ).contains (booking );
102+ assertThat (result ).hasSize (1 ).contains (bookingEntity );
100103 }
101104
102105 @ Test
103106 @ DisplayNamePrefix ("--|S|E---|-|--" )
104107 void
105108 given_booking_start_date_equals_to_range_start_date_and_booking_end_date_within_range_dates__then_booking_found () {
106109 // given
107- CampsiteEntity campsite = testDataGenerator .createCampsiteEntity ();
108- BookingEntity booking = testDataGenerator .createBookingEntity (campsite .getId (), 1 , 2 );
110+ CampsiteEntity campsiteEntity = testDataGenerator .createCampsiteEntity ();
111+ BookingEntity bookingEntity =
112+ testDataGenerator .createBookingEntity (campsiteEntity .getId (), 1 , 2 );
109113 // when
110114 List <BookingEntity > result =
111115 classUnderTest .findForDateRange (
112- booking .getStartDate ().plusDays (1 ),
113- booking .getStartDate ().plusDays (3 ),
114- campsite .getId ());
116+ bookingEntity .getStartDate ().plusDays (1 ),
117+ bookingEntity .getStartDate ().plusDays (3 ),
118+ campsiteEntity .getId ());
115119 // then
116- assertThat (result ).hasSize (1 ).contains (booking );
120+ assertThat (result ).hasSize (1 ).contains (bookingEntity );
117121 }
118122
119123 @ Test
120124 @ DisplayNamePrefix ("--|-|S--E|-|--" )
121125 void given_booking_dates_within_range_dates__then_booking_found () {
122126 // given
123- CampsiteEntity campsite = testDataGenerator .createCampsiteEntity ();
124- BookingEntity booking = testDataGenerator .createBookingEntity (campsite .getId (), 2 , 3 );
127+ CampsiteEntity campsiteEntity = testDataGenerator .createCampsiteEntity ();
128+ BookingEntity bookingEntity =
129+ testDataGenerator .createBookingEntity (campsiteEntity .getId (), 2 , 3 );
125130 // when
126131 List <BookingEntity > result =
127132 classUnderTest .findForDateRange (
128- booking .getStartDate ().plusDays (1 ),
129- booking .getStartDate ().plusDays (4 ),
130- campsite .getId ());
133+ bookingEntity .getStartDate ().plusDays (1 ),
134+ bookingEntity .getStartDate ().plusDays (4 ),
135+ campsiteEntity .getId ());
131136 // then
132- assertThat (result ).hasSize (1 ).contains (booking );
137+ assertThat (result ).hasSize (1 ).contains (bookingEntity );
133138 }
134139
135140 @ Test
136141 @ DisplayNamePrefix ("--|-|---S|E|--" )
137142 void
138143 given_booking_start_date_within_range_dates_and_booking_end_date_equals_to_range_end_date__then_booking_found () {
139144 // given
140- CampsiteEntity campsite = testDataGenerator .createCampsiteEntity ();
141- BookingEntity booking = testDataGenerator .createBookingEntity (campsite .getId (), 2 , 3 );
145+ CampsiteEntity campsiteEntity = testDataGenerator .createCampsiteEntity ();
146+ BookingEntity bookingEntity =
147+ testDataGenerator .createBookingEntity (campsiteEntity .getId (), 2 , 3 );
142148 // when
143149 List <BookingEntity > result =
144150 classUnderTest .findForDateRange (
145- booking .getStartDate ().plusDays (1 ),
146- booking .getStartDate ().plusDays (3 ),
147- campsite .getId ());
151+ bookingEntity .getStartDate ().plusDays (1 ),
152+ bookingEntity .getStartDate ().plusDays (3 ),
153+ campsiteEntity .getId ());
148154 // then
149- assertThat (result ).hasSize (1 ).contains (booking );
155+ assertThat (result ).hasSize (1 ).contains (bookingEntity );
150156 }
151157
152158 @ Test
153159 @ DisplayNamePrefix ("--|-|---S|-|E-" )
154160 void
155161 given_booking_start_date_before_range_end_date_and_booking_end_date_after_range_end_date__then_booking_found () {
156162 // given
157- CampsiteEntity campsite = testDataGenerator .createCampsiteEntity ();
158- BookingEntity booking = testDataGenerator .createBookingEntity (campsite .getId (), 2 , 4 );
163+ CampsiteEntity campsiteEntity = testDataGenerator .createCampsiteEntity ();
164+ BookingEntity bookingEntity =
165+ testDataGenerator .createBookingEntity (campsiteEntity .getId (), 2 , 4 );
159166 // when
160167 List <BookingEntity > result =
161168 classUnderTest .findForDateRange (
162- booking .getStartDate ().plusDays (1 ),
163- booking .getStartDate ().plusDays (3 ),
164- campsite .getId ());
169+ bookingEntity .getStartDate ().plusDays (1 ),
170+ bookingEntity .getStartDate ().plusDays (3 ),
171+ campsiteEntity .getId ());
165172 // then
166- assertThat (result ).hasSize (1 ).contains (booking );
173+ assertThat (result ).hasSize (1 ).contains (bookingEntity );
167174 }
168175
169176 @ Test
170177 @ DisplayNamePrefix ("--|-|----|S|E-" )
171178 void
172179 given_booking_start_date_equals_to_range_end_date_and_booking_end_date_after_range_end_date__then_booking_found () {
173180 // given
174- CampsiteEntity campsite = testDataGenerator .createCampsiteEntity ();
175- BookingEntity booking = testDataGenerator .createBookingEntity (campsite .getId (), 3 , 4 );
181+ CampsiteEntity campsiteEntity = testDataGenerator .createCampsiteEntity ();
182+ BookingEntity bookingEntity =
183+ testDataGenerator .createBookingEntity (campsiteEntity .getId (), 3 , 4 );
176184 // when
177185 List <BookingEntity > result =
178186 classUnderTest .findForDateRange (
179- booking .getStartDate ().plusDays (1 ),
180- booking .getStartDate ().plusDays (3 ),
181- campsite .getId ());
187+ bookingEntity .getStartDate ().plusDays (1 ),
188+ bookingEntity .getStartDate ().plusDays (3 ),
189+ campsiteEntity .getId ());
182190 // then
183- assertThat (result ).hasSize (1 ).contains (booking );
191+ assertThat (result ).hasSize (1 ).contains (bookingEntity );
184192 }
185193
186194 @ Test
187195 @ DisplayNamePrefix ("--|-|----|-|SE" )
188196 void given_booking_dates_after_range_end_date__then_no_booking_found () {
189197 // given
190- CampsiteEntity campsite = testDataGenerator .createCampsiteEntity ();
191- BookingEntity booking = testDataGenerator .createBookingEntity (campsite .getId (), 3 , 4 );
198+ CampsiteEntity campsiteEntity = testDataGenerator .createCampsiteEntity ();
199+ BookingEntity bookingEntity =
200+ testDataGenerator .createBookingEntity (campsiteEntity .getId (), 3 , 4 );
192201 // when
193202 List <BookingEntity > result =
194203 classUnderTest .findForDateRange (
195- booking .getStartDate ().plusDays (1 ),
196- booking .getStartDate ().plusDays (2 ),
197- campsite .getId ());
204+ bookingEntity .getStartDate ().plusDays (1 ),
205+ bookingEntity .getStartDate ().plusDays (2 ),
206+ campsiteEntity .getId ());
198207 // then
199- assertThat (result ).hasSize (1 ).contains (booking );
208+ assertThat (result ).hasSize (1 ).contains (bookingEntity );
200209 }
201210
202211 @ Test
203212 @ DisplayNamePrefix ("-S|-|----|-|E-" )
204213 void given_booking_dates_overlap_range_dates__then_booking_found () {
205214 // given
206- CampsiteEntity campsite = testDataGenerator .createCampsiteEntity ();
207- BookingEntity booking = testDataGenerator .createBookingEntity (campsite .getId (), 1 , 4 );
215+ CampsiteEntity campsiteEntity = testDataGenerator .createCampsiteEntity ();
216+ BookingEntity bookingEntity =
217+ testDataGenerator .createBookingEntity (campsiteEntity .getId (), 1 , 4 );
208218 // when
209219 List <BookingEntity > result =
210220 classUnderTest .findForDateRange (
211- booking .getStartDate ().plusDays (2 ),
212- booking .getStartDate ().plusDays (3 ),
213- campsite .getId ());
221+ bookingEntity .getStartDate ().plusDays (2 ),
222+ bookingEntity .getStartDate ().plusDays (3 ),
223+ campsiteEntity .getId ());
214224 // then
215- assertThat (result ).hasSize (1 ).contains (booking );
225+ assertThat (result ).hasSize (1 ).contains (bookingEntity );
216226 }
217227 }
218228}
0 commit comments