Equality Comparison

When two maps are not equal, WebTau generates all the required info to investigate: Groovy Map<String, ?> generated = generate() generated.should == [firstName: "G-FN", lastName: "G-LN", address: [street: "generated-street", city: "GenCity", zipCode: "12345"]] X failed expecting [value] to equal { "firstName": "G-FN", "lastName": "G-LN", "address": {"street": "generated-street", "city": "GenCity", "zipCode": "12345"} }: mismatches: [value].address.city: actual: "GenSity" <java.lang.String> expected: "GenCity" <java.lang.String> ^ missing, but expected values: [value].address.zipCode: "12345" (0ms) { "firstName": "G-FN", "lastName": "G-LN", "address": {"street": "generated-street", "city": **"GenSity"**, "zipCode": **<missing>**} } Check matchers/import-and-dependencies Import And Dependencies for prerequisites. Java Map<String, ?> generated = generate(); actual(generated).should(equal(map("firstName", "G-FN", "lastName", "G-LN", "address", map("street", "generated-street", "city", "GenCity", "zipCode", "12345")))); X failed expecting [value] to equal { "firstName": "G-FN", "lastName": "G-LN", "address": {"street": "generated-street", "city": "GenCity", "zipCode": "12345"} }: mismatches: [value].address.city: actual: "GenSity" <java.lang.String> expected: "GenCity" <java.lang.String> ^ missing, but expected values: [value].address.zipCode: "12345" (0ms) { "firstName": "G-FN", "lastName": "G-LN", "address": {"street": "generated-street", "city": **"GenSity"**, "zipCode": **<missing>**} } Check matchers/import-and-dependencies Import And Dependencies for prerequisites.

Contain

Use contain matcher to check if one map is a subset of another: Groovy Map<String, ?> generated = generate() generated.should contain(firstName: "G-FN", lastName: "G-LN", middleName: "G-MN") X failed expecting [value] to contain {"firstName": "G-FN", "lastName": "G-LN", "middleName": "G-MD"}: missing values: [value].middleName: "G-MD" (1ms) { "firstName": "G-FN", "lastName": "G-LN", "address": {"street": "generated-street", "city": "GenSity"}, "middleName": **<missing>** } Java Map<String, ?> generated = generate(); actual(generated).should(contain( map("firstName", "G-FN", "lastName", "G-LN", "middleName", "G-MD"))); X failed expecting [value] to contain {"firstName": "G-FN", "lastName": "G-LN", "middleName": "G-MD"}: missing values: [value].middleName: "G-MD" (1ms) { "firstName": "G-FN", "lastName": "G-LN", "address": {"street": "generated-street", "city": "GenSity"}, "middleName": **<missing>** }