Skip to content

Commit 5bee462

Browse files
committed
add test
1 parent 42dc604 commit 5bee462

1 file changed

Lines changed: 12 additions & 1 deletion

File tree

schema/avro/schema/parser_json_test.go

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,14 @@ package schema_test
22

33
import (
44
"encoding/json"
5-
"github.com/stretchr/testify/require"
5+
"fmt"
6+
"math"
67
"mokapi/config/dynamic"
78
"mokapi/config/dynamic/dynamictest"
89
"mokapi/schema/avro/schema"
910
"testing"
11+
12+
"github.com/stretchr/testify/require"
1013
)
1114

1215
func TestParser_Parse_Json(t *testing.T) {
@@ -50,6 +53,14 @@ func TestParser_Parse_Json(t *testing.T) {
5053
require.EqualError(t, err, "invalid type, expected int but got float\nschema path #/type")
5154
},
5255
},
56+
{
57+
name: "not int32",
58+
input: fmt.Sprintf("%v", int64(math.MaxInt32)+1),
59+
schema: &schema.Schema{Type: []interface{}{"int"}},
60+
test: func(t *testing.T, v interface{}, err error) {
61+
require.EqualError(t, err, "integer value 2.147483648e+09 out of bounds for Avro int32\nschema path #/type")
62+
},
63+
},
5364
{
5465
name: "long",
5566
input: `123`,

0 commit comments

Comments
 (0)