{"id":37029640,"url":"https://github.com/valid8j/valid8j","last_synced_at":"2026-01-14T03:34:16.056Z","repository":{"id":237784474,"uuid":"793033415","full_name":"valid8j/valid8j","owner":"valid8j","description":"A value checking library for Java (DbC, validations, and test assertioins)","archived":false,"fork":false,"pushed_at":"2025-04-13T02:42:38.000Z","size":2505,"stargazers_count":9,"open_issues_count":6,"forks_count":0,"subscribers_count":0,"default_branch":"develop-2.1.x","last_synced_at":"2025-07-26T14:47:46.520Z","etag":null,"topics":["assertions-library","dbc","preconditions","testing"],"latest_commit_sha":null,"homepage":"https://valid8j.github.io/valid8j/","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/valid8j.png","metadata":{"files":{"readme":"README.adoc","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","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},"funding":{"github":["dakusui"],"patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"lfx_crowdfunding":null,"polar":null,"buy_me_a_coffee":null,"custom":null}},"created_at":"2024-04-28T08:33:04.000Z","updated_at":"2025-04-12T23:07:00.000Z","dependencies_parsed_at":"2024-05-03T06:29:20.690Z","dependency_job_id":"43ea0866-8094-44df-860f-37efc81c8bea","html_url":"https://github.com/valid8j/valid8j","commit_stats":null,"previous_names":["valid8j/valid8j"],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/valid8j/valid8j","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/valid8j%2Fvalid8j","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/valid8j%2Fvalid8j/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/valid8j%2Fvalid8j/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/valid8j%2Fvalid8j/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/valid8j","download_url":"https://codeload.github.com/valid8j/valid8j/tar.gz/refs/heads/develop-2.1.x","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/valid8j%2Fvalid8j/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28408843,"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":["assertions-library","dbc","preconditions","testing"],"created_at":"2026-01-14T03:34:15.550Z","updated_at":"2026-01-14T03:34:16.042Z","avatar_url":"https://github.com/valid8j.png","language":"Java","funding_links":["https://github.com/sponsors/dakusui"],"categories":[],"sub_categories":[],"readme":":toc:\n\n= `valid8j`: DbC, Validation, and Test Assertion Library\n\n`valid8j` is a library that provides consistent programming experiences across DbC\u003c\u003cDbC\u003e\u003e, Value-checking, and Test assertions.\nIt is named after `valid4j`\u003c\u003cv4j\u003e\u003e, but it does more.\n\nIt also provides readability both in codes and messages on failures.\nEasy to write.\n\n[%nowrap, java]\n.`IntroductionExample` class\n----\npublic class IntroductionExample {\n  public String examplePublicMethod(String name, int basePrice) {\n    // Use `Expectations.requireXyz` method to check values in production.\n    requireArguments(\n        that(name).satisfies()\n            .notNull(),\n        that(basePrice).satisfies()\n            .greaterThanOrEqualTo(0)\n            .lessThan(10_000));\n    return examplePrivateMethod(name, basePrice);\n  }\n\n  private String examplePrivateMethod(String name, int basePrice) {\n    // Use `assert` statement with`Expectations.` {`precondition`,`invariant`,`postcondition`} methods\n    // and their plural for Design by Contract programming.\n    assert preconditions(\n        // `value(var)` and `that(var)` are synonyms. Use the one you like.\n        // `toBe(var)` and `satisfies(var)` are synonyms. Use the one you like.\n        value(name).toBe()\n            .notNull(),\n        value(basePrice).toBe()\n            .greaterThanOrEqualTo(0)\n            .lessThan(10_000));\n    int price = (int) (basePrice * 1.08);\n    return String.format(\"%s:%s\", name, price);\n  }\n\n  @TestMethodExpectation(FAILURE)\n  @Test\n  public void exampleMethod() {\n    String message = examplePublicMethod(\"Kirin Ichiban\", 100);\n    // Use `Expectations.assertAll` for test assertions.\n    assertAll(\n        that(message)\n            .substringAfter(\":\")\n            .parseInt()\n            .satisfies()\n            .equalTo(110),\n        that(message)\n            .satisfies()\n            .startingWith(\"Kirin Ichiban\"));\n  }\n}\n----\n\nThis gives the following output as your IDE's window.:\n\n.Output of `IntroductionExample.java`\n|===\n|Expectation |Actual\n\na|\n[%nowrap]\n----\n    \"Kirin Ichiban:108\"-\u003eWHEN:transform                -\u003etrue\n                       -\u003e    substringAfter[:]         -\u003e\"108\"\n    \"108\"              -\u003e    parseInt                  -\u003e108\n[0] 108                -\u003e  THEN:=[110]                 -\u003etrue\n    \"Kirin Ichiban:108\"-\u003eWHEN:startsWith[Kirin Ichiban]-\u003etrue\n\n.Detail of failure [0]\n---\n=[110]\n---\n----\na|\n[%nowrap]\n----\n    \"Kirin Ichiban:108\"-\u003eWHEN:transform                -\u003efalse\n                       -\u003e    substringAfter[:]         -\u003e\"108\"\n    \"108\"              -\u003e    parseInt                  -\u003e108\n[0] 108                -\u003e  THEN:=[110]                 -\u003efalse\n    \"Kirin Ichiban:108\"-\u003eWHEN:startsWith[Kirin Ichiban]-\u003etrue\n\n.Detail of failure [0]\n---\n108\n---\n\n----\n|===\n\n== Installation\n\nHave a following maven dependency in your `pom.xml`.\n\n[source,xml]\n[subs=\"verbatim,attributes\"]\n----\n\u003cdependency\u003e\n  \u003cgroupId\u003ecom.github.dakusui\u003c/groupId\u003e\n  \u003cartifactId\u003evalid8j\u003c/artifactId\u003e\n  \u003cversion\u003e{valid8j}\u003c/version\u003e\n\u003c/dependency\u003e\n----\n\nVisit https://oss.sonatype.org/#nexus-search;quick~valid8j[oss.sonatype.org] to figure out the most recent version of `valid8j`.\nCheck https://valid8j.github.io/valid8j/[valid8j]'s documentation site for more detail.\n\n[bibliography]\n== References\n\n- [[[DbC, 1]]] Wikipedia article on Design by Contract, https://en.wikipedia.org/wiki/Design_by_contract\n- [[[v4j, 2]]] Valid4j, http://www.valid4j.org\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvalid8j%2Fvalid8j","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvalid8j%2Fvalid8j","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvalid8j%2Fvalid8j/lists"}