File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 88 "encoding/json"
99 "errors"
1010
11- "go.uber.org/zap"
12-
1311 "go.opentelemetry.io/otel/trace"
12+ "go.uber.org/zap"
1413
1514 "go.opentelemetry.io/collector/component"
1615 "go.opentelemetry.io/collector/consumer"
Original file line number Diff line number Diff line change @@ -499,3 +499,18 @@ func TestSerializableToLink(t *testing.T) {
499499 // TraceState will be empty due to error in inserting Member Key "@key"
500500 assert .Equal (t , trace.TraceState {}, res .SpanContext .TraceState ())
501501}
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