@@ -37,12 +37,12 @@ class FindByUuid {
37
37
@ Test
38
38
void happy_path () {
39
39
// 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 ());
42
42
// when
43
- Optional <BookingEntity > result = classUnderTest .findByUuid (booking .getUuid ());
43
+ Optional <BookingEntity > result = classUnderTest .findByUuid (bookingEntity .getUuid ());
44
44
// then
45
- assertThat (result ).hasValue (booking );
45
+ assertThat (result ).hasValue (bookingEntity );
46
46
}
47
47
}
48
48
@@ -53,14 +53,15 @@ class FindForDateRange {
53
53
@ DisplayNamePrefix ("SE|-|----|-|--" )
54
54
void given_booking_dates_before_range_start_date__then_no_booking_found () {
55
55
// 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 );
58
59
// when
59
60
List <BookingEntity > result =
60
61
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 ());
64
65
// then
65
66
assertThat (result ).isEmpty ();
66
67
}
@@ -70,14 +71,15 @@ void given_booking_dates_before_range_start_date__then_no_booking_found() {
70
71
void
71
72
given_booking_start_date_before_range_start_date_and_booking_end_date_equals_to_range_start_date__then_no_booking_found () {
72
73
// 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 );
75
77
// when
76
78
List <BookingEntity > result =
77
79
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 ());
81
83
// then
82
84
assertThat (result ).isEmpty ();
83
85
}
@@ -87,132 +89,140 @@ void given_booking_dates_before_range_start_date__then_no_booking_found() {
87
89
void
88
90
given_booking_start_date_before_range_start_date_and_booking_end_date_within_range_dates__then_booking_found () {
89
91
// 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 );
92
95
// when
93
96
List <BookingEntity > result =
94
97
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 ());
98
101
// then
99
- assertThat (result ).hasSize (1 ).contains (booking );
102
+ assertThat (result ).hasSize (1 ).contains (bookingEntity );
100
103
}
101
104
102
105
@ Test
103
106
@ DisplayNamePrefix ("--|S|E---|-|--" )
104
107
void
105
108
given_booking_start_date_equals_to_range_start_date_and_booking_end_date_within_range_dates__then_booking_found () {
106
109
// 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 );
109
113
// when
110
114
List <BookingEntity > result =
111
115
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 ());
115
119
// then
116
- assertThat (result ).hasSize (1 ).contains (booking );
120
+ assertThat (result ).hasSize (1 ).contains (bookingEntity );
117
121
}
118
122
119
123
@ Test
120
124
@ DisplayNamePrefix ("--|-|S--E|-|--" )
121
125
void given_booking_dates_within_range_dates__then_booking_found () {
122
126
// 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 );
125
130
// when
126
131
List <BookingEntity > result =
127
132
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 ());
131
136
// then
132
- assertThat (result ).hasSize (1 ).contains (booking );
137
+ assertThat (result ).hasSize (1 ).contains (bookingEntity );
133
138
}
134
139
135
140
@ Test
136
141
@ DisplayNamePrefix ("--|-|---S|E|--" )
137
142
void
138
143
given_booking_start_date_within_range_dates_and_booking_end_date_equals_to_range_end_date__then_booking_found () {
139
144
// 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 );
142
148
// when
143
149
List <BookingEntity > result =
144
150
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 ());
148
154
// then
149
- assertThat (result ).hasSize (1 ).contains (booking );
155
+ assertThat (result ).hasSize (1 ).contains (bookingEntity );
150
156
}
151
157
152
158
@ Test
153
159
@ DisplayNamePrefix ("--|-|---S|-|E-" )
154
160
void
155
161
given_booking_start_date_before_range_end_date_and_booking_end_date_after_range_end_date__then_booking_found () {
156
162
// 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 );
159
166
// when
160
167
List <BookingEntity > result =
161
168
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 ());
165
172
// then
166
- assertThat (result ).hasSize (1 ).contains (booking );
173
+ assertThat (result ).hasSize (1 ).contains (bookingEntity );
167
174
}
168
175
169
176
@ Test
170
177
@ DisplayNamePrefix ("--|-|----|S|E-" )
171
178
void
172
179
given_booking_start_date_equals_to_range_end_date_and_booking_end_date_after_range_end_date__then_booking_found () {
173
180
// 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 );
176
184
// when
177
185
List <BookingEntity > result =
178
186
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 ());
182
190
// then
183
- assertThat (result ).hasSize (1 ).contains (booking );
191
+ assertThat (result ).hasSize (1 ).contains (bookingEntity );
184
192
}
185
193
186
194
@ Test
187
195
@ DisplayNamePrefix ("--|-|----|-|SE" )
188
196
void given_booking_dates_after_range_end_date__then_no_booking_found () {
189
197
// 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 );
192
201
// when
193
202
List <BookingEntity > result =
194
203
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 ());
198
207
// then
199
- assertThat (result ).hasSize (1 ).contains (booking );
208
+ assertThat (result ).hasSize (1 ).contains (bookingEntity );
200
209
}
201
210
202
211
@ Test
203
212
@ DisplayNamePrefix ("-S|-|----|-|E-" )
204
213
void given_booking_dates_overlap_range_dates__then_booking_found () {
205
214
// 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 );
208
218
// when
209
219
List <BookingEntity > result =
210
220
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 ());
214
224
// then
215
- assertThat (result ).hasSize (1 ).contains (booking );
225
+ assertThat (result ).hasSize (1 ).contains (bookingEntity );
216
226
}
217
227
}
218
228
}
0 commit comments