18
18
import java .time .YearMonth ;
19
19
import java .util .stream .Stream ;
20
20
21
- import javax .xml .bind .DatatypeConverter ;
22
21
import javax .xml .datatype .DatatypeConstants ;
23
22
import javax .xml .datatype .DatatypeFactory ;
24
23
import javax .xml .datatype .Duration ;
25
24
import javax .xml .datatype .XMLGregorianCalendar ;
26
25
26
+ import jakarta .xml .bind .DatatypeConverter ;
27
27
import net .jqwik .api .Arbitraries ;
28
28
import net .jqwik .api .Arbitrary ;
29
29
import net .jqwik .api .Combinators ;
@@ -70,13 +70,13 @@ default Arbitrary<BigInteger> anyNonNegativeInteger() {
70
70
@ Provide
71
71
default Arbitrary <String > anyHexBinary () {
72
72
return Arbitraries .strings ().ofMinLength ( 1 )
73
- .map ( string -> DatatypeConverter .printHexBinary ( string .getBytes () ) );
73
+ .map ( string -> DatatypeConverter .printHexBinary ( string .getBytes () ) );
74
74
}
75
75
76
76
@ Provide
77
77
default Arbitrary <String > anyBase64Binary () {
78
78
return Arbitraries .strings ().ofMinLength ( 1 )
79
- .map ( string -> DatatypeConverter .printBase64Binary ( string .getBytes () ) );
79
+ .map ( string -> DatatypeConverter .printBase64Binary ( string .getBytes () ) );
80
80
}
81
81
82
82
@ Provide
@@ -135,15 +135,15 @@ default Arbitrary<Tuple.Tuple3<Integer, Integer, Integer>> anyYearMonthDay() {
135
135
@ Provide
136
136
default Arbitrary <XMLGregorianCalendar > anyDate () {
137
137
return Combinators .combine ( anyYearMonthDay (), anyTimezone () )
138
- .as ( ( yearMonthDay , timezone ) ->
139
- getDatatypeFactory ().newXMLGregorianCalendarDate (
140
- yearMonthDay .get1 (), yearMonthDay .get2 (), yearMonthDay .get3 (), timezone ) );
138
+ .as ( ( yearMonthDay , timezone ) ->
139
+ getDatatypeFactory ().newXMLGregorianCalendarDate (
140
+ yearMonthDay .get1 (), yearMonthDay .get2 (), yearMonthDay .get3 (), timezone ) );
141
141
}
142
142
143
143
@ Provide
144
144
default Arbitrary <XMLGregorianCalendar > anyTime () {
145
145
return Combinators .combine ( anyHour (), anyMinute (), anySecond (), anyTimezone () )
146
- .as ( getDatatypeFactory ()::newXMLGregorianCalendarTime );
146
+ .as ( getDatatypeFactory ()::newXMLGregorianCalendarTime );
147
147
}
148
148
149
149
@ Provide
@@ -163,50 +163,50 @@ default Arbitrary<XMLGregorianCalendar> anyDateTimeStamp() {
163
163
@ Provide
164
164
default Arbitrary <XMLGregorianCalendar > anyGYear () {
165
165
return Combinators .combine ( anyYear (), anyTimezone ().optional () )
166
- .as ( ( year , optionalTimezone ) -> {
167
- final int timezone = optionalTimezone .orElse ( DatatypeConstants .FIELD_UNDEFINED );
168
- return getDatatypeFactory ().newXMLGregorianCalendar ( year , DatatypeConstants .FIELD_UNDEFINED ,
169
- DatatypeConstants .FIELD_UNDEFINED , DatatypeConstants .FIELD_UNDEFINED ,
170
- DatatypeConstants .FIELD_UNDEFINED , DatatypeConstants .FIELD_UNDEFINED ,
171
- DatatypeConstants .FIELD_UNDEFINED , timezone );
172
- } );
166
+ .as ( ( year , optionalTimezone ) -> {
167
+ final int timezone = optionalTimezone .orElse ( DatatypeConstants .FIELD_UNDEFINED );
168
+ return getDatatypeFactory ().newXMLGregorianCalendar ( year , DatatypeConstants .FIELD_UNDEFINED ,
169
+ DatatypeConstants .FIELD_UNDEFINED , DatatypeConstants .FIELD_UNDEFINED ,
170
+ DatatypeConstants .FIELD_UNDEFINED , DatatypeConstants .FIELD_UNDEFINED ,
171
+ DatatypeConstants .FIELD_UNDEFINED , timezone );
172
+ } );
173
173
}
174
174
175
175
@ Provide
176
176
default Arbitrary <XMLGregorianCalendar > anyGMonth () {
177
177
return Combinators .combine ( anyMonth (), anyTimezone ().optional () )
178
- .as ( ( month , optionalTimezone ) -> {
179
- final int timezone = optionalTimezone .orElse ( DatatypeConstants .FIELD_UNDEFINED );
180
- return getDatatypeFactory ()
181
- .newXMLGregorianCalendar ( DatatypeConstants .FIELD_UNDEFINED , month ,
182
- DatatypeConstants .FIELD_UNDEFINED , DatatypeConstants .FIELD_UNDEFINED ,
183
- DatatypeConstants .FIELD_UNDEFINED , DatatypeConstants .FIELD_UNDEFINED ,
184
- DatatypeConstants .FIELD_UNDEFINED , timezone );
185
- } );
178
+ .as ( ( month , optionalTimezone ) -> {
179
+ final int timezone = optionalTimezone .orElse ( DatatypeConstants .FIELD_UNDEFINED );
180
+ return getDatatypeFactory ()
181
+ .newXMLGregorianCalendar ( DatatypeConstants .FIELD_UNDEFINED , month ,
182
+ DatatypeConstants .FIELD_UNDEFINED , DatatypeConstants .FIELD_UNDEFINED ,
183
+ DatatypeConstants .FIELD_UNDEFINED , DatatypeConstants .FIELD_UNDEFINED ,
184
+ DatatypeConstants .FIELD_UNDEFINED , timezone );
185
+ } );
186
186
}
187
187
188
188
@ Provide
189
189
default Arbitrary <XMLGregorianCalendar > anyGDay () {
190
190
return Combinators .combine ( anyDayInMonth (), anyTimezone ().optional () )
191
- .as ( ( day , optionalTimezone ) -> {
192
- final int timezone = optionalTimezone .orElse ( DatatypeConstants .FIELD_UNDEFINED );
193
- return getDatatypeFactory ().newXMLGregorianCalendar ( DatatypeConstants .FIELD_UNDEFINED ,
194
- DatatypeConstants .FIELD_UNDEFINED , day , DatatypeConstants .FIELD_UNDEFINED ,
195
- DatatypeConstants .FIELD_UNDEFINED , DatatypeConstants .FIELD_UNDEFINED ,
196
- DatatypeConstants .FIELD_UNDEFINED , timezone );
197
- } );
191
+ .as ( ( day , optionalTimezone ) -> {
192
+ final int timezone = optionalTimezone .orElse ( DatatypeConstants .FIELD_UNDEFINED );
193
+ return getDatatypeFactory ().newXMLGregorianCalendar ( DatatypeConstants .FIELD_UNDEFINED ,
194
+ DatatypeConstants .FIELD_UNDEFINED , day , DatatypeConstants .FIELD_UNDEFINED ,
195
+ DatatypeConstants .FIELD_UNDEFINED , DatatypeConstants .FIELD_UNDEFINED ,
196
+ DatatypeConstants .FIELD_UNDEFINED , timezone );
197
+ } );
198
198
}
199
199
200
200
@ Provide
201
201
default Arbitrary <XMLGregorianCalendar > anyGYearMonth () {
202
202
return Combinators .combine ( anyYear (), anyMonth (), anyTimezone ().optional () )
203
- .as ( ( year , month , optionalTimezone ) -> {
204
- final int timezone = optionalTimezone .orElse ( DatatypeConstants .FIELD_UNDEFINED );
205
- return getDatatypeFactory ().newXMLGregorianCalendar ( year , month ,
206
- DatatypeConstants .FIELD_UNDEFINED , DatatypeConstants .FIELD_UNDEFINED ,
207
- DatatypeConstants .FIELD_UNDEFINED , DatatypeConstants .FIELD_UNDEFINED ,
208
- DatatypeConstants .FIELD_UNDEFINED , timezone );
209
- } );
203
+ .as ( ( year , month , optionalTimezone ) -> {
204
+ final int timezone = optionalTimezone .orElse ( DatatypeConstants .FIELD_UNDEFINED );
205
+ return getDatatypeFactory ().newXMLGregorianCalendar ( year , month ,
206
+ DatatypeConstants .FIELD_UNDEFINED , DatatypeConstants .FIELD_UNDEFINED ,
207
+ DatatypeConstants .FIELD_UNDEFINED , DatatypeConstants .FIELD_UNDEFINED ,
208
+ DatatypeConstants .FIELD_UNDEFINED , timezone );
209
+ } );
210
210
}
211
211
212
212
@ Provide
@@ -220,7 +220,7 @@ default Arbitrary<Tuple.Tuple2<Integer, Integer>> anyMonthDay() {
220
220
return day <= 29 ;
221
221
}
222
222
if ( Stream .of ( Month .APRIL , Month .JUNE , Month .SEPTEMBER , Month .NOVEMBER )
223
- .anyMatch ( theMonth -> theMonth .getValue () == month ) ) {
223
+ .anyMatch ( theMonth -> theMonth .getValue () == month ) ) {
224
224
return day <= 30 ;
225
225
}
226
226
return day <= 31 ;
@@ -230,13 +230,13 @@ default Arbitrary<Tuple.Tuple2<Integer, Integer>> anyMonthDay() {
230
230
@ Provide
231
231
default Arbitrary <XMLGregorianCalendar > anyGMonthDay () {
232
232
return Combinators .combine ( anyMonthDay (), anyTimezone ().optional () )
233
- .as ( ( monthDay , optionalTimezone ) -> {
234
- final int timezone = optionalTimezone .orElse ( DatatypeConstants .FIELD_UNDEFINED );
235
- return getDatatypeFactory ().newXMLGregorianCalendar ( DatatypeConstants .FIELD_UNDEFINED ,
236
- monthDay .get1 (), monthDay .get2 (), DatatypeConstants .FIELD_UNDEFINED ,
237
- DatatypeConstants .FIELD_UNDEFINED , DatatypeConstants .FIELD_UNDEFINED ,
238
- DatatypeConstants .FIELD_UNDEFINED , timezone );
239
- } );
233
+ .as ( ( monthDay , optionalTimezone ) -> {
234
+ final int timezone = optionalTimezone .orElse ( DatatypeConstants .FIELD_UNDEFINED );
235
+ return getDatatypeFactory ().newXMLGregorianCalendar ( DatatypeConstants .FIELD_UNDEFINED ,
236
+ monthDay .get1 (), monthDay .get2 (), DatatypeConstants .FIELD_UNDEFINED ,
237
+ DatatypeConstants .FIELD_UNDEFINED , DatatypeConstants .FIELD_UNDEFINED ,
238
+ DatatypeConstants .FIELD_UNDEFINED , timezone );
239
+ } );
240
240
}
241
241
242
242
@ Provide
@@ -247,12 +247,12 @@ default Arbitrary<Duration> anyDuration() {
247
247
@ Provide
248
248
default Arbitrary <Duration > anyYearMonthDuration () {
249
249
return Combinators .combine ( anyBoolean (), anyYear (), anyMonth () )
250
- .as ( getDatatypeFactory ()::newDurationYearMonth );
250
+ .as ( getDatatypeFactory ()::newDurationYearMonth );
251
251
}
252
252
253
253
@ Provide
254
254
default Arbitrary <Duration > anyDayTimeDuration () {
255
255
return Combinators .combine ( anyBoolean (), anyDayInMonth (), anyHour (), anyMinute (), anySecond () )
256
- .as ( getDatatypeFactory ()::newDurationDayTime );
256
+ .as ( getDatatypeFactory ()::newDurationDayTime );
257
257
}
258
258
}
0 commit comments