2021-11-08 10:04:45 +00:00
|
|
|
package object_test
|
|
|
|
|
|
|
|
import (
|
|
|
|
"errors"
|
|
|
|
"testing"
|
|
|
|
|
2023-03-07 11:20:03 +00:00
|
|
|
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object"
|
2021-11-08 10:04:45 +00:00
|
|
|
"github.com/stretchr/testify/require"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestNewSplitInfoError(t *testing.T) {
|
|
|
|
var (
|
|
|
|
si = generateSplitInfo()
|
|
|
|
|
|
|
|
err error = object.NewSplitInfoError(si)
|
|
|
|
expectedErr *object.SplitInfoError
|
|
|
|
)
|
|
|
|
|
|
|
|
require.True(t, errors.As(err, &expectedErr))
|
|
|
|
|
|
|
|
siErr, ok := err.(*object.SplitInfoError)
|
|
|
|
require.True(t, ok)
|
|
|
|
require.Equal(t, si, siErr.SplitInfo())
|
|
|
|
}
|
|
|
|
|
|
|
|
func generateSplitInfo() *object.SplitInfo {
|
|
|
|
si := object.NewSplitInfo()
|
|
|
|
si.SetSplitID(object.NewSplitID())
|
|
|
|
si.SetLastPart(generateID())
|
|
|
|
si.SetLink(generateID())
|
|
|
|
|
|
|
|
return si
|
|
|
|
}
|