{"id":13783472,"url":"https://github.com/mguenther/kafka-junit","last_synced_at":"2026-01-14T03:37:06.188Z","repository":{"id":37462778,"uuid":"133824503","full_name":"mguenther/kafka-junit","owner":"mguenther","description":"Enables you to start and stop a fully-fledged embedded Kafka cluster from within JUnit and provides a rich set of convenient accessors and fault injectors through a lean API. Supports working against external clusters as well.","archived":false,"fork":false,"pushed_at":"2025-07-02T16:41:51.000Z","size":316,"stargazers_count":55,"open_issues_count":8,"forks_count":24,"subscribers_count":4,"default_branch":"development","last_synced_at":"2025-07-10T03:13:18.463Z","etag":null,"topics":["junit","kafka","kafka-connect"],"latest_commit_sha":null,"homepage":"https://mguenther.github.io/kafka-junit","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/mguenther.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","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}},"created_at":"2018-05-17T14:22:23.000Z","updated_at":"2025-06-11T05:15:26.000Z","dependencies_parsed_at":"2023-11-18T12:27:04.404Z","dependency_job_id":"e17a8922-e3eb-4c1d-b5aa-50f087855357","html_url":"https://github.com/mguenther/kafka-junit","commit_stats":null,"previous_names":[],"tags_count":27,"template":false,"template_full_name":null,"purl":"pkg:github/mguenther/kafka-junit","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mguenther%2Fkafka-junit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mguenther%2Fkafka-junit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mguenther%2Fkafka-junit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mguenther%2Fkafka-junit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mguenther","download_url":"https://codeload.github.com/mguenther/kafka-junit/tar.gz/refs/heads/development","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mguenther%2Fkafka-junit/sbom","scorecard":{"id":639618,"data":{"date":"2025-08-11","repo":{"name":"github.com/mguenther/kafka-junit","commit":"015fa438199750cf3a50209744ed0b24a70eb5a6"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":1.9,"checks":[{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Code-Review","score":1,"reason":"Found 5/30 approved changesets -- score normalized to 1","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: Apache License 2.0: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 6 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'development'","Warn: branch protection not enabled for branch 'releases/3.6.x'","Warn: branch protection not enabled for branch 'releases/3.5.x'","Warn: branch protection not enabled for branch '3.4.x'","Warn: branch protection not enabled for branch '3.3.x'","Warn: branch protection not enabled for branch '3.2.x'","Warn: branch protection not enabled for branch '3.1.x'","Warn: branch protection not enabled for branch '3.0.x'","Warn: branch protection not enabled for branch '2.3.x'","Warn: branch protection not enabled for branch '2.1.x'","Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Vulnerabilities","score":0,"reason":"19 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-h46c-h94j-95f3","Warn: Project is vulnerable to: GHSA-5mg8-w23w-74h3","Warn: Project is vulnerable to: GHSA-7g45-4rm6-3mm3","Warn: Project is vulnerable to: GHSA-wxr5-93ph-8wr9","Warn: Project is vulnerable to: GHSA-389x-839f-4rhx","Warn: Project is vulnerable to: GHSA-xq3w-v528-46rv","Warn: Project is vulnerable to: GHSA-6mjq-h674-j845","Warn: Project is vulnerable to: GHSA-j288-q9x7-2f5v","Warn: Project is vulnerable to: GHSA-2x2g-32r7-p4x8","Warn: Project is vulnerable to: GHSA-vgq5-3255-v292","Warn: Project is vulnerable to: GHSA-79vv-vp32-gpp7","Warn: Project is vulnerable to: GHSA-p7c9-8xx8-h74f","Warn: Project is vulnerable to: GHSA-7286-pgfv-vxvh","Warn: Project is vulnerable to: GHSA-r978-9m6m-6gm6","Warn: Project is vulnerable to: GHSA-6qvw-249j-h44c","Warn: Project is vulnerable to: GHSA-qh8g-58pp-2wxh","Warn: Project is vulnerable to: GHSA-g8m5-722r-8whq","Warn: Project is vulnerable to: GHSA-q4rv-gq96-w7c5","Warn: Project is vulnerable to: GHSA-j26w-f9rq-mr2q"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-21T10:19:42.178Z","repository_id":37462778,"created_at":"2025-08-21T10:19:42.178Z","updated_at":"2025-08-21T10:19:42.178Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28408850,"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":["junit","kafka","kafka-connect"],"created_at":"2024-08-03T19:00:22.187Z","updated_at":"2026-01-14T03:37:06.168Z","avatar_url":"https://github.com/mguenther.png","language":"Java","funding_links":[],"categories":["测试","Development"],"sub_categories":["Testing"],"readme":"# Kafka for JUnit\n\n[![Maven Central](https://maven-badges.herokuapp.com/maven-central/net.mguenther.kafka/kafka-junit/badge.svg)](https://maven-badges.herokuapp.com/maven-central/net.mguenther.kafka/kafka-junit)\n\n\u003e [!IMPORTANT]\n\u003e Kafka for JUnit will not be updated regularly any longer. Unfortunately, I do not have the time to allocate my attention to this project in a sustainable fashion. Updates and bugfixes **may** still happen (support for new versions, ...), but if they do, it will be solely based on my personal requirements. Thank you for your understanding.\n\nKafka for JUnit enables developers to start and stop a complete Kafka cluster comprised of Kafka brokers and distributed Kafka Connect workers from within a JUnit test. It also provides a rich set of convenient accessors to interact with such an embedded Kafka cluster in a lean and non-obtrusive way.\n\nKafka for JUnit can be used to both whitebox-test individual Kafka-based components of your application or to blackbox-test applications that offer an incoming and/or outgoing Kafka-based interface.\n\n## Using Kafka for JUnit in your tests\n\nKafka for JUnit provides the necessary infrastructure to exercise your Kafka-based components against an embeddable Kafka cluster. However, Kafka for JUnit got you covered as well if you are simply interested in using the convenient accessors against Kafka clusters that are already present in your infrastructure. Checkout sections *Working with an embedded Kafka cluster* and *Working with an external Kafka cluster* in the [user's guide](https://mguenther.github.io/kafka-junit) for more information.\n\n```java\nimport org.junit.jupiter.api.AfterEach;\nimport org.junit.jupiter.api.BeforeEach;\nimport org.junit.jupiter.api.Test;\n\nimport static net.mguenther.kafka.junit.EmbeddedKafkaCluster.provisionWith;\nimport static net.mguenther.kafka.junit.EmbeddedKafkaClusterConfig.defaultClusterConfig;\n\nclass KafkaTest {\n\n    private EmbeddedKafkaCluster kafka;\n\n    @BeforeEach\n    void setupKafka() {\n        kafka = provisionWith(defaultClusterConfig());\n        kafka.start();\n    }\n\n    @AfterEach\n    void tearDownKafka() {\n        kafka.stop();\n    }\n\n    @Test\n    void shouldWaitForRecordsToBePublished() throws Exception {\n        kafka.send(to(\"test-topic\", \"a\", \"b\", \"c\"));\n        kafka.observe(on(\"test-topic\", 3));\n    }\n}\n```\n\nThis starts an embedded Kafka cluster and submits three records to the topic named `test-topic`. The call to `kafka.observe(on(\"test-topic\", 3))` watches that same topic for a configurable amount of time and checks if it observes the previously submitted records. If it doesn't, Kafka for JUnit raises an `AssertionError` which would fail the test. Surely, [Kafka for JUnit provides lots of more ways to interact with a Kafka cluster]((https://mguenther.github.io/kafka-junit)).\n\nSince `EmbeddedKafkaCluster` implements the `AutoCloseable` interface, you can achieve the same behavior using a `try-with-resources`-construct.\n\n```java\nimport org.junit.jupiter.api.Test;\n\nimport static net.mguenther.kafka.junit.EmbeddedKafkaCluster.provisionWith;\nimport static net.mguenther.kafka.junit.EmbeddedKafkaClusterConfig.defaultClusterConfig;\n\nclass KafkaTest {\n\n  @Test\n  void shouldWaitForRecordsToBePublished() throws Exception {\n\n    try (EmbeddedKafkaCluster kafka = provisionWith(defaultClusterConfig())) {\n      kafka.start();\n      kafka.send(to(\"test-topic\", \"a\", \"b\", \"c\"));\n      kafka.observe(on(\"test-topic\", 3));\n    }\n  }\n}\n```\n\n### Supported versions of Apache Kafka\n\n| Version of Kafka for JUnit | Supports (up to)   |\n|----------------------------|--------------------|\n| 3.6.0                      | Apache Kafka 3.6.1 |\n| 3.5.1                      | Apache Kafka 3.5.1 |\n| 3.4.0                      | Apache Kafka 3.4.0 |\n| 3.3.0                      | Apache Kafka 3.3.1 |\n| 3.2.2                      | Apache Kafka 3.2.3 |\n| 3.1.1                      | Apache Kafka 3.1.0 |\n| 3.0.1                      | Apache Kafka 3.0.0 |\n| 2.8.0                      | Apache Kafka 2.8.0 |\n| 2.7.0                      | Apache Kafka 2.7.0 |\n| 2.6.0                      | Apache Kafka 2.6.0 |\n| 2.5.1                      | Apache Kafka 2.5.1 |\n| 2.4.0                      | Apache Kafka 2.4.0 |\n| 2.3.0                      | Apache Kafka 2.3.0 |\n| 2.2.0                      | Apache Kafka 2.2.1 |\n| 2.1.1                      | Apache Kafka 2.1.1 |\n| 2.0.0                      | Apache Kafka 2.0.0 |\n| 1.0.0                      | Apache Kafka 1.1.1 |\n\n## Interacting with the Kafka cluster\n\nSee the [comprehensive user's guide](https://mguenther.github.io/kafka-junit) for examples on how to interact with the Kafka cluster from within your JUnit test.\n\n## License\n\nThis work is released under the terms of the Apache 2.0 license.\n\n\u003cp\u003e\n    \u003cdiv align=\"center\"\u003e\n        \u003cdiv\u003e\u003cimg src=\"made-in-darmstadt.jpg\"\u003e\u003c/div\u003e\n        \u003cdiv\u003e\u003ca href=\"https://mguenther.net\"\u003emguenther.net\u003c/a\u003e\u003c/div\u003e\n    \u003c/div\u003e\n\u003c/p\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmguenther%2Fkafka-junit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmguenther%2Fkafka-junit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmguenther%2Fkafka-junit/lists"}