{"id":28629773,"url":"https://github.com/codebox/asynctest","last_synced_at":"2025-06-12T12:13:34.039Z","repository":{"id":57737037,"uuid":"99429241","full_name":"codebox/asynctest","owner":"codebox","description":"This simple Java library helps you write better tests for asynchronous systems.","archived":false,"fork":false,"pushed_at":"2017-08-06T08:01:29.000Z","size":9,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2023-07-05T04:17:41.315Z","etag":null,"topics":["integration-testing","java","testing-tools"],"latest_commit_sha":null,"homepage":"https://codebox.net/pages/java-asynchronous-testing","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/codebox.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}},"created_at":"2017-08-05T14:55:28.000Z","updated_at":"2017-08-06T14:14:53.000Z","dependencies_parsed_at":"2022-08-24T05:21:06.508Z","dependency_job_id":null,"html_url":"https://github.com/codebox/asynctest","commit_stats":null,"previous_names":[],"tags_count":0,"template":null,"template_full_name":null,"purl":"pkg:github/codebox/asynctest","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codebox%2Fasynctest","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codebox%2Fasynctest/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codebox%2Fasynctest/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codebox%2Fasynctest/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/codebox","download_url":"https://codeload.github.com/codebox/asynctest/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codebox%2Fasynctest/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259462578,"owners_count":22861514,"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":["integration-testing","java","testing-tools"],"created_at":"2025-06-12T12:13:33.241Z","updated_at":"2025-06-12T12:13:34.023Z","avatar_url":"https://github.com/codebox.png","language":"Java","readme":"AsyncTest\n=========\nThis simple Java library helps you write better tests for asynchronous systems.\n\nHere is a common integration testing anti-pattern:\n\n    sendRequest();\n    Thread.sleep(5000);\n    checkThatResponseIsCorrect();\n\nIf the response is returned quickly then the test will still wait for 5 seconds before moving on, making your test suite slow. On the other hand, if the response is returned correctly but takes slightly longer than 5 seconds then the test will fail, which may not be what you want.\n\nUsing the asynctest library, you could re-write the test like this: \n\n    sendRequest();\n    assertThatEventually().thisTaskWillSucceed(this::checkThatResponseIsCorrect);\n\nBehind the scenes the library will run the ```checkThatResponseIsCorrect``` method repeatedly, stopping when the method completes without throwing any Exceptions, or when the time limit of 15 seconds is reached. \n\nTo specify a different time limit, you can do this:\n\n    sendRequest();\n    assertThatWithin(Duration.ofSeconds(5)).thisTaskWillSucceed(this::checkThatResponseIsCorrect);\n\nTo assert that an Exception does get thrown, just change the code to this:\n\n    assertThatWithin(Duration.ofSeconds(5)).thisTask(this::sendRequest).willThrow(HttpException.class);\n\nWhen an assertion fails you will see a comprehensive error message explaining what happened, for example:\n\n    java.lang.AssertionError: Operation did not throw org.apache.commons.httpclient.HttpException \n    within the timeout interval of 5 seconds. The task ran 5 times. There were no AssertionErrors. \n    No other Exceptions were thrown.\n\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodebox%2Fasynctest","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcodebox%2Fasynctest","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodebox%2Fasynctest/lists"}