{"id":47787591,"url":"https://github.com/vashishthask/mocktail","last_synced_at":"2026-04-03T15:01:46.823Z","repository":{"id":2428050,"uuid":"3397224","full_name":"vashishthask/mocktail","owner":"vashishthask","description":"Mocktail is a tool to cache the response of potentially any Java method call on the disk.","archived":false,"fork":false,"pushed_at":"2026-04-03T08:17:48.000Z","size":1118,"stargazers_count":14,"open_issues_count":6,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2026-04-03T14:44:33.307Z","etag":null,"topics":["betamax","database","dependencies","interfaces","java","mocking","rest-api","restful-api","testing","vcr"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vashishthask.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2012-02-09T13:20:43.000Z","updated_at":"2026-04-03T08:17:52.000Z","dependencies_parsed_at":"2026-04-03T15:01:11.097Z","dependency_job_id":null,"html_url":"https://github.com/vashishthask/mocktail","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/vashishthask/mocktail","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vashishthask%2Fmocktail","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vashishthask%2Fmocktail/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vashishthask%2Fmocktail/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vashishthask%2Fmocktail/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vashishthask","download_url":"https://codeload.github.com/vashishthask/mocktail/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vashishthask%2Fmocktail/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31359081,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-03T14:24:47.623Z","status":"ssl_error","status_checked_at":"2026-04-03T14:24:32.380Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["betamax","database","dependencies","interfaces","java","mocking","rest-api","restful-api","testing","vcr"],"created_at":"2026-04-03T15:00:48.150Z","updated_at":"2026-04-03T15:01:42.721Z","avatar_url":"https://github.com/vashishthask.png","language":"Java","readme":"# Mocktail 🍹\r\n\r\n\u003e Run integration tests 10× faster — no Docker, no hand-written stubs, no drifting fixtures.\r\n\r\nMocktail records the real response of **any Java method call** to disk on the first run, then replays it instantly on every run after. Think of it as VCR for your Java code — not just HTTP, but any method: JPA repositories, AWS SDKs, Kafka consumers, legacy DAOs, gRPC clients — all of it.\r\n\r\n---\r\n\r\n## The Problem\r\n\r\nYou have integration tests that call a database, an external SDK, or an internal service. Your choices today feel like a trade-off you can't win:\r\n\r\n| Approach | The hidden cost |\r\n|---|---|\r\n| Testcontainers | 10–30s Docker startup per test suite. Breaks in airgapped CI. |\r\n| WireMock | Only intercepts HTTP. Useless for JPA, SDKs, message buses. |\r\n| Mockito stubs | Hand-written. Never match real data. Drift silently. |\r\n| H2 in-memory | SQL dialect differences cause false passes and false failures. |\r\n\r\nMocktail is none of those. It captures the *real* response once, checks it into source control, and replays it from disk in milliseconds forever.\r\n\r\n---\r\n\r\n## Quick Start\r\n\r\n### 1. Add the dependency\r\n\r\n```xml\r\n\u003cdependency\u003e\r\n    \u003cgroupId\u003ein.malonus.mocktail\u003c/groupId\u003e\r\n    \u003cartifactId\u003emocktail-core\u003c/artifactId\u003e\r\n    \u003cversion\u003e1.0.3\u003c/version\u003e\r\n    \u003cscope\u003etest\u003c/scope\u003e\r\n\u003c/dependency\u003e\r\n```\r\n\r\nYou also need the AspectJ compiler plugin to enable method interception:\r\n\r\n```xml\r\n\u003cplugin\u003e\r\n    \u003cgroupId\u003eorg.codehaus.mojo\u003c/groupId\u003e\r\n    \u003cartifactId\u003easpectj-maven-plugin\u003c/artifactId\u003e\r\n    \u003cversion\u003e1.14.0\u003c/version\u003e\r\n    \u003cconfiguration\u003e\r\n        \u003ccomplianceLevel\u003e11\u003c/complianceLevel\u003e\r\n        \u003caspectLibraries\u003e\r\n            \u003caspectLibrary\u003e\r\n                \u003cgroupId\u003ein.malonus.mocktail\u003c/groupId\u003e\r\n                \u003cartifactId\u003emocktail-core\u003c/artifactId\u003e\r\n            \u003c/aspectLibrary\u003e\r\n        \u003c/aspectLibraries\u003e\r\n    \u003c/configuration\u003e\r\n    \u003cexecutions\u003e\r\n        \u003cexecution\u003e\r\n            \u003cgoals\u003e\u003cgoal\u003ecompile\u003c/goal\u003e\u003cgoal\u003etest-compile\u003c/goal\u003e\u003c/goals\u003e\r\n        \u003c/execution\u003e\r\n    \u003c/executions\u003e\r\n\u003c/plugin\u003e\r\n```\r\n\r\n### 2. Configure which methods to intercept\r\n\r\nCreate `src/test/resources/mocktail.xml`:\r\n\r\n```xml\r\n\u003cmocktail mode=\"recording\"\u003e\r\n    \u003cmocktailMethod\u003e\r\n        \u003cclassQualifiedName\u003ecom.example.UserRepository\u003c/classQualifiedName\u003e\r\n        \u003cmethodName\u003efindByEmail\u003c/methodName\u003e\r\n    \u003c/mocktailMethod\u003e\r\n\u003c/mocktail\u003e\r\n```\r\n\r\n**Modes:**\r\n- `recording` — Record the response once; replay on every subsequent call (recommended for CI)\r\n- `recording_new` — Always re-record, overwriting what's on disk (use to refresh fixtures)\r\n\r\n### 3. Wrap your test\r\n\r\n```java\r\n@Test\r\nvoid shouldReturnUserByEmail() throws Exception {\r\n    try (MethodMocktail m = new MethodMocktail(this)) {\r\n        User user = userRepository.findByEmail(\"jane@example.com\");\r\n        assertThat(user.getName()).isEqualTo(\"Jane Doe\");\r\n    }\r\n}\r\n```\r\n\r\nThat's it. On the first run Mocktail calls the real `findByEmail`, saves the response to disk under `src/test/resources/mocktail/`, and every run after that skips the database entirely.\r\n\r\n---\r\n\r\n## How It Works\r\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvashishthask%2Fmocktail","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvashishthask%2Fmocktail","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvashishthask%2Fmocktail/lists"}