File tree Expand file tree Collapse file tree 2 files changed +16
-2
lines changed Expand file tree Collapse file tree 2 files changed +16
-2
lines changed Original file line number Diff line number Diff line change 8
8
"encoding/json"
9
9
"errors"
10
10
11
- "go.uber.org/zap"
12
-
13
11
"go.opentelemetry.io/otel/trace"
12
+ "go.uber.org/zap"
14
13
15
14
"go.opentelemetry.io/collector/component"
16
15
"go.opentelemetry.io/collector/consumer"
Original file line number Diff line number Diff line change @@ -499,3 +499,18 @@ func TestSerializableToLink(t *testing.T) {
499
499
// TraceState will be empty due to error in inserting Member Key "@key"
500
500
assert .Equal (t , trace.TraceState {}, res .SpanContext .TraceState ())
501
501
}
502
+
503
+ func TestTracesEncoding_Unmarshal_InvalidJSON (t * testing.T ) {
504
+ // Create invalid JSON bytes
505
+ invalidJSON := []byte (`{invalid json}` )
506
+
507
+ // Create tracesEncoding instance
508
+ encoding := tracesEncoding {}
509
+
510
+ // Attempt to unmarshal invalid JSON
511
+ req , err := encoding .Unmarshal (invalidJSON )
512
+
513
+ // Verify error is returned and request is nil
514
+ assert .Error (t , err )
515
+ assert .Nil (t , req )
516
+ }
You can’t perform that action at this time.
0 commit comments