func (m *Msg) AssertErrorCode(code string) *Msg {
	m.AssertNoPath("result")
	c := m.PathPayload("error.code")
	s, ok := c.(string)
	if !ok {
		m.c.t.Fatalf("expected error code to be a string, but got type:\n%T", c)
	}
	if s != code {
		m.c.t.Fatalf("expected response error code to be:\n%#v\nbut got:\n%#v", code, c)
	}
	return m
}
AssertErrorCode asserts that the response has the expected error code.
package restest
import (
	"bytes"
	"encoding/json"
	"fmt"
	"reflect"
	"strings"
	res "github.com/jirenius/go-res"
	nats "github.com/nats-io/nats.go"
)
type Msg struct {
	*nats.Msg
	c *MockConn
}
type ParallelMsgs struct {
	c    *MockConn
	msgs []*Msg
}
func (m *Msg) Equals(subject string, payload interface{}) *Msg {
	m.AssertSubject(subject)
	m.AssertPayload(payload)
	return m
}
func (m *Msg) Payload() interface{} {
	var p interface{}
	if len(m.Data) > 0 {
		err := json.Unmarshal(m.Data, &p)
		if err != nil {
			panic("test: error unmarshaling msg data: " + err.Error())
		}
	}
	return p
}
func (m *Msg) AssertSubject(subject string) *Msg {
	AssertEqualJSON(m.c.t, "subject", subject, m.Subject)
	return m
}
func (m *Msg) AssertPayload(payload interface{}) *Msg {
	var err error
	pj, err := json.Marshal(payload)
	if err != nil {
		panic("test: error marshaling assertion payload: " + err.Error())
	}
	var p interface{}
	err = json.Unmarshal(pj, &p)
	if err != nil {
		panic("test: error unmarshaling assertion payload: " + err.Error())
	}
	if !reflect.DeepEqual(p, m.Payload()) {
		m.c.t.Fatalf("expected message payload to be:\n%s\nbut got:\n%s", pj, m.Data)
	}
	return m
}
func (m *Msg) AssertRawPayload(payload []byte) *Msg {
	if !bytes.Equal(payload, m.Data) {
		m.c.t.Fatalf("expected message payload to be:\n%s\nbut got:\n%s", payload, m.Data)
	}
	return m
}
func (m *Msg) AssertResult(result interface{}) *Msg {
	m.AssertNoPath("error")
	mr := m.PathPayload("result")
	AssertEqualJSON(m.c.t, "response result", mr, result)
	return m
}
func (m *Msg) AssertResource(rid string) *Msg {
	m.AssertNoPath("error")
	m.AssertNoPath("result")
	mr := m.PathPayload("resource")
	AssertEqualJSON(m.c.t, "response resource", mr, res.Ref(rid))
	return m
}
func (m *Msg) AssertError(rerr *res.Error) *Msg {
	m.AssertNoPath("result")
	me := m.PathPayload("error")
	AssertEqualJSON(m.c.t, "response error", me, rerr)
	return m
}