MCPcopy Create free account
hub / github.com/devfeel/dotweb / TestBinder_Bind_json_error

Function TestBinder_Bind_json_error

bind_test.go:67–107  ·  view source on GitHub ↗

json

(t *testing.T)

Source from the content-addressed store, hash-verified

65
66// json
67func TestBinder_Bind_json_error(t *testing.T) {
68
69 binder := newBinder()
70
71 if binder == nil {
72 t.Error("binder can not be nil!")
73 }
74
75 // init DotServer
76 app := New()
77
78 if app == nil {
79 t.Error("app can not be nil!")
80 }
81
82 // expected
83 expected := &Person{
84 Hair: "Brown",
85 HasGlass: true,
86 Age: 10,
87 Legs: []string{"Left", "Right"},
88 }
89
90 // init param
91 param := &InitContextParam{
92 t,
93 expected,
94 "application/xml",
95 test.ToJson,
96 }
97
98 // init param
99 context := initContext(param)
100 // actual
101 person := &Person{}
102
103 err := binder.Bind(person, context)
104
105 // check error must not nil
106 test.NotNil(t, err)
107}
108
109// xml
110func TestBinder_Bind_xml(t *testing.T) {

Callers

nothing calls this directly

Calls 6

NotNilFunction · 0.92
newBinderFunction · 0.85
NewFunction · 0.85
initContextFunction · 0.85
ErrorMethod · 0.65
BindMethod · 0.65

Tested by

no test coverage detected