Documentation ¶
Index ¶
- func HaveErrorCode(typeCode int64) types.GomegaMatcher
- func HaveErrorSubTypeCode(typeCode int64) types.GomegaMatcher
- func HaveErrorTypeCode(typeCode int64) types.GomegaMatcher
- func HaveJsonPath(jsonPath string) types.GomegaMatcher
- func HaveJsonPathWithValue(jsonPath string, value interface{}) types.GomegaMatcher
- func IsError(expected error) types.GomegaMatcher
- type GomegaErrorMatcher
- type GomegaJsonPathMatcher
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HaveErrorCode ¶
func HaveErrorCode(typeCode int64) types.GomegaMatcher
HaveErrorCode returns a types.GomegaMatcher that matches errorutils.CodedError with given code the code and code mask is reported in the failure message
func HaveErrorSubTypeCode ¶
func HaveErrorSubTypeCode(typeCode int64) types.GomegaMatcher
HaveErrorSubTypeCode returns a types.GomegaMatcher that matches errorutils.CodedError with given sub-type code the code and code mask is reported in the failure message
func HaveErrorTypeCode ¶
func HaveErrorTypeCode(typeCode int64) types.GomegaMatcher
HaveErrorTypeCode returns a types.GomegaMatcher that matches errorutils.CodedError with given top-level type code the code and code mask is reported in the failure message
func HaveJsonPath ¶
func HaveJsonPath(jsonPath string) types.GomegaMatcher
HaveJsonPath returns a gomega matcher, similar to HaveJsonPathWithValue HaveJsonPath succeed only if the specified JSONPath yield non-empty result from actual JSON string.
Following statements are equivalent:
Expect(jsonStr).To(HaveJsonPath("$..status")) Expect(jsonStr).To(HaveJsonPath("$..status", gomega.Not(gomega.BeEmpty)))
func HaveJsonPathWithValue ¶
func HaveJsonPathWithValue(jsonPath string, value interface{}) types.GomegaMatcher
HaveJsonPathWithValue returns a gomega matcher. This matcher extract fields from JSON string using JSONPath, and assert that if the result slice matches the expected value
"value" can be following types: - types.GomegaMatcher, then the given matcher is directly applied to the slice resulted from JSONPath searching - any non-matcher type, HaveJsonPathWithValue by default use gomega.ContainElements(gomega.Equal(expected)) on any non-matcher value
Following statements are equivalent:
Expect(jsonStr).To(HaveJsonPathWithValue("$..status", "GOOD")) Expect(jsonStr).To(HaveJsonPathWithValue("$..status", gomega.ContainElements(gomega.Equal("GOOD"))))
func IsError ¶
func IsError(expected error) types.GomegaMatcher
IsError returns a types.GomegaMatcher that matches specified error. If the expected error is an errorutils.ErrorCoder the code and code mask is reported in the failure message
Types ¶
type GomegaErrorMatcher ¶
type GomegaErrorMatcher struct {
// contains filtered or unexported fields
}
GomegaErrorMatcher implements types.GomegaMatcher for error type
func (*GomegaErrorMatcher) FailureMessage ¶
func (m *GomegaErrorMatcher) FailureMessage(actual interface{}) (message string)
func (*GomegaErrorMatcher) Match ¶
func (m *GomegaErrorMatcher) Match(actual interface{}) (success bool, err error)
func (*GomegaErrorMatcher) NegatedFailureMessage ¶
func (m *GomegaErrorMatcher) NegatedFailureMessage(actual interface{}) (message string)
type GomegaJsonPathMatcher ¶
type GomegaJsonPathMatcher struct {
// contains filtered or unexported fields
}
func (*GomegaJsonPathMatcher) FailureMessage ¶
func (m *GomegaJsonPathMatcher) FailureMessage(actual interface{}) (message string)
func (*GomegaJsonPathMatcher) Match ¶
func (m *GomegaJsonPathMatcher) Match(actual interface{}) (success bool, err error)
func (*GomegaJsonPathMatcher) NegatedFailureMessage ¶
func (m *GomegaJsonPathMatcher) NegatedFailureMessage(actual interface{}) (message string)