{"modulePath":"github.com/muonsoft/api-testing","version":"v0.12.0","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package assertjson\n\nPackage assertjson provides methods for testing JSON values. Nodes are selected by path elements passed to Node and At.\n\n## Functions\n\n```go\nfunc FileHas(t TestingT, filename string, jsonAssert JSONAssertFunc) bool\n```\nFileHas loads JSON from file and runs user callback for testing its nodes.\n\n```go\nfunc FileLinesHas(t TestingT, filename string, linesAssert LinesAssertFunc) bool\n```\nFileLinesHas reads a file as JSON Lines and runs the callback for asserting lines.\n\n```go\nfunc Has(t TestingT, data []byte, jsonAssert JSONAssertFunc) bool\n```\nHas - loads JSON from byte slice and runs user callback for testing its nodes.\n\n```go\nfunc LinesHas(t TestingT, data []byte, linesAssert LinesAssertFunc) bool\n```\nLinesHas parses data as JSON Lines and runs the callback for asserting lines. Returns false if t has already failed.\n\n```go\nfunc SignHS256JWT(claims JWTMapClaims, secret []byte) (string, error)\n```\nSignHS256JWT builds a compact HS256 JWT for tests.\n\n## Types\n\n```go\ntype ArrayAssertion struct {\n\t// contains filtered or unexported fields\n}\n```\nArrayAssertion is used to build a chain of assertions for the array node.\n\n```go\nfunc (a *ArrayAssertion) Length() int\n```\nLength returns array underlying array length.\n\n```go\nfunc (a *ArrayAssertion) WithLength(expected int, msgAndArgs ...interface{}) *ArrayAssertion\n```\nWithLength asserts that the JSON node is an array with length equal to the given value.\n\n```go\nfunc (a *ArrayAssertion) WithLengthGreaterThan(expected int, msgAndArgs ...interface{}) *ArrayAssertion\n```\nWithLengthGreaterThan asserts that the JSON node is an array with length greater than the value.\n\n```go\nfunc (a *ArrayAssertion) WithLengthGreaterThanOrEqual(expected int, msgAndArgs ...interface{}) *ArrayAssertion\n```\nWithLengthGreaterThanOrEqual asserts that the JSON node is an array with length greater than or equal to the value.\n\n```go\nfunc (a *ArrayAssertion) WithLengthLessThan(expected int, msgAndArgs ...interface{}) *ArrayAssertion\n```\nWithLengthLessThan asserts that the JSON node is an array with length less than the value.\n\n```go\nfunc (a *ArrayAssertion) WithLengthLessThanOrEqual(expected int, msgAndArgs ...interface{}) *ArrayAssertion\n```\nWithLengthLessThanOrEqual asserts that the JSON node is an array with length less than or equal to the value.\n\n```go\nfunc (a *ArrayAssertion) WithUniqueElements(msgAndArgs ...interface{}) *ArrayAssertion\n```\nWithUniqueElements asserts that the JSON node is an array with unique elements.\n\n```go\ntype AssertJSON struct {\n\t// contains filtered or unexported fields\n}\n```\nAssertJSON - main structure that holds parsed JSON.\n\n```go\nfunc NewAssertJSON(t TestingT, message string, data interface{}) *AssertJSON\n```\n\n```go\nfunc (j *AssertJSON) At(path ...interface{}) *AssertJSON\n```\nAt is used to test assertions on some node in a batch. It returns AssertJSON object on that node.\n\n```go\nfunc (j *AssertJSON) Node(path ...interface{}) *AssertNode\n```\nNode searches for JSON node by JSON Path Syntax. Returns struct for asserting the node values.\n\n```go\ntype AssertJSONLines struct {\n\t// contains filtered or unexported fields\n}\n```\nAssertJSONLines holds parsed JSON Lines for assertion.\n\n```go\nfunc FileLines(t TestingT, filename string) *AssertJSONLines\n```\nFileLines reads a file as JSON Lines and returns AssertJSONLines.\n\n```go\nfunc Lines(t TestingT, data []byte) *AssertJSONLines\n```\nLines parses data as JSON Lines and returns AssertJSONLines for further use. Use Has() to run assertions in a callback, or call At(), Len(), WithLength() directly.\n\n```go\nfunc (l *AssertJSONLines) At(index int) *AssertJSON\n```\nAt returns AssertJSON for the line at the given index (0-based). Fails the test if index is out of range.\n\n```go\nfunc (l *AssertJSONLines) Has(linesAssert LinesAssertFunc) bool\n```\nHas runs the callback with this AssertJSONLines. Returns false if t has already failed.\n\n```go\nfunc (l *AssertJSONLines) Len() int\n```\nLen returns the number of parsed lines.\n\n```go\nfunc (l *AssertJSONLines) WithLength(expected int) *AssertJSONLines\n```\nWithLength asserts that the number of lines equals expected. Returns l for chaining.\n\n```go\ntype AssertNode struct {\n\t// contains filtered or unexported fields\n}\n```\nAssertNode - structure for asserting JSON node.\n\n```go\nfunc (node *AssertNode) ArrayLength() int\n```\nArrayLength asserts that JSON node is array and return its length. It is an alias for IsArray().Length().\n\n```go\nfunc (node *AssertNode) Assert(jsonAssert JSONAssertFunc)\n```\nAssert executes JSON assertion on the current node value. This is useful when creating reusable assertion using functions.\n\n```go\nfunc (node *AssertNode) Contains(contain string, msgAndArgs ...interface{})\n```\nContains asserts that the JSON node has a string value that contains a string.\n\n```go\nfunc (node *AssertNode) DoesNotContain(contain string, msgAndArgs ...interface{})\n```\nDoesNotContain asserts that the JSON node has a string value that does not contain a string.\n\n```go\nfunc (node *AssertNode) DoesNotExist(msgAndArgs ...interface{})\n```\nDoesNotExist asserts that the JSON node does not exist.\n\n```go\nfunc (node *AssertNode) DoesNotMatch(regexp interface{}, msgAndArgs ...interface{})\n```\nDoesNotMatch asserts that the JSON node has a string value that does not match the regular expression.\n\n```go\nfunc (node *AssertNode) EqualJSON(expected string, msgAndArgs ...interface{})\n```\nEqualJSON asserts that node is equal to JSON string.\n\n```go\nfunc (node *AssertNode) Exists(msgAndArgs ...interface{}) bool\n```\nExists asserts that the JSON node exists. Returns true if node exists.\n\n```go\nfunc (node *AssertNode) Float() float64\n```\nFloat returns the JSON node value as a 64-bit float. If node does not exist it returns a zero. If node value is not numeric, it logs the error and returns a zero value.\n\n```go\nfunc (node *AssertNode) ForEach(assertNode func(node *AssertNode))\n```\nForEach executes callback function for node assertion on each array or object node.\n\n```go\nfunc (node *AssertNode) Integer() int\n```\nInteger returns the JSON node value as an integer. If node does not exist it returns a zero. If node value is not an integer, it logs the error and returns a zero value.\n\n```go\nfunc (node *AssertNode) IsArray(msgAndArgs ...interface{}) *ArrayAssertion\n```\nIsArray asserts that the JSON node is an array. It returns ArrayAssertion to execute a chain of assertions for the node value.\n\n```go\nfunc (node *AssertNode) IsDate(msgAndArgs ...interface{}) *TimeAssertion\n```\nIsDate asserts that the JSON node has a string value with date in \"YYYY-MM-DD\" format.\n\n```go\nfunc (node *AssertNode) IsEmail(msgAndArgs ...interface{})\n```\nIsEmail asserts that the JSON node has a string value with email. Validation is based on simplified pattern. It allows all values with an \"@\" symbol in, and a \".\" in the second host part of the email address.\n\n```go\nfunc (node *AssertNode) IsFalse(msgAndArgs ...interface{})\n```\nIsFalse asserts that the JSON node equals to the boolean with \\`false\\` value.\n\n```go\nfunc (node *AssertNode) IsFloat(msgAndArgs ...interface{}) *NumberAssertion\n```\nIsFloat asserts that the JSON node has a float value. It returns NumberAssertion to execute a chain of assertions for the node value.\n\n```go\nfunc (node *AssertNode) IsHTML5Email(msgAndArgs ...interface{})\n```\nIsHTML5Email asserts that the JSON node has a string value with email. Validation is based on pattern for HTML5 (see [https://html.spec.whatwg.org/multipage/input.html#valid-e-mail-address](https://html.spec.whatwg.org/multipage/input.html#valid-e-mail-address)).\n\n```go\nfunc (node *AssertNode) IsInteger(msgAndArgs ...interface{}) *IntegerAssertion\n```\nIsInteger asserts that the JSON node has an integer value. It returns IntegerAssertion to execute a chain of assertions for the node value.\n\n```go\nfunc (node *AssertNode) IsJWT(keyFunc JWTKeyFunc, msgAndArgs ...interface{}) *JWTAssertion\n```\nIsJWT asserts that the JSON node has a string value with JWT.\n\n```go\nfunc (node *AssertNode) IsNotNull(msgAndArgs ...interface{})\n```\nIsNotNull asserts that the JSON node not equals to \\`null\\` value.\n\n```go\nfunc (node *AssertNode) IsNull(msgAndArgs ...interface{})\n```\nIsNull asserts that the JSON node equals to \\`null\\` value.\n\n```go\nfunc (node *AssertNode) IsNumber(msgAndArgs ...interface{}) *NumberAssertion\n```\nIsNumber asserts that the JSON node has a float value. It returns NumberAssertion to execute a chain of assertions for the node value.\n\n```go\nfunc (node *AssertNode) IsObject(msgAndArgs ...interface{}) *ObjectAssertion\n```\nIsObject asserts that the JSON node is an object. It returns ObjectAssertion to execute a chain of assertions for the node value.\n\n```go\nfunc (node *AssertNode) IsString(msgAndArgs ...interface{}) *StringAssertion\n```\nIsString asserts that the JSON node has a string value. It returns StringAssertion to execute a chain of assertions for the node value.\n\n```go\nfunc (node *AssertNode) IsStrings(msgAndArgs ...interface{}) *StringsAssertion\n```\nIsStrings asserts that the JSON node is an array of strings. It returns StringsAssertion to execute a chain of assertions for the node value.\n\n```go\nfunc (node *AssertNode) IsTime(msgAndArgs ...interface{}) *TimeAssertion\n```\nIsTime asserts that the JSON node has a string value with time in RFC3339 format.\n\n```go\nfunc (node *AssertNode) IsTimeWithLayout(layout string, msgAndArgs ...interface{}) *TimeAssertion\n```\nIsTimeWithLayout asserts that the JSON node has a string value with time with the given layout.\n\n```go\nfunc (node *AssertNode) IsTrue(msgAndArgs ...interface{})\n```\nIsTrue asserts that the JSON node equals to the boolean with \\`true\\` value.\n\n```go\nfunc (node *AssertNode) IsURL(msgAndArgs ...interface{}) *URLAssertion\n```\nIsURL asserts that the JSON node has a string value with URL.\n\n```go\nfunc (node *AssertNode) IsUUID(msgAndArgs ...interface{}) *UUIDAssertion\n```\nIsUUID asserts that the JSON node has a string value with UUID.\n\n```go\nfunc (node *AssertNode) JSON() []byte\n```\nJSON returns the JSON node value as a marshaled JSON.\n\n```go\nfunc (node *AssertNode) JWT(keyFunc JWTKeyFunc) *JWTToken\n```\nJWT asserts that the JSON node is JWT and returns decoded JWT. If value is not a valid JWT, then it will return empty struct. It is an alias for IsJWT().Value().\n\n```go\nfunc (node *AssertNode) Matches(regexp interface{}, msgAndArgs ...interface{})\n```\nMatches asserts that the JSON node has a string value that matches the regular expression.\n\n```go\nfunc (node *AssertNode) ObjectPropertiesCount() int\n```\nObjectPropertiesCount asserts that JSON node is an object and return its properties count. It is an alias for IsObject().PropertiesCount().\n\n```go\nfunc (node *AssertNode) Print()\n```\n\n```go\nfunc (node *AssertNode) String() string\n```\nString returns the JSON node value as a string. If node does not exist it returns an empty string. If the node value is an integer it returns a formatted integer. If the node value is a float it returns a formatted float. Otherwise, it logs the error and returns an empty string.\n\n```go\nfunc (node *AssertNode) Time() time.Time\n```\nTime asserts that the JSON node is time.Time and returns its value. If string is not a valid time it returns empty time. It is an alias for IsTime().Value().\n\n```go\nfunc (node *AssertNode) TimeWithLayout(layout string) time.Time\n```\nTimeWithLayout asserts that the JSON node is time.Time with specific layout and returns its value. If string is not a valid time it returns empty time. It is an alias for IsTimeWithLayout().Value().\n\n```go\nfunc (node *AssertNode) UUID() uuid.UUID\n```\nUUID asserts that the JSON node is UUID and returns its value. If value is not a valid UUID, then it will return nil UUID. It is an alias for IsUUID().Value().\n\n```go\nfunc (node *AssertNode) Value() interface{}\n```\nValue returns JSON node value as an interface. If node does not exist it returns nil.\n\n```go\ntype IntegerAssertion struct {\n\t// contains filtered or unexported fields\n}\n```\nIntegerAssertion is used to build a chain of assertions for the integer node.\n\n```go\nfunc (a *IntegerAssertion) EqualTo(expected int, msgAndArgs ...interface{}) *IntegerAssertion\n```\nEqualTo asserts that the JSON node has an integer value equals to the given value.\n\n```go\nfunc (a *IntegerAssertion) GreaterThan(expected int, msgAndArgs ...interface{}) *IntegerAssertion\n```\nGreaterThan asserts that the JSON node has an integer value greater than the given value.\n\n```go\nfunc (a *IntegerAssertion) GreaterThanOrEqual(expected int, msgAndArgs ...interface{}) *IntegerAssertion\n```\nGreaterThanOrEqual asserts that the JSON node has an integer value greater than or equal to the given value.\n\n```go\nfunc (a *IntegerAssertion) IsNotZero(msgAndArgs ...interface{}) *IntegerAssertion\n```\nIsNotZero asserts that the JSON node has an integer value not equals to 0.\n\n```go\nfunc (a *IntegerAssertion) IsZero(msgAndArgs ...interface{}) *IntegerAssertion\n```\nIsZero asserts that the JSON node has an integer value equals to 0.\n\n```go\nfunc (a *IntegerAssertion) LessThan(expected int, msgAndArgs ...interface{}) *IntegerAssertion\n```\nLessThan asserts that the JSON node has an integer value less than the given value.\n\n```go\nfunc (a *IntegerAssertion) LessThanOrEqual(expected int, msgAndArgs ...interface{}) *IntegerAssertion\n```\nLessThanOrEqual asserts that the JSON node has an integer value less than or equal to the given value.\n\n```go\nfunc (a *IntegerAssertion) NotEqualTo(expected int, msgAndArgs ...interface{}) *IntegerAssertion\n```\nNotEqualTo asserts that the JSON node has an integer value not equals to the given value.\n\n```go\ntype JSONAssertFunc func(json *AssertJSON)\n```\nJSONAssertFunc - callback function used for asserting JSON nodes.\n\n```go\ntype JWTAssertion struct {\n\t// contains filtered or unexported fields\n}\n```\nJWTAssertion is used to build a chain of assertions for the JWT node.\n\n```go\nfunc IsJWT(t TestingT, value string, keyFunc JWTKeyFunc) *JWTAssertion\n```\nIsJWT asserts that the string contains valid JWT.\n\n```go\nfunc (a *JWTAssertion) Assert(assertFunc func(tb testing.TB, token *JWTToken)) *JWTAssertion\n```\nAssert asserts that the JWT is satisfied by the user function assertFunc.\n\n```go\nfunc (a *JWTAssertion) Value() *JWTToken\n```\nValue returns decoded JWT. If parsing fails it will return empty struct.\n\n```go\nfunc (a *JWTAssertion) WithAlgorithm(alg string, msgAndArgs ...interface{}) *JWTAssertion\n```\nWithAlgorithm asserts that the JWT is signed with expected algorithm (\"alg\" header).\n\n```go\nfunc (a *JWTAssertion) WithAudience(expected []string, msgAndArgs ...interface{}) *JWTAssertion\n```\nWithAudience asserts that the JWT is has audience field (\"aud\" field in payload) with the expected values.\n\n```go\nfunc (a *JWTAssertion) WithExpiresAt() *TimeAssertion\n```\nWithExpiresAt asserts that the JWT is has expired at field (\"exp\" field in payload). It runs TimeAssertion on its value.\n\n```go\nfunc (a *JWTAssertion) WithHeader(jsonAssert JSONAssertFunc) *JWTAssertion\n```\nWithHeader executes JSON assertion on JWT header.\n\n```go\nfunc (a *JWTAssertion) WithID(expected string, msgAndArgs ...interface{}) *JWTAssertion\n```\nWithID asserts that the JWT is has id field (\"jti\" field in payload) with the expected value.\n\n```go\nfunc (a *JWTAssertion) WithIssuedAt() *TimeAssertion\n```\nWithIssuedAt asserts that the JWT is has issued at field (\"iat\" field in payload). It runs TimeAssertion on its value.\n\n```go\nfunc (a *JWTAssertion) WithIssuer(expected string, msgAndArgs ...interface{}) *JWTAssertion\n```\nWithIssuer asserts that the JWT is has issuer field (\"iss\" field in payload) with the expected value.\n\n```go\nfunc (a *JWTAssertion) WithNotBefore() *TimeAssertion\n```\nWithNotBefore asserts that the JWT is has not before field (\"nbf\" field in payload). It runs TimeAssertion on its value.\n\n```go\nfunc (a *JWTAssertion) WithPayload(jsonAssert JSONAssertFunc) *JWTAssertion\n```\nWithPayload executes JSON assertion on JWT payload.\n\n```go\nfunc (a *JWTAssertion) WithSubject(expected string, msgAndArgs ...interface{}) *JWTAssertion\n```\nWithSubject asserts that the JWT is has subject field (\"sub\" field in payload) with the expected value.\n\n```go\ntype JWTKeyFunc func(token *JWTToken) (interface{}, error)\n```\nJWTKeyFunc supplies the verification key while parsing a JWT string.\n\n```go\ntype JWTMapClaims map[string]interface{}\n```\nJWTMapClaims is the decoded JWT payload used in assertions and test helpers.\n\n```go\ntype JWTToken struct {\n\tRaw    string\n\tHeader map[string]interface{}\n\tClaims JWTMapClaims\n\t// contains filtered or unexported fields\n}\n```\nJWTToken is a parsed and verified JWT exposed to test code.\n\n```go\nfunc WrapJWTToken(token *ijwt.Token) *JWTToken\n```\nWrapJWTToken maps an internal parsed token to the public assertion type.\n\n```go\nfunc (t *JWTToken) Algorithm() string\n```\nAlgorithm returns the JWT \"alg\" header value.\n\n```go\ntype LinesAssertFunc func(lines *AssertJSONLines)\n```\nLinesAssertFunc is a callback function used for asserting JSON Lines.\n\n```go\ntype NumberAssertion struct {\n\t// contains filtered or unexported fields\n}\n```\nNumberAssertion is used to build a chain of assertions for the numeric node.\n\n```go\nfunc (a *NumberAssertion) EqualTo(expected float64, msgAndArgs ...interface{}) *NumberAssertion\n```\nEqualTo asserts that the JSON node has a numeric value equals to the given value.\n\n```go\nfunc (a *NumberAssertion) EqualToWithDelta(expected, delta float64, msgAndArgs ...interface{}) *NumberAssertion\n```\nEqualToWithDelta asserts that the JSON node has a numeric value equals to the given value with delta.\n\n```go\nfunc (a *NumberAssertion) GreaterThan(expected float64, msgAndArgs ...interface{}) *NumberAssertion\n```\nGreaterThan asserts that the JSON node has a numeric value greater than the given value.\n\n```go\nfunc (a *NumberAssertion) GreaterThanOrEqual(expected float64, msgAndArgs ...interface{}) *NumberAssertion\n```\nGreaterThanOrEqual asserts that the JSON node has a numeric value greater than or equal to the given value.\n\n```go\nfunc (a *NumberAssertion) IsNotZero(msgAndArgs ...interface{}) *NumberAssertion\n```\nIsNotZero asserts that the JSON node has a numeric value not equals to zero.\n\n```go\nfunc (a *NumberAssertion) IsZero(msgAndArgs ...interface{}) *NumberAssertion\n```\nIsZero asserts that the JSON node has a numeric value equals to zero.\n\n```go\nfunc (a *NumberAssertion) LessThan(expected float64, msgAndArgs ...interface{}) *NumberAssertion\n```\nLessThan asserts that the JSON node has a numeric value less than the given value.\n\n```go\nfunc (a *NumberAssertion) LessThanOrEqual(expected float64, msgAndArgs ...interface{}) *NumberAssertion\n```\nLessThanOrEqual asserts that the JSON node has a numeric value less than or equal to the given value.\n\n```go\nfunc (a *NumberAssertion) NotEqualTo(expected float64, msgAndArgs ...interface{}) *NumberAssertion\n```\nNotEqualTo asserts that the JSON node has a numeric value not equals to the given value.\n\n```go\ntype ObjectAssertion struct {\n\t// contains filtered or unexported fields\n}\n```\nObjectAssertion is used to build a chain of assertions for the object node.\n\n```go\nfunc (a *ObjectAssertion) PropertiesCount() int\n```\nPropertiesCount returns array underlying object properties count.\n\n```go\nfunc (a *ObjectAssertion) WithPropertiesCount(expected int, msgAndArgs ...interface{}) *ObjectAssertion\n```\nWithPropertiesCount asserts that the JSON node is an object with properties count equal to the given value.\n\n```go\nfunc (a *ObjectAssertion) WithPropertiesCountGreaterThan(expected int, msgAndArgs ...interface{}) *ObjectAssertion\n```\nWithPropertiesCountGreaterThan asserts that the JSON node is an object with properties count greater than the value.\n\n```go\nfunc (a *ObjectAssertion) WithPropertiesCountGreaterThanOrEqual(expected int, msgAndArgs ...interface{}) *ObjectAssertion\n```\nWithPropertiesCountGreaterThanOrEqual asserts that the JSON node is an object with propertiesCount greater than or equal to the value.\n\n```go\nfunc (a *ObjectAssertion) WithPropertiesCountLessThan(expected int, msgAndArgs ...interface{}) *ObjectAssertion\n```\nWithPropertiesCountLessThan asserts that the JSON node is an object with properties count less than the value.\n\n```go\nfunc (a *ObjectAssertion) WithPropertiesCountLessThanOrEqual(expected int, msgAndArgs ...interface{}) *ObjectAssertion\n```\nWithPropertiesCountLessThanOrEqual asserts that the JSON node is an object with properties count less than or equal to the value.\n\n```go\nfunc (a *ObjectAssertion) WithUniqueElements(msgAndArgs ...interface{}) *ObjectAssertion\n```\nWithUniqueElements asserts that the JSON node is an object with unique elements.\n\n```go\ntype StringAssertion struct {\n\t// contains filtered or unexported fields\n}\n```\nStringAssertion is used to build a chain of assertions for the string node.\n\n```go\nfunc (a *StringAssertion) Assert(assertFunc func(tb testing.TB, value string)) *StringAssertion\n```\nAssert asserts that the string node has that is satisfied by the user function assertFunc.\n\n```go\nfunc (a *StringAssertion) Contains(value string, msgAndArgs ...interface{}) *StringAssertion\n```\nContains asserts that the JSON node has a string value that contains a string.\n\n```go\nfunc (a *StringAssertion) EqualTo(expectedValue string, msgAndArgs ...interface{}) *StringAssertion\n```\nEqualTo asserts that the JSON node has a string value equals to the given value.\n\n```go\nfunc (a *StringAssertion) EqualToOneOf(expectedValues ...string) *StringAssertion\n```\nEqualToOneOf asserts that the JSON node has a string value equals to one of the given values.\n\n```go\nfunc (a *StringAssertion) IsEmpty(msgAndArgs ...interface{}) *StringAssertion\n```\nIsEmpty asserts that the JSON node has a string value equals to empty string.\n\n```go\nfunc (a *StringAssertion) IsNotEmpty(msgAndArgs ...interface{}) *StringAssertion\n```\nIsNotEmpty asserts that the JSON node has a string value not equals to empty string.\n\n```go\nfunc (a *StringAssertion) Matches(regexp interface{}, msgAndArgs ...interface{}) *StringAssertion\n```\nMatches asserts that the JSON node has a string value that matches the regular expression.\n\n```go\nfunc (a *StringAssertion) NotContains(value string, msgAndArgs ...interface{}) *StringAssertion\n```\nNotContains asserts that the JSON node has a string value that does not contain a string.\n\n```go\nfunc (a *StringAssertion) NotEqualTo(expectedValue string, msgAndArgs ...interface{}) *StringAssertion\n```\nNotEqualTo asserts that the JSON node has a string value not equals to the given value.\n\n```go\nfunc (a *StringAssertion) NotMatches(regexp interface{}, msgAndArgs ...interface{}) *StringAssertion\n```\nNotMatches asserts that the JSON node has a string value that does not match the regular expression.\n\n```go\nfunc (a *StringAssertion) That(f func(s string) error, msgAndArgs ...interface{}) *StringAssertion\n```\nThat asserts that the JSON node has a string value that is satisfied by callback function.\n\n```go\nfunc (a *StringAssertion) WithDate(msgAndArgs ...interface{}) *TimeAssertion\n```\nWithDate asserts that the JSON node has a string value with date in \"YYYY-MM-DD\" format.\n\n```go\nfunc (a *StringAssertion) WithEmail(msgAndArgs ...interface{}) *StringAssertion\n```\nWithEmail asserts that the JSON node has a string value with email. Validation is based on simplified pattern. It allows all values with an \"@\" symbol in, and a \".\" in the second host part of the email address.\n\n```go\nfunc (a *StringAssertion) WithHTML5Email(msgAndArgs ...interface{}) *StringAssertion\n```\nWithHTML5Email asserts that the JSON node has a string value with email. Validation is based on pattern for HTML5 (see [https://html.spec.whatwg.org/multipage/input.html#valid-e-mail-address](https://html.spec.whatwg.org/multipage/input.html#valid-e-mail-address)).\n\n```go\nfunc (a *StringAssertion) WithInteger(msgAndArgs ...interface{}) *IntegerAssertion\n```\nWithInteger asserts that the JSON node has a string value that represents a decimal integer. It returns IntegerAssertion to execute a chain of assertions for the parsed value.\n\n```go\nfunc (a *StringAssertion) WithJSON(jsonAssert JSONAssertFunc) *StringAssertion\n```\nWithJSON asserts that the JSON node has a string value with JSON.\n\n```go\nfunc (a *StringAssertion) WithJWT(keyFunc JWTKeyFunc, msgAndArgs ...interface{}) *JWTAssertion\n```\nWithJWT asserts that the JSON node has a string value with JWT.\n\n```go\nfunc (a *StringAssertion) WithLength(length int, msgAndArgs ...interface{}) *StringAssertion\n```\nWithLength asserts that the JSON node has a string value with length equal to the given value.\n\n```go\nfunc (a *StringAssertion) WithLengthGreaterThan(expected int, msgAndArgs ...interface{}) *StringAssertion\n```\nWithLengthGreaterThan asserts that the JSON node has a string value with length greater than the value.\n\n```go\nfunc (a *StringAssertion) WithLengthGreaterThanOrEqual(expected int, msgAndArgs ...interface{}) *StringAssertion\n```\nWithLengthGreaterThanOrEqual asserts that the JSON node has a string value with length greater than or equal to the value.\n\n```go\nfunc (a *StringAssertion) WithLengthLessThan(expected int, msgAndArgs ...interface{}) *StringAssertion\n```\nWithLengthLessThan asserts that the JSON node has a string value with length less than the value.\n\n```go\nfunc (a *StringAssertion) WithLengthLessThanOrEqual(expected int, msgAndArgs ...interface{}) *StringAssertion\n```\nWithLengthLessThanOrEqual asserts that the JSON node has a string value with length less than or equal to the value.\n\n```go\nfunc (a *StringAssertion) WithNumber(msgAndArgs ...interface{}) *NumberAssertion\n```\nWithNumber asserts that the JSON node has a string value that represents a number (integer or float). It returns NumberAssertion to execute a chain of assertions for the parsed value.\n\n```go\nfunc (a *StringAssertion) WithPrefix(prefix string, msgAndArgs ...interface{}) *StringAssertion\n```\nWithPrefix asserts that the JSON node has a string value with the given prefix.\n\n```go\nfunc (a *StringAssertion) WithSuffix(suffix string, msgAndArgs ...interface{}) *StringAssertion\n```\nWithSuffix asserts that the JSON node has a string value with the given suffix.\n\n```go\nfunc (a *StringAssertion) WithTime(msgAndArgs ...interface{}) *TimeAssertion\n```\nWithTime asserts that the JSON node has a string value with time in RFC3339 format.\n\n```go\nfunc (a *StringAssertion) WithTimeWithLayout(layout string, msgAndArgs ...interface{}) *TimeAssertion\n```\nWithTimeWithLayout asserts that the JSON node has a string value with time with the given layout.\n\n```go\nfunc (a *StringAssertion) WithURL(msgAndArgs ...interface{}) *URLAssertion\n```\nWithURL asserts that the JSON node has a string value with URL.\n\n```go\nfunc (a *StringAssertion) WithUUID(msgAndArgs ...interface{}) *UUIDAssertion\n```\nWithUUID asserts that the JSON node has a string value with UUID.\n\n```go\ntype StringsAssertion struct {\n\t// contains filtered or unexported fields\n}\n```\nStringsAssertion is used to build a chain of assertions for the array of strings node.\n\n```go\nfunc (a *StringsAssertion) Assert(assertFunc func(tb testing.TB, values []string)) *StringsAssertion\n```\nAssert asserts that the array of strings is satisfied by the user function assertFunc.\n\n```go\nfunc (a *StringsAssertion) Contains(value string, msgAndArgs ...interface{}) *StringsAssertion\n```\nContains asserts that the array of strings contains the given value.\n\n```go\nfunc (a *StringsAssertion) EqualTo(expected ...string) *StringsAssertion\n```\nEqualTo asserts that the array of strings equals the given values (length and elements match).\n\n```go\nfunc (a *StringsAssertion) Length() int\n```\nLength returns the array of strings length.\n\n```go\nfunc (a *StringsAssertion) That(f func(values []string) error, msgAndArgs ...interface{}) *StringsAssertion\n```\nThat asserts that the array of strings is satisfied by the callback function.\n\n```go\nfunc (a *StringsAssertion) WithLength(expected int, msgAndArgs ...interface{}) *StringsAssertion\n```\nWithLength asserts that the array of strings has length equal to the given value.\n\n```go\nfunc (a *StringsAssertion) WithLengthGreaterThan(expected int, msgAndArgs ...interface{}) *StringsAssertion\n```\nWithLengthGreaterThan asserts that the array of strings has length greater than the value.\n\n```go\nfunc (a *StringsAssertion) WithLengthGreaterThanOrEqual(expected int, msgAndArgs ...interface{}) *StringsAssertion\n```\nWithLengthGreaterThanOrEqual asserts that the array of strings has length greater than or equal to the value.\n\n```go\nfunc (a *StringsAssertion) WithLengthLessThan(expected int, msgAndArgs ...interface{}) *StringsAssertion\n```\nWithLengthLessThan asserts that the array of strings has length less than the value.\n\n```go\nfunc (a *StringsAssertion) WithLengthLessThanOrEqual(expected int, msgAndArgs ...interface{}) *StringsAssertion\n```\nWithLengthLessThanOrEqual asserts that the array of strings has length less than or equal to the value.\n\n```go\nfunc (a *StringsAssertion) WithUniqueValues(msgAndArgs ...interface{}) *StringsAssertion\n```\nWithUniqueValues asserts that the array of strings has unique values.\n\n```go\ntype TestingT interface {\n\tHelper()\n\tErrorf(format string, args ...interface{})\n\tLog(args ...interface{})\n\tFailed() bool\n}\n```\nTestingT is an interface wrapper around \\*testing.T.\n\n```go\ntype TimeAssertion struct {\n\t// contains filtered or unexported fields\n}\n```\nTimeAssertion is used to build a chain of assertions for the time node.\n\n```go\nfunc (a *TimeAssertion) After(expected time.Time, msgAndArgs ...interface{}) *TimeAssertion\n```\nAfter asserts that the JSON node is time after the given time.\n\n```go\nfunc (a *TimeAssertion) AfterDate(year int, month time.Month, day int, msgAndArgs ...interface{}) *TimeAssertion\n```\nAfterDate asserts that the JSON node is time after the given date.\n\n```go\nfunc (a *TimeAssertion) AfterOrEqualTo(expected time.Time, msgAndArgs ...interface{}) *TimeAssertion\n```\nAfterOrEqualTo asserts that the JSON node is time after or equal to the given time.\n\n```go\nfunc (a *TimeAssertion) AfterOrEqualToDate(year int, month time.Month, day int, msgAndArgs ...interface{}) *TimeAssertion\n```\nAfterOrEqualToDate asserts that the JSON node is time after or equal to the given date.\n\n```go\nfunc (a *TimeAssertion) AtDate(year int, month time.Month, day int, msgAndArgs ...interface{}) *TimeAssertion\n```\nAtDate asserts that the JSON node is time between the beginning and the end of the given date.\n\n```go\nfunc (a *TimeAssertion) Before(expected time.Time, msgAndArgs ...interface{}) *TimeAssertion\n```\nBefore asserts that the JSON node is time before the given time.\n\n```go\nfunc (a *TimeAssertion) BeforeDate(year int, month time.Month, day int, msgAndArgs ...interface{}) *TimeAssertion\n```\nBeforeDate asserts that the JSON node is time before the given date.\n\n```go\nfunc (a *TimeAssertion) BeforeOrEqualTo(expected time.Time, msgAndArgs ...interface{}) *TimeAssertion\n```\nBeforeOrEqualTo asserts that the JSON node is time before or equal to the given time.\n\n```go\nfunc (a *TimeAssertion) BeforeOrEqualToDate(year int, month time.Month, day int, msgAndArgs ...interface{}) *TimeAssertion\n```\nBeforeOrEqualToDate asserts that the JSON node is time before or equal to the given date.\n\n```go\nfunc (a *TimeAssertion) EqualTo(expected time.Time, msgAndArgs ...interface{}) *TimeAssertion\n```\nEqualTo asserts that the JSON node is time equals to the given value.\n\n```go\nfunc (a *TimeAssertion) EqualToDate(year int, month time.Month, day int, msgAndArgs ...interface{}) *TimeAssertion\n```\nEqualToDate asserts that the JSON node is time equals to the given date.\n\n```go\nfunc (a *TimeAssertion) NotEqualTo(expected time.Time, msgAndArgs ...interface{}) *TimeAssertion\n```\nNotEqualTo asserts that the JSON node is time not equals to the given value.\n\n```go\nfunc (a *TimeAssertion) NotEqualToDate(year int, month time.Month, day int, msgAndArgs ...interface{}) *TimeAssertion\n```\nNotEqualToDate asserts that the JSON node is time not equals to the given date.\n\n```go\nfunc (a *TimeAssertion) Value() time.Time\n```\nValue returns JSON node value as time.Time. If string is not a valid time it returns empty time.\n\n```go\ntype URLAssertion struct {\n\t// contains filtered or unexported fields\n}\n```\nURLAssertion is used to build a chain of assertions for the URL node.\n\n```go\nfunc (a *URLAssertion) That(f func(u *url.URL) error, msgAndArgs ...interface{}) *URLAssertion\n```\nThat asserts that the JSON node has a URL value that is satisfied by callback function.\n\n```go\nfunc (a *URLAssertion) WithHosts(hosts ...string) *URLAssertion\n```\nWithHosts additionally asserts than URL host contains one of the given values.\n\n```go\nfunc (a *URLAssertion) WithSchemas(schemas ...string) *URLAssertion\n```\nWithSchemas additionally asserts than URL schema contains one of the given values.\n\n```go\ntype UUIDAssertion struct {\n\t// contains filtered or unexported fields\n}\n```\nUUIDAssertion is used to build a chain of assertions for the UUID node.\n\n```go\nfunc (a *UUIDAssertion) EqualTo(expected uuid.UUID, msgAndArgs ...interface{}) *UUIDAssertion\n```\nEqualTo asserts that the JSON node is UUID equals to the given value.\n\n```go\nfunc (a *UUIDAssertion) IsNil(msgAndArgs ...interface{}) *UUIDAssertion\n```\nIsNil asserts that the JSON node has a string value equals to nil UUID.\n\n```go\nfunc (a *UUIDAssertion) IsNotNil(msgAndArgs ...interface{}) *UUIDAssertion\n```\nIsNotNil asserts that the JSON node has a string value equals to not nil UUID.\n\n```go\nfunc (a *UUIDAssertion) NotEqualTo(expected uuid.UUID, msgAndArgs ...interface{}) *UUIDAssertion\n```\nNotEqualTo asserts that the JSON node is UUID not equals to the given value.\n\n```go\nfunc (a *UUIDAssertion) OfVariant(variant byte, msgAndArgs ...interface{}) *UUIDAssertion\n```\nOfVariant asserts that the JSON node has a string value equals to UUID with the given variant.\n\n```go\nfunc (a *UUIDAssertion) OfVersion(version byte, msgAndArgs ...interface{}) *UUIDAssertion\n```\nOfVersion asserts that the JSON node has a string value equals to UUID with the given version.\n\n```go\nfunc (a *UUIDAssertion) Value() uuid.UUID\n```\nValue returns JSON node value as UUID. If string is not a valid UUID it returns nil UUID.\n\n","path":"github.com/muonsoft/api-testing/assertjson","name":"assertjson","synopsis":"Package assertjson provides methods for testing JSON values.","isRedistributable":true}
