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

Function TestBinder_Bind_xml_error

bind_test.go:158–196  ·  view source on GitHub ↗

xml

(t *testing.T)

Source from the content-addressed store, hash-verified

156
157// xml
158func TestBinder_Bind_xml_error(t *testing.T) {
159
160 binder := newBinder()
161
162 if binder == nil {
163 t.Error("binder can not be nil!")
164 }
165
166 // init DotServer
167 app := New()
168
169 if app == nil {
170 t.Error("app can not be nil!")
171 }
172
173 // expected
174 expected := &Person{
175 Hair: "Brown",
176 HasGlass: true,
177 Age: 10,
178 Legs: []string{"Left", "Right"},
179 }
180 param := &InitContextParam{
181 t,
182 expected,
183 "application/json",
184 test.ToXML,
185 }
186
187 // init param
188 context := initContext(param)
189 // actual
190 person := &Person{}
191
192 err := binder.Bind(person, context)
193
194 // check error must not nil
195 test.NotNil(t, err)
196}
197
198// else
199func TestBinder_Bind_default(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