15
15
import static io .opentelemetry .api .common .AttributeKey .stringKey ;
16
16
import static io .opentelemetry .sdk .testing .assertj .OpenTelemetryAssertions .assertThat ;
17
17
import static io .opentelemetry .sdk .testing .assertj .OpenTelemetryAssertions .equalTo ;
18
+ import static java .util .Collections .singletonList ;
18
19
import static java .util .stream .Collectors .joining ;
19
20
import static org .assertj .core .api .Assertions .assertThatCode ;
20
21
import static org .assertj .core .api .Assertions .assertThatThrownBy ;
@@ -135,7 +136,7 @@ void nothingChangedAfterEnd() {
135
136
spanData ,
136
137
Attributes .empty (),
137
138
Collections .emptyList (),
138
- Collections . singletonList (link ),
139
+ singletonList (link ),
139
140
SPAN_NAME ,
140
141
START_EPOCH_NANOS ,
141
142
START_EPOCH_NANOS ,
@@ -251,8 +252,8 @@ void toSpanData_ActiveSpan() {
251
252
verifySpanData (
252
253
spanData ,
253
254
expectedAttributes ,
254
- Collections . singletonList (event ),
255
- Collections . singletonList (link ),
255
+ singletonList (event ),
256
+ singletonList (link ),
256
257
SPAN_NEW_NAME ,
257
258
START_EPOCH_NANOS ,
258
259
0 ,
@@ -282,8 +283,8 @@ void toSpanData_EndedSpan() {
282
283
verifySpanData (
283
284
spanData ,
284
285
expectedAttributes ,
285
- Collections . singletonList (event ),
286
- Collections . singletonList (link ),
286
+ singletonList (event ),
287
+ singletonList (link ),
287
288
SPAN_NEW_NAME ,
288
289
START_EPOCH_NANOS ,
289
290
testClock .now (),
@@ -466,7 +467,8 @@ void getAttributes_Empty() {
466
467
}
467
468
468
469
@ Test
469
- @ SuppressWarnings ("deprecation" ) // Testing deprecated code
470
+ @ SuppressWarnings ("deprecation" )
471
+ // Testing deprecated code
470
472
void getInstrumentationLibraryInfo () {
471
473
SdkSpan span = createTestSpan (SpanKind .CLIENT );
472
474
try {
@@ -552,13 +554,10 @@ void setAttribute() {
552
554
span .setAttribute (doubleArrayKey ("NullArrayDoubleKey" ), null );
553
555
span .setAttribute (booleanArrayKey ("NullArrayBooleanKey" ), null );
554
556
// These should be maintained
555
- span .setAttribute (longArrayKey ("ArrayWithNullLongKey" ), Arrays .asList (new Long [] {null }));
556
- span .setAttribute (
557
- stringArrayKey ("ArrayWithNullStringKey" ), Arrays .asList (new String [] {null }));
558
- span .setAttribute (
559
- doubleArrayKey ("ArrayWithNullDoubleKey" ), Arrays .asList (new Double [] {null }));
560
- span .setAttribute (
561
- booleanArrayKey ("ArrayWithNullBooleanKey" ), Arrays .asList (new Boolean [] {null }));
557
+ span .setAttribute (longArrayKey ("ArrayWithNullLongKey" ), singletonList (null ));
558
+ span .setAttribute (stringArrayKey ("ArrayWithNullStringKey" ), singletonList (null ));
559
+ span .setAttribute (doubleArrayKey ("ArrayWithNullDoubleKey" ), singletonList (null ));
560
+ span .setAttribute (booleanArrayKey ("ArrayWithNullBooleanKey" ), singletonList (null ));
562
561
} finally {
563
562
span .end ();
564
563
}
@@ -691,10 +690,10 @@ void setAllAttributes() {
691
690
.put (doubleArrayKey ("NullArrayDoubleKey" ), (Double []) null )
692
691
.put (booleanArrayKey ("NullArrayBooleanKey" ), (Boolean []) null )
693
692
// These should be maintained
694
- .put (longArrayKey ("ArrayWithNullLongKey" ), Arrays . asList ( new Long [] { null } ))
695
- .put (stringArrayKey ("ArrayWithNullStringKey" ), Arrays . asList ( new String [] { null } ))
696
- .put (doubleArrayKey ("ArrayWithNullDoubleKey" ), Arrays . asList ( new Double [] { null } ))
697
- .put (booleanArrayKey ("ArrayWithNullBooleanKey" ), Arrays . asList ( new Boolean [] { null } ))
693
+ .put (longArrayKey ("ArrayWithNullLongKey" ), singletonList ( null ))
694
+ .put (stringArrayKey ("ArrayWithNullStringKey" ), singletonList ( null ))
695
+ .put (doubleArrayKey ("ArrayWithNullDoubleKey" ), singletonList ( null ))
696
+ .put (booleanArrayKey ("ArrayWithNullBooleanKey" ), singletonList ( null ))
698
697
.build ();
699
698
700
699
try {
@@ -1315,7 +1314,7 @@ public void setExceptionAttributes(
1315
1314
SpanLimits .getDefault (),
1316
1315
parentSpanId ,
1317
1316
null ,
1318
- Collections . singletonList (link ),
1317
+ singletonList (link ),
1319
1318
exceptionAttributeResolver );
1320
1319
1321
1320
span .recordException (new IllegalStateException ("error" ));
@@ -1462,7 +1461,7 @@ private SdkSpan createTestSpanWithAttributes(Map<AttributeKey, Object> attribute
1462
1461
SpanLimits .getDefault (),
1463
1462
null ,
1464
1463
attributesMap ,
1465
- Collections . singletonList (link ),
1464
+ singletonList (link ),
1466
1465
ExceptionAttributeResolver .getDefault ());
1467
1466
}
1468
1467
@@ -1472,7 +1471,7 @@ private SdkSpan createTestRootSpan() {
1472
1471
SpanLimits .getDefault (),
1473
1472
SpanId .getInvalid (),
1474
1473
null ,
1475
- Collections . singletonList (link ),
1474
+ singletonList (link ),
1476
1475
ExceptionAttributeResolver .getDefault ());
1477
1476
}
1478
1477
@@ -1482,7 +1481,7 @@ private SdkSpan createTestSpan(SpanKind kind) {
1482
1481
SpanLimits .getDefault (),
1483
1482
parentSpanId ,
1484
1483
null ,
1485
- Collections . singletonList (link ),
1484
+ singletonList (link ),
1486
1485
ExceptionAttributeResolver .getDefault ());
1487
1486
}
1488
1487
@@ -1492,7 +1491,7 @@ private SdkSpan createTestSpan(SpanLimits config) {
1492
1491
config ,
1493
1492
parentSpanId ,
1494
1493
null ,
1495
- Collections . singletonList (link ),
1494
+ singletonList (link ),
1496
1495
ExceptionAttributeResolver .getDefault ());
1497
1496
}
1498
1497
@@ -1611,7 +1610,7 @@ void testAsSpanData() {
1611
1610
clock ,
1612
1611
resource ,
1613
1612
attributesWithCapacity ,
1614
- Collections . singletonList (link1 ),
1613
+ singletonList (link1 ),
1615
1614
1 ,
1616
1615
0 );
1617
1616
long startEpochNanos = clock .now ();
@@ -1638,7 +1637,7 @@ void testAsSpanData() {
1638
1637
result ,
1639
1638
attributesWithCapacity ,
1640
1639
events ,
1641
- Collections . singletonList (link1 ),
1640
+ singletonList (link1 ),
1642
1641
name ,
1643
1642
startEpochNanos ,
1644
1643
endEpochNanos ,
0 commit comments