// Copyright The OpenTelemetry Authors
// SPDX-License-Identifier: Apache-2.0

// Code generated by "internal/cmd/pdatagen/main.go". DO NOT EDIT.
// To regenerate this file run "make genpdata".

package ptraceotlp

import (
	"testing"

	"github.com/stretchr/testify/assert"

	"go.opentelemetry.io/collector/pdata/internal"
	otlpcollectortrace "go.opentelemetry.io/collector/pdata/internal/data/protogen/collector/trace/v1"
)

func TestExportResponse_MoveTo(t *testing.T) {
	ms := generateTestExportResponse()
	dest := NewExportResponse()
	ms.MoveTo(dest)
	assert.Equal(t, NewExportResponse(), ms)
	assert.Equal(t, generateTestExportResponse(), dest)
	dest.MoveTo(dest)
	assert.Equal(t, generateTestExportResponse(), dest)
	sharedState := internal.StateReadOnly
	assert.Panics(t, func() { ms.MoveTo(newExportResponse(&otlpcollectortrace.ExportTraceServiceResponse{}, &sharedState)) })
	assert.Panics(t, func() { newExportResponse(&otlpcollectortrace.ExportTraceServiceResponse{}, &sharedState).MoveTo(dest) })
}

func TestExportResponse_CopyTo(t *testing.T) {
	ms := NewExportResponse()
	orig := NewExportResponse()
	orig.CopyTo(ms)
	assert.Equal(t, orig, ms)
	orig = generateTestExportResponse()
	orig.CopyTo(ms)
	assert.Equal(t, orig, ms)
	sharedState := internal.StateReadOnly
	assert.Panics(t, func() { ms.CopyTo(newExportResponse(&otlpcollectortrace.ExportTraceServiceResponse{}, &sharedState)) })
}

func TestExportResponse_PartialSuccess(t *testing.T) {
	ms := NewExportResponse()
	assert.Equal(t, NewExportPartialSuccess(), ms.PartialSuccess())
	internal.FillOrigTestExportTracePartialSuccess(&ms.orig.PartialSuccess)
	assert.Equal(t, generateTestExportPartialSuccess(), ms.PartialSuccess())
}

func generateTestExportResponse() ExportResponse {
	ms := NewExportResponse()
	internal.FillOrigTestExportTraceServiceResponse(ms.orig)
	return ms
}
