{"id":20104169,"url":"https://github.com/testmonkeys/jentitytest","last_synced_at":"2026-06-05T02:31:42.613Z","repository":{"id":9045742,"uuid":"60640945","full_name":"TestMonkeys/jEntityTest","owner":"TestMonkeys","description":"A Java library which provides hamcrest matchers for matching objects, based on annotations and strategies","archived":false,"fork":false,"pushed_at":"2024-01-10T13:46:44.000Z","size":431,"stargazers_count":2,"open_issues_count":4,"forks_count":0,"subscribers_count":4,"default_branch":"develop","last_synced_at":"2025-01-13T04:43:02.639Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/TestMonkeys.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2016-06-07T19:35:14.000Z","updated_at":"2023-11-02T07:47:42.000Z","dependencies_parsed_at":"2023-02-18T07:00:20.393Z","dependency_job_id":"6f739f1f-0190-4506-8da3-fff07baddc84","html_url":"https://github.com/TestMonkeys/jEntityTest","commit_stats":null,"previous_names":[],"tags_count":23,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TestMonkeys%2FjEntityTest","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TestMonkeys%2FjEntityTest/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TestMonkeys%2FjEntityTest/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TestMonkeys%2FjEntityTest/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/TestMonkeys","download_url":"https://codeload.github.com/TestMonkeys/jEntityTest/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241543615,"owners_count":19979570,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":"2024-11-13T17:41:44.931Z","updated_at":"2026-06-05T02:31:42.607Z","avatar_url":"https://github.com/TestMonkeys.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# jEntityTest\n[![CircleCI](https://circleci.com/gh/TestMonkeys/jEntityTest.svg?style=svg)](https://circleci.com/gh/TestMonkeys/jEntityTest)\n[![codecov](https://codecov.io/gh/TestMonkeys/jEntityTest/branch/master/graph/badge.svg)](https://codecov.io/gh/TestMonkeys/jEntityTest)\n\n[![Maven Central](https://img.shields.io/maven-central/v/org.testmonkeys/jentitytest)](https://search.maven.org/artifact/org.testmonkeys/jentitytest)\n[![Maintainability](https://api.codeclimate.com/v1/badges/b5f8bf0fdf7bfc9453b0/maintainability)](https://codeclimate.com/github/TestMonkeys/jEntityTest/maintainability)\n[![Test Coverage](https://api.codeclimate.com/v1/badges/b5f8bf0fdf7bfc9453b0/test_coverage)](https://codeclimate.com/github/TestMonkeys/jEntityTest/test_coverage)\n\njEntityTest is a library that can compare two instances of a class based on their declared fields. Making it easier to check if they are equal. It also contains a hamcrest matcher so that you can use the comparison in assertions. The comparison can further be customized via annotations for each field.\n\n# Usage Example\n\nA simple use case would be creating a user via API, then retrieving it and checking it was created correctly:\n```java\nUser createdUser = api.createUser(newUser);\nassertThat(createdUser, Entity.isEqualTo(newUser));\n```\nIn the above case, `Entity.isEqualTo`, which is part of jEntityTest, will do the comparison between the two objects. \nNow let's look at the actual fields that the User object has\n\nUser fields  | newUser values | createdUser values \n------------ | -------------- | ------------------ \nid           |                | 1\nfirstName    | John           | John\nlastName     | Doe            | Doe\n\nThe id was generated on while creating the user, so we can't know it beforehand. For the comparison to not fail in this case - fields can be decorated with annotations specifying the comparison strategy to be applied, so the user model would be:\n```java\n\npublic class User{\n\n  @IgnoreComparison\n  private String id;\n  \n  private String firstName;\n  \n  private String lastName;\n  ...\n\n```\nThere are a few more comparison strategies that can be applied for any field, that will impact how the comparison is done.\n\n# Comparison Strategies available\nFor a more detailed explanation of each comparison strategy please visit the [wiki](https://github.com/TestMonkeys/jEntityTest/wiki/JEntityTest-comparison-strategies) \n\n\n## ChildEntityComparison\n\n`@ChildEntityComparison` can be applied to a field if it is an object that you want to also compare by it's fields. \n\n## ChildEntityListComparison\n\n`@ChildEntityListComparison` can be applied to lists, this will compare each item in the list between the expected and actual objects.\n\n## DateTimeComparison\n\n`@DateTimeComparison` can be applied to LocalDateTime fields - and is parameterized to allow for a delta. \n\n## StringComparison\n\n`@StringComparison` can be applied to String fields and can be parameterized to trim, ignore specific characters, or ignore the case.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftestmonkeys%2Fjentitytest","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftestmonkeys%2Fjentitytest","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftestmonkeys%2Fjentitytest/lists"}