{"id":19838996,"url":"https://github.com/objectionary/eo-hamcrest","last_synced_at":"2026-01-14T03:17:35.535Z","repository":{"id":37041116,"uuid":"483719118","full_name":"objectionary/eo-hamcrest","owner":"objectionary","description":"Hamcrest Matchers for EO Programming Language","archived":true,"fork":false,"pushed_at":"2024-06-27T16:44:48.000Z","size":375,"stargazers_count":17,"open_issues_count":33,"forks_count":6,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-07-12T06:27:25.522Z","etag":null,"topics":["eolang","hamcrest","hamcrest-extensions","hamcrest-matchers","java","tdd","testing"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/objectionary.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-04-20T15:53:00.000Z","updated_at":"2025-04-12T02:43:28.000Z","dependencies_parsed_at":"2023-02-10T11:01:24.397Z","dependency_job_id":"9849b151-a64b-4250-af5f-f8de57d9c987","html_url":"https://github.com/objectionary/eo-hamcrest","commit_stats":null,"previous_names":[],"tags_count":21,"template":false,"template_full_name":null,"purl":"pkg:github/objectionary/eo-hamcrest","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/objectionary%2Feo-hamcrest","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/objectionary%2Feo-hamcrest/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/objectionary%2Feo-hamcrest/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/objectionary%2Feo-hamcrest/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/objectionary","download_url":"https://codeload.github.com/objectionary/eo-hamcrest/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/objectionary%2Feo-hamcrest/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28408824,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T01:52:23.358Z","status":"online","status_checked_at":"2026-01-14T02:00:06.678Z","response_time":107,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["eolang","hamcrest","hamcrest-extensions","hamcrest-matchers","java","tdd","testing"],"created_at":"2024-11-12T12:19:51.535Z","updated_at":"2026-01-14T03:17:35.517Z","avatar_url":"https://github.com/objectionary.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cimg src=\"https://www.yegor256.com/images/books/elegant-objects/cactus.svg\" height=\"100px\" /\u003e\n\n[![EO principles respected here](https://www.elegantobjects.org/badge.svg)](https://www.elegantobjects.org)\n[![DevOps By Rultor.com](http://www.rultor.com/b/objectionary/eo-hamcrest)](http://www.rultor.com/p/objectionary/eo-hamcrest)\n[![We recommend IntelliJ IDEA](https://www.elegantobjects.org/intellij-idea.svg)](https://www.jetbrains.com/idea/)\n\n[![mvn](https://github.com/objectionary/eo-hamcrest/actions/workflows/mvn.yml/badge.svg)](https://github.com/objectionary/eo-hamcrest/actions/workflows/mvn.yml)\n[![PDD status](http://www.0pdd.com/svg?name=objectionary/eo-hamcrest)](http://www.0pdd.com/p?name=objectionary/eo-hamcrest)\n[![Maven Central](https://img.shields.io/maven-central/v/org.eolang/eo-hamcrest.svg)](https://maven-badges.herokuapp.com/maven-central/org.eolang/eo-hamcrest)\n[![codecov](https://codecov.io/gh/objectionary/eo-hamcrest/branch/master/graph/badge.svg)](https://codecov.io/gh/objectionary/eo-hamcrest)\n[![License](https://img.shields.io/badge/license-MIT-green.svg)](https://github.com/Graur/eo-tests/blob/master/LICENSE.txt)\n\n[![Maintainability](https://api.codeclimate.com/v1/badges/b8b59692f3c8c973ac54/maintainability)](https://codeclimate.com/github/objectionary/eo-hamcrest/maintainability)\n[![Hits-of-Code](https://hitsofcode.com/github/graur/eo-hamcrest)](https://hitsofcode.com/github/graur/eo-hamcrest/view)\n![Code-Size](https://img.shields.io/github/languages/code-size/objectionary/eo-hamcrest)\n![Lines of code](https://img.shields.io/tokei/lines/github/objectionary/eo-hamcrest)\n\nThis is a collection of test matchers for [EO](https://www.eolang.org) in [Hamcrest](http://hamcrest.org) style, which allow you to make unit tests declarative and elegant. Here is an example of a unit test:\n\n```\n+package org.eolang\n+alias org.eolang.hamcrest.assert-that\n+tests\n\n[] \u003e my-first-test\n  assert-that \u003e @\n    4.plus 4\n    $.all-of\n      $.equal-to 8\n      $.less-than 100\n    \"sum of two numbers\"\n```\n\nThe ```assert-that``` object is a stylized sentence for making a test assertion.\nIn this example, the subject of the assertion is the object ```4.plus 4``` that is the first method parameter. The second method parameter is a `matcher` for the first parameter, here a matcher that checks one object is equal and less than to another objects. The third parameter is an optional string description of the test case (```sum of two numbers```). The test passes since all conditions are ```TRUE```.\n\n### Matchers\n\nHamcrest comes with a library of useful matchers. Here are some of the most important ones:\n\n###### Core\n\n```\n+package org.eolang\n+alias org.eolang.hamcrest.assert-that\n+tests\n\n[] \u003e core-matchers-test\n  assert-that \u003e @\n    5.times 4\n    $.is\n      $.anything\n    \"multiply of two numbers\"\n```\n\n```.anything``` - always matches, useful if you don’t care what the object under test is\n\n```.described-as``` - decorator to adding custom failure description\n\n```.is``` - decorator to improve readability\n\n###### Logical\n```\n+package org.eolang\n+alias org.eolang.hamcrest.assert-that\n+tests\n\n[] \u003e logical-matchers-test\n  assert-that \u003e @\n    50.minus 10\n    $.all-of\n      $.not \n        $.equal-to 5\n      $.any-of\n        $.less-than 100\n        $.greater-than 1\n    \"substract one number from another\"\n```\n\n```.all-of``` - matches if all matchers match, short circuits (like Java \u0026\u0026)\n\n```.any-of``` - matches if any matchers match, short circuits (like Java ||)\n\n```.not``` - matches if the wrapped matcher doesn’t match and vice versa\n\n###### Object\n```.equal-to``` - the subject of the assertion is equal to some object\n\n###### Collections\n```\n+package org.eolang\n+alias org.eolang.hamcrest.assert-that\n+tests\n\n[] \u003e collections-test\n  assert-that \u003e @\n    * 50 \"t\" \"smth\"\n    $.array-each\n      $.equal-to 50\n      $.equal-to \"t\"\n      $.equal-to \"smth\"\n```\n```array-each``` - test an array’s elements against an array of matchers\n\n```\n+package org.eolang\n+alias org.eolang.hamcrest.assert-that\n+tests\n\n[] \u003e collections-test\n  assert-that \u003e @\n    * 1 5 \"f\" 12\n    $.has-item\n      $.less-than 4\n```\n\n```.has-item```, ```.has-items``` - test a collection contains elements\n\n###### Number\n\n```\n+package org.eolang\n+alias org.eolang.hamcrest.assert-that\n+tests\n\n[] \u003e numbers-matchers-test\n  assert-that \u003e @\n    31.div 3\n    $.any-of\n      $.close-to 10.0 0.1\n      $.less-than 20\n      $.greater-than 355\n    \"number of floating point number matchers\"\n```\n\n```.close-to``` - test floating point values are close to a given value\n\n```.greater-than```, ```.less-than``` - test ordering\n\n###### Text\n\n```\n+package org.eolang\n+alias org.eolang.hamcrest.assert-that\n+tests\n\n[] \u003e text-matchers-test\n  assert-that \u003e @\n    \"Vice versa!\"\n    $.all-of\n      $.equal-to-ignoring-case \"vice versa!\"\n      $.starts-with \"Vice\"\n      $.ends-with \"versa!\"\n      $.contains-string \"ver\"\n    \"text matchers test\"\n```\n\n```.equal-to-ignoring-case``` - test string equality ignoring case\n\n```.equal-to-ignoring-white-space``` - test string equality ignoring differences in runs of whitespace\n\n```.contains-string,``` ```.ends-with```, ```.starts-with``` - test string matching\n\n\nMore examples are [here](https://github.com/Graur/eo-hamcrest/tree/main/src/test/eo/org/rolang/hamcrest)\n\n## Custom matchers\n\nYou can also implement your own matcher by passing parameter to the ```assert-that``` object:\n\n```\n+package org.eolang\n+alias org.eolang.hamcrest.assert-that\n+tests\n\n[] \u003e my-custom-matcher-test\n  assert-that \u003e @\n    my-object\n    my-custom-matcher obj\n\n[obj] \u003e my-custom-matcher\n  [x] \u003e match\n    eq. \u003e @\n      x\n      obj    \n      \n  [] \u003e describe-mismatch\n    \"mismatch description message\" \u003e @\n\n  [] \u003e description-of\n    \"expected value description\" \u003e @\n```\n\n## How to Contribute\n\nFork this repository, make changes, send us a [pull request](https://www.yegor256.com/2014/04/15/github-guidelines.html).\nWe will review your changes and apply them to the `master` branch shortly,\nprovided they don't violate our quality standards. To avoid frustration,\nbefore sending us your pull request please run full Maven build:\n\n```bash\n$ mvn clean install -Pqulice\n```\n\nYou will need Maven 3.3+ and Java 8+.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fobjectionary%2Feo-hamcrest","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fobjectionary%2Feo-hamcrest","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fobjectionary%2Feo-hamcrest/lists"}