From ea0703e089f5df26b0b489f4e2335d0e9a2ad3a3 Mon Sep 17 00:00:00 2001 From: Evgeniy Kulikov Date: Mon, 16 Mar 2020 18:34:56 +0300 Subject: [PATCH] add tests case to prevent npe --- object/service_test.go | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 object/service_test.go diff --git a/object/service_test.go b/object/service_test.go new file mode 100644 index 0000000..f06e557 --- /dev/null +++ b/object/service_test.go @@ -0,0 +1,28 @@ +package object + +import ( + "fmt" + "testing" + + "github.com/stretchr/testify/require" +) + +func TestRequest(t *testing.T) { + cases := []Request{ + &PutRequest{}, + &GetRequest{}, + &HeadRequest{}, + &SearchRequest{}, + &DeleteRequest{}, + &GetRangeRequest{}, + &GetRangeHashRequest{}, + } + + for i := range cases { + v := cases[i] + + t.Run(fmt.Sprintf("%T", v), func(t *testing.T) { + require.NotPanics(t, func() { v.CID() }) + }) + } +}