{"id":17197693,"url":"https://github.com/dmcg/okey-doke","last_synced_at":"2025-04-13T19:32:04.609Z","repository":{"id":9304436,"uuid":"11143067","full_name":"dmcg/okey-doke","owner":"dmcg","description":null,"archived":false,"fork":false,"pushed_at":"2023-12-10T22:05:49.000Z","size":509,"stargazers_count":40,"open_issues_count":9,"forks_count":5,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-27T10:21:26.381Z","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/dmcg.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-07-03T05:53:04.000Z","updated_at":"2024-11-27T21:37:21.000Z","dependencies_parsed_at":"2022-08-25T20:51:36.204Z","dependency_job_id":null,"html_url":"https://github.com/dmcg/okey-doke","commit_stats":null,"previous_names":[],"tags_count":28,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dmcg%2Fokey-doke","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dmcg%2Fokey-doke/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dmcg%2Fokey-doke/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dmcg%2Fokey-doke/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dmcg","download_url":"https://codeload.github.com/dmcg/okey-doke/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248768003,"owners_count":21158570,"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-10-15T01:57:06.146Z","updated_at":"2025-04-13T19:32:04.057Z","avatar_url":"https://github.com/dmcg.png","language":"Java","funding_links":[],"categories":["others"],"sub_categories":[],"readme":"\n[![Download](https://maven-badges.herokuapp.com/maven-central/com.oneeyedmen/okeydoke/badge.svg?style=flat-square\n)](https://search.maven.org/artifact/com.oneeyedmen/okeydoke)\n\nokey-doke\n=========\n\nAn Approval Testing library for Java and JUnit - like [Llewellyn Falco's](http://approvaltests.sourceforge.net/) but more Java'y.\n\nA [helping hand](http://youtu.be/EbqaxWjIgOg) for many testing problems.\n\n## Version 2\n\nIf you are upgrading from verions 1.x to version 2.x - JUnit 4 support has been moved from `com.oneeyedmen.junit` to `com.oneeyedmen.junit4`.\n\nIn return, you no longer need to specify whether your are using Java or Kotlin\n\n## JUnit 5\n\n\n```java\npublic class ApprovalsExtensionTest {\n\n    // Initialise okey-doke.\n    @RegisterExtension ApprovalsExtension approvals = new ApprovalsExtension();\n        // See other constructors to change where the files are stored,\n        // or change the extension\n\n    @Test\n    public void something_that_we_want_to_be_the_same_next_time(\n            Approver approver // approver will be injected\n    ) {\n        Object result = doSomeCalculation(42, \"banana\");\n        approver.assertApproved(result); // check that the result is as approved\n    }\n}\n```\n\n\nThe first time you run this test it will fail, but the result of `doSomeCalculation` will  be written into a\nfile next to the test, named  `ApprovalsExtensionTest.something_that_we_want_to_be_the_same_next_time.actual`\n\nYou can look at this file to check that it is what you expect, and if it is, approve the test by renaming the file\nit to `ApprovalsExtensionTest.something_that_we_want_to_be_the_same_next_time.approved` (or ask the plugin to do it for you).\n\nFrom then on the test will pass provided the result of `doSomeCalculation` doesn't change.\nIf it does change then you can either fix the code if it shouldn't have, or approve the new version.\n\n## IntelliJ\n\nThere is an [IntelliJ plugin](https://github.com/s4nchez/okey-doke-idea) (thanks @s4nchez) to help approve your output.\n\n## JUnit 4\n\nWe still support JUnit 4 with a Rule -\n[ApprovalsRuleTest](src/test/java/com/oneeyedmen/okeydoke/examples/ApprovalsRuleTest.java)\n\n```java\n    @Rule public final ApprovalsRule approver = ApprovalsRule.usualRule();\n\n    @Test\n    public void something_that_we_want_to_be_the_same_next_time(\n    ) {\n        Object result = doSomeCalculation(42, \"banana\");\n        approver.assertApproved(result); // check that the result is as approved\n    }\n```\n\nHere you can use the `ApprovalsRule` as a approver.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdmcg%2Fokey-doke","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdmcg%2Fokey-doke","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdmcg%2Fokey-doke/lists"}