{"id":25776407,"url":"https://github.com/shazam/shazamcrest","last_synced_at":"2026-04-05T11:32:07.939Z","repository":{"id":7502173,"uuid":"8851918","full_name":"shazam/shazamcrest","owner":"shazam","description":"Reusable Hamcrest matchers suitable for automated testing","archived":false,"fork":false,"pushed_at":"2022-06-24T14:48:46.000Z","size":197,"stargazers_count":95,"open_issues_count":17,"forks_count":36,"subscribers_count":26,"default_branch":"master","last_synced_at":"2025-12-21T04:25:35.351Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/shazam.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-03-18T10:32:33.000Z","updated_at":"2025-10-10T08:12:20.000Z","dependencies_parsed_at":"2022-06-26T00:38:37.855Z","dependency_job_id":null,"html_url":"https://github.com/shazam/shazamcrest","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"purl":"pkg:github/shazam/shazamcrest","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shazam%2Fshazamcrest","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shazam%2Fshazamcrest/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shazam%2Fshazamcrest/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shazam%2Fshazamcrest/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shazam","download_url":"https://codeload.github.com/shazam/shazamcrest/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shazam%2Fshazamcrest/sbom","scorecard":{"id":817210,"data":{"date":"2025-08-11","repo":{"name":"github.com/shazam/shazamcrest","commit":"67a42d436811e25f85abe0788120ad9719c5a625"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2.3,"checks":[{"name":"Code-Review","score":1,"reason":"Found 4/27 approved changesets -- score normalized to 1","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":9,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Warn: project license file does not contain an FSF or OSI license."],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 8 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":4,"reason":"6 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-4jrv-ppp4-jm57","Warn: Project is vulnerable to: GHSA-5mg8-w23w-74h3","Warn: Project is vulnerable to: GHSA-7g45-4rm6-3mm3","Warn: Project is vulnerable to: GHSA-j288-q9x7-2f5v","Warn: Project is vulnerable to: GHSA-3vqj-43w4-2q58","Warn: Project is vulnerable to: GHSA-4jq9-2xhw-jpx7"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-23T14:30:42.337Z","repository_id":7502173,"created_at":"2025-08-23T14:30:42.337Z","updated_at":"2025-08-23T14:30:42.337Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31434624,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-05T08:13:15.228Z","status":"ssl_error","status_checked_at":"2026-04-05T08:13:11.839Z","response_time":75,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-02-27T06:01:23.249Z","updated_at":"2026-04-05T11:32:07.930Z","avatar_url":"https://github.com/shazam.png","language":"Java","funding_links":[],"categories":["测试"],"sub_categories":[],"readme":"Shazamcrest\n===========\n\n'Shazamcrest' is a library that extends the functionality of [hamcrest](http://hamcrest.org/).\n\nAssertions on complete beans are made simpler by serialising the actual and expected beans to json, and comparing\n  the two. The diagnostics are leveraging the comparison functionality of IDEs like Eclipse or IntelliJ.\n\n\nUsage\n-----\n\nHaving a Person bean with the following structure:\n\n\u003cpre\u003ePerson person\n    |-- String name\n    |-- String surname\n    |-- Address address\n        |-- String streetName\n        |-- int streetNumber\n        |-- String postcode\u003c/pre\u003e\n\nto compare two Person beans with Shazamcrest we would write:\n\n\u003ccode\u003eassertThat(actualPerson, sameBeanAs(expectedPerson));\u003c/code\u003e\n\ninstead of explicitly match every field of the bean and sub-beans:\n\n\u003cpre\u003e\u003ccode\u003eassertThat(actualPerson, allOf(\n        hasProperty(\"name\", equalTo(expectedPerson.name)),\n        hasProperty(\"surname\", equalTo(expectedPerson.surname)),\n        hasProperty(\"address\", allOf(\n            hasProperty(\"streetName\", equalTo(expectedPerson.address.streetName)),\n            hasProperty(\"streetNumber\", equalTo(expectedPerson.address.streetNumber)),\n            hasProperty(\"postcode\", equalTo(expectedPerson.address.postcode)))\n        )\n    ));\u003c/code\u003e\u003c/pre\u003e\n\n\nError Messages\n-----\n\nIf the person address streetName does not match the expectations, the following diagnostic message is displayed:\n\n\u003cpre\u003eorg.junit.ComparisonFailure: address.streetName\n        Expected: Via Roma\n    got: Via Veneto\n        expected:\u0026lt;... \"streetName\": \"Via [Roma]\",\n    \"streetNumber...\u0026gt; but was:\u0026lt;... \"streetName\": \"Via [Veneto]\",\n    \"streetNumber...\u0026gt;\u003c/pre\u003e\n\nThe exception thrown is a ComparisonFailure which can be used by IDEs like Eclipse and IntelliJ to display a visual representation of the differences.\n\n![Comparison failure diagnostic](/DiffScreenshot.png)\n\nNote: in order to get the ComparisonFailure on mismatch the \"assertThat\" to use is com.shazam.shazamcrest.MatcherAssert.assertThat \nrather than org.hamcrest.MatcherAssert.assertThat\n\n\nIgnoring fields\n-----\n\nIf we are not interested in matching the street name, we can ignore it by specifying the field path:\n\n\u003ccode\u003eassertThat(actualPerson, sameBeanAs(expectedPerson).ignoring(\"address.streetName\"));\u003c/code\u003e\n\nIf we want to match the address only by the postcode, we can ignore street name and number by specifying the fields name pattern:\n\n\u003ccode\u003eassertThat(actualPerson, sameBeanAs(expectedPerson).ignoring(startsWith(\"street\")));\u003c/code\u003e\n\nwhere startsWith is an Hamcrest matcher.\n\n\nCustom matching\n-----\n\nIf we want to make sure that the street name starts with \"Via\" at least:\n\n\u003ccode\u003eassertThat(actualPerson, sameBeanAs(expectedPerson).with(\"address.streetName\"), startsWith(\"Via\"));\u003c/code\u003e\n\n\nCircular references\n-----\n\nHaving a Shop bean with the following structure:\n\n\u003cpre\u003eShop shop\n\t|-- String name\n    |-- Store store\n        |-- Boss boss\n            |-- Clerk clerk\n                |-- Store store\n                |-- Boss boss\u003c/pre\u003e\n        \nComparing two Shop objects throws a StackOverflowError, because of the cycles Clerk -\u003e Store -\u003e Boss -\u003e Clerk and Clerk -\u003e Boss -\u003e Clerk.\n\nFrom version 0.10 the circular reference is detected automatically and the serialiser is instructed to serialise the instance once and replace all the other occurrences with a pointer:\n\n\u003ccode\u003eassertThat(actualShop, sameBeanAs(expectedShop));\u003c/code\u003e\n\nproduces the following representation:\n\n\u003cpre\u003e{\n  \"store\": {\n    \"0x1\": {\n      \"0x1\": {\n        \"0x1\": {\n          \"boss\": \"0x2\"\n        }\n      }\n    },\n    \"0x2\": {\n      \"0x1\": {\n        \"0x1\": {\n          \"clerk\": {\n            \"boss\": \"0x2\",\n            \"store\": \"0x1\"\n          }\n        }\n      }\n    }\n  },\n  \"name\": \"shop\"\n}\u003c/pre\u003e\n\n\nQuickStart\n-----\n\nTo use, [download the zip](https://github.com/shazam/shazamcrest/archive/master.zip) or add the following to your project's pom.xml:\n \n    \u003cdependency\u003e\n        \u003cgroupId\u003ecom.shazam\u003c/groupId\u003e\n        \u003cartifactId\u003eshazamcrest\u003c/artifactId\u003e\n        \u003cversion\u003e0.11\u003c/version\u003e\n    \u003c/dependency\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshazam%2Fshazamcrest","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshazam%2Fshazamcrest","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshazam%2Fshazamcrest/lists"}