44import static org .junit .jupiter .api .Assertions .assertFalse ;
55import static org .junit .jupiter .api .Assertions .assertTrue ;
66
7+ import datadog .trace .api .TagMap .Entry ;
78import java .util .ArrayList ;
89import java .util .Collections ;
910import java .util .List ;
1516import java .util .concurrent .ThreadFactory ;
1617import java .util .function .Function ;
1718import java .util .function .Supplier ;
18-
1919import org .junit .Test ;
2020import org .junit .jupiter .params .ParameterizedTest ;
2121import org .junit .jupiter .params .provider .ValueSource ;
2222
23- import datadog .trace .api .TagMap .Entry ;
24-
2523/**
2624 * Since TagMap.Entry is thread safe and has involves complicated multi-thread type resolution code,
2725 * this test uses a different approach to stress ordering different combinations.
@@ -62,34 +60,35 @@ public void anyEntry_object() {
6260 }
6361
6462 @ ParameterizedTest
65- @ ValueSource (booleans = {false , true })
63+ @ ValueSource (booleans = {false , true })
6664 public void booleanEntry (boolean value ) {
6765 test (
68- () -> TagMap .Entry .newBooleanEntry ("foo" , value ),
69- TagMap .Entry .BOOLEAN ,
70- (entry ) ->
71- multiCheck (
72- checkKey ("foo" , entry ),
73- checkValue (value , entry ),
74- checkFalse (entry ::isNumericPrimitive ),
75- checkType (TagMap .Entry .BOOLEAN , entry )));
66+ () -> TagMap .Entry .newBooleanEntry ("foo" , value ),
67+ TagMap .Entry .BOOLEAN ,
68+ (entry ) ->
69+ multiCheck (
70+ checkKey ("foo" , entry ),
71+ checkValue (value , entry ),
72+ checkFalse (entry ::isNumericPrimitive ),
73+ checkType (TagMap .Entry .BOOLEAN , entry )));
7674 }
7775
7876 @ ParameterizedTest
79- @ ValueSource (booleans = {false , true })
77+ @ ValueSource (booleans = {false , true })
8078 public void booleanEntry_boxed (boolean value ) {
8179 test (
82- () -> TagMap .Entry .newBooleanEntry ("foo" , Boolean .valueOf (value )),
83- TagMap .Entry .BOOLEAN ,
84- (entry ) -> multiCheck (
85- checkKey ("foo" , entry ),
86- checkValue (value , entry ),
87- checkFalse (entry ::isNumericPrimitive ),
88- checkType (TagMap .Entry .BOOLEAN , entry )));
80+ () -> TagMap .Entry .newBooleanEntry ("foo" , Boolean .valueOf (value )),
81+ TagMap .Entry .BOOLEAN ,
82+ (entry ) ->
83+ multiCheck (
84+ checkKey ("foo" , entry ),
85+ checkValue (value , entry ),
86+ checkFalse (entry ::isNumericPrimitive ),
87+ checkType (TagMap .Entry .BOOLEAN , entry )));
8988 }
9089
9190 @ ParameterizedTest
92- @ ValueSource (booleans = {false , true })
91+ @ ValueSource (booleans = {false , true })
9392 public void anyEntry_boolean (boolean value ) {
9493 test (
9594 () -> TagMap .Entry .newAnyEntry ("foo" , Boolean .valueOf (value )),
@@ -104,7 +103,7 @@ public void anyEntry_boolean(boolean value) {
104103 }
105104
106105 @ ParameterizedTest
107- @ ValueSource (ints = {Integer .MIN_VALUE , -256 , -128 , -1 , 0 , 1 , 128 , 256 , Integer .MAX_VALUE })
106+ @ ValueSource (ints = {Integer .MIN_VALUE , -256 , -128 , -1 , 0 , 1 , 128 , 256 , Integer .MAX_VALUE })
108107 public void intEntry (int value ) {
109108 test (
110109 () -> TagMap .Entry .newIntEntry ("foo" , value ),
@@ -118,7 +117,7 @@ public void intEntry(int value) {
118117 }
119118
120119 @ ParameterizedTest
121- @ ValueSource (ints = {Integer .MIN_VALUE , -256 , -128 , -1 , 0 , 1 , 128 , 256 , Integer .MAX_VALUE })
120+ @ ValueSource (ints = {Integer .MIN_VALUE , -256 , -128 , -1 , 0 , 1 , 128 , 256 , Integer .MAX_VALUE })
122121 public void intEntry_boxed (int value ) {
123122 test (
124123 () -> TagMap .Entry .newIntEntry ("foo" , Integer .valueOf (value )),
@@ -132,7 +131,7 @@ public void intEntry_boxed(int value) {
132131 }
133132
134133 @ ParameterizedTest
135- @ ValueSource (ints = {Integer .MIN_VALUE , -256 , -128 , -1 , 0 , 1 , 128 , 256 , Integer .MAX_VALUE })
134+ @ ValueSource (ints = {Integer .MIN_VALUE , -256 , -128 , -1 , 0 , 1 , 128 , 256 , Integer .MAX_VALUE })
136135 public void anyEntry_int (int value ) {
137136 test (
138137 () -> TagMap .Entry .newAnyEntry ("foo" , Integer .valueOf (value )),
@@ -147,7 +146,22 @@ public void anyEntry_int(int value) {
147146 }
148147
149148 @ ParameterizedTest
150- @ ValueSource (longs = {Long .MIN_VALUE , Integer .MIN_VALUE , -1_048_576L , -256L , -128L , -1L , 0L , 1L , 128L , 256L , 1_048_576L , Integer .MAX_VALUE , Long .MAX_VALUE })
149+ @ ValueSource (
150+ longs = {
151+ Long .MIN_VALUE ,
152+ Integer .MIN_VALUE ,
153+ -1_048_576L ,
154+ -256L ,
155+ -128L ,
156+ -1L ,
157+ 0L ,
158+ 1L ,
159+ 128L ,
160+ 256L ,
161+ 1_048_576L ,
162+ Integer .MAX_VALUE ,
163+ Long .MAX_VALUE
164+ })
151165 public void longEntry (long value ) {
152166 test (
153167 () -> TagMap .Entry .newLongEntry ("foo" , value ),
@@ -161,7 +175,22 @@ public void longEntry(long value) {
161175 }
162176
163177 @ ParameterizedTest
164- @ ValueSource (longs = {Long .MIN_VALUE , Integer .MIN_VALUE , -1_048_576L , -256L , -128L , -1L , 0L , 1L , 128L , 256L , 1_048_576L , Integer .MAX_VALUE , Long .MAX_VALUE })
178+ @ ValueSource (
179+ longs = {
180+ Long .MIN_VALUE ,
181+ Integer .MIN_VALUE ,
182+ -1_048_576L ,
183+ -256L ,
184+ -128L ,
185+ -1L ,
186+ 0L ,
187+ 1L ,
188+ 128L ,
189+ 256L ,
190+ 1_048_576L ,
191+ Integer .MAX_VALUE ,
192+ Long .MAX_VALUE
193+ })
165194 public void longEntry_boxed (long value ) {
166195 test (
167196 () -> TagMap .Entry .newLongEntry ("foo" , Long .valueOf (value )),
@@ -175,7 +204,22 @@ public void longEntry_boxed(long value) {
175204 }
176205
177206 @ ParameterizedTest
178- @ ValueSource (longs = {Long .MIN_VALUE , Integer .MIN_VALUE , -1_048_576L , -256L , -128L , -1L , 0L , 1L , 128L , 256L , 1_048_576L , Integer .MAX_VALUE , Long .MAX_VALUE })
207+ @ ValueSource (
208+ longs = {
209+ Long .MIN_VALUE ,
210+ Integer .MIN_VALUE ,
211+ -1_048_576L ,
212+ -256L ,
213+ -128L ,
214+ -1L ,
215+ 0L ,
216+ 1L ,
217+ 128L ,
218+ 256L ,
219+ 1_048_576L ,
220+ Integer .MAX_VALUE ,
221+ Long .MAX_VALUE
222+ })
179223 public void anyEntry_long (long value ) {
180224 test (
181225 () -> TagMap .Entry .newAnyEntry ("foo" , Long .valueOf (value )),
@@ -190,7 +234,7 @@ public void anyEntry_long(long value) {
190234 }
191235
192236 @ ParameterizedTest
193- @ ValueSource (floats = {Float .MIN_VALUE , -1F , 0F , 1F , 2.171828F , 3.1415F , Float .MAX_VALUE })
237+ @ ValueSource (floats = {Float .MIN_VALUE , -1F , 0F , 1F , 2.171828F , 3.1415F , Float .MAX_VALUE })
194238 public void floatEntry (float value ) {
195239 test (
196240 () -> TagMap .Entry .newFloatEntry ("foo" , value ),
@@ -204,7 +248,7 @@ public void floatEntry(float value) {
204248 }
205249
206250 @ ParameterizedTest
207- @ ValueSource (floats = {Float .MIN_VALUE , -1F , 0F , 1F , 2.171828F , 3.1415F , Float .MAX_VALUE })
251+ @ ValueSource (floats = {Float .MIN_VALUE , -1F , 0F , 1F , 2.171828F , 3.1415F , Float .MAX_VALUE })
208252 public void floatEntry_boxed (float value ) {
209253 test (
210254 () -> TagMap .Entry .newFloatEntry ("foo" , Float .valueOf (value )),
@@ -218,7 +262,7 @@ public void floatEntry_boxed(float value) {
218262 }
219263
220264 @ ParameterizedTest
221- @ ValueSource (floats = {Float .MIN_VALUE , -1F , 0F , 1F , 2.171828F , 3.1415F , Float .MAX_VALUE })
265+ @ ValueSource (floats = {Float .MIN_VALUE , -1F , 0F , 1F , 2.171828F , 3.1415F , Float .MAX_VALUE })
222266 public void anyEntry_float (float value ) {
223267 test (
224268 () -> TagMap .Entry .newAnyEntry ("foo" , Float .valueOf (value )),
@@ -232,7 +276,8 @@ public void anyEntry_float(float value) {
232276 }
233277
234278 @ ParameterizedTest
235- @ ValueSource (doubles = {Double .MIN_VALUE , Float .MIN_VALUE , -1D , 0D , 1D , Math .E , Math .PI , Double .MAX_VALUE })
279+ @ ValueSource (
280+ doubles = {Double .MIN_VALUE , Float .MIN_VALUE , -1D , 0D , 1D , Math .E , Math .PI , Double .MAX_VALUE })
236281 public void doubleEntry (double value ) {
237282 test (
238283 () -> TagMap .Entry .newDoubleEntry ("foo" , value ),
@@ -246,7 +291,8 @@ public void doubleEntry(double value) {
246291 }
247292
248293 @ ParameterizedTest
249- @ ValueSource (doubles = {Double .MIN_VALUE , Float .MIN_VALUE , -1D , 0D , 1D , Math .E , Math .PI , Double .MAX_VALUE })
294+ @ ValueSource (
295+ doubles = {Double .MIN_VALUE , Float .MIN_VALUE , -1D , 0D , 1D , Math .E , Math .PI , Double .MAX_VALUE })
250296 public void doubleEntry_boxed (double value ) {
251297 test (
252298 () -> TagMap .Entry .newDoubleEntry ("foo" , Double .valueOf (value )),
@@ -260,7 +306,8 @@ public void doubleEntry_boxed(double value) {
260306 }
261307
262308 @ ParameterizedTest
263- @ ValueSource (doubles = {Double .MIN_VALUE , Float .MIN_VALUE , -1D , 0D , 1D , Math .E , Math .PI , Double .MAX_VALUE })
309+ @ ValueSource (
310+ doubles = {Double .MIN_VALUE , Float .MIN_VALUE , -1D , 0D , 1D , Math .E , Math .PI , Double .MAX_VALUE })
264311 public void anyEntry_double (double value ) {
265312 test (
266313 () -> TagMap .Entry .newAnyEntry ("foo" , Double .valueOf (value )),
0 commit comments