{"id":23282774,"url":"https://github.com/itsallcode/junit5-system-extensions","last_synced_at":"2026-03-05T21:31:35.608Z","repository":{"id":36814438,"uuid":"153826609","full_name":"itsallcode/junit5-system-extensions","owner":"itsallcode","description":"JUnit5 extensions to test Java System.x functions","archived":false,"fork":false,"pushed_at":"2024-09-08T06:56:50.000Z","size":172,"stargazers_count":8,"open_issues_count":1,"forks_count":1,"subscribers_count":7,"default_branch":"main","last_synced_at":"2025-07-10T06:57:39.858Z","etag":null,"topics":["extension","java","junit","junit5","junit5-extension","unit-testing"],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"epl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/itsallcode.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE.md","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}},"created_at":"2018-10-19T18:38:55.000Z","updated_at":"2024-09-08T06:54:27.000Z","dependencies_parsed_at":"2024-09-08T07:46:45.483Z","dependency_job_id":"9d2086a4-bf56-4644-b3f8-f7b23b04809c","html_url":"https://github.com/itsallcode/junit5-system-extensions","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/itsallcode/junit5-system-extensions","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/itsallcode%2Fjunit5-system-extensions","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/itsallcode%2Fjunit5-system-extensions/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/itsallcode%2Fjunit5-system-extensions/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/itsallcode%2Fjunit5-system-extensions/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/itsallcode","download_url":"https://codeload.github.com/itsallcode/junit5-system-extensions/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/itsallcode%2Fjunit5-system-extensions/sbom","scorecard":{"id":497359,"data":{"date":"2025-08-11","repo":{"name":"github.com/itsallcode/junit5-system-extensions","commit":"4b1dc3afe2f3798b954cba6796186fa30f418047"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":5.1,"checks":[{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","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":"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":"Code-Review","score":8,"reason":"Found 12/15 approved changesets -- score normalized to 8","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":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Info: jobLevel 'contents' permission set to 'read': .github/workflows/build.yml:13","Info: jobLevel 'contents' permission set to 'read': .github/workflows/codeql-analysis.yml:14","Warn: jobLevel 'contents' permission set to 'write': .github/workflows/release.yml:22","Warn: no topLevel permission defined: .github/workflows/build.yml:1","Warn: no topLevel permission defined: .github/workflows/codeql-analysis.yml:1","Warn: no topLevel permission defined: .github/workflows/release.yml:1"],"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":"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":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/build.yml:26: update your workflow using https://app.stepsecurity.io/secureworkflow/itsallcode/junit5-system-extensions/build.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/build.yml:29: update your workflow using https://app.stepsecurity.io/secureworkflow/itsallcode/junit5-system-extensions/build.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/build.yml:38: update your workflow using https://app.stepsecurity.io/secureworkflow/itsallcode/junit5-system-extensions/build.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql-analysis.yml:24: update your workflow using https://app.stepsecurity.io/secureworkflow/itsallcode/junit5-system-extensions/codeql-analysis.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql-analysis.yml:26: update your workflow using https://app.stepsecurity.io/secureworkflow/itsallcode/junit5-system-extensions/codeql-analysis.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql-analysis.yml:33: update your workflow using https://app.stepsecurity.io/secureworkflow/itsallcode/junit5-system-extensions/codeql-analysis.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql-analysis.yml:38: update your workflow using https://app.stepsecurity.io/secureworkflow/itsallcode/junit5-system-extensions/codeql-analysis.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql-analysis.yml:41: update your workflow using https://app.stepsecurity.io/secureworkflow/itsallcode/junit5-system-extensions/codeql-analysis.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/release.yml:25: update your workflow using https://app.stepsecurity.io/secureworkflow/itsallcode/junit5-system-extensions/release.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/release.yml:29: update your workflow using https://app.stepsecurity.io/secureworkflow/itsallcode/junit5-system-extensions/release.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/release.yml:35: update your workflow using https://app.stepsecurity.io/secureworkflow/itsallcode/junit5-system-extensions/release.yml/main?enable=pin","Info:   0 out of  11 GitHub-owned GitHubAction dependencies pinned"],"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":"Packaging","score":10,"reason":"packaging workflow detected","details":["Info: Project packages its releases by way of GitHub Actions.: .github/workflows/release.yml:13"],"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":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE.md:0","Info: FSF or OSI recognized license: Eclipse Public License 2.0: LICENSE.md: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":0,"reason":"Project has not signed or included provenance with any releases.","details":["Warn: release artifact 1.0.3 not signed: https://api.github.com/repos/itsallcode/junit5-system-extensions/releases/13836919","Warn: release artifact 0.1.0 not signed: https://api.github.com/repos/itsallcode/junit5-system-extensions/releases/13571557","Warn: release artifact 1.0.3 does not have provenance: https://api.github.com/repos/itsallcode/junit5-system-extensions/releases/13836919","Warn: release artifact 0.1.0 does not have provenance: https://api.github.com/repos/itsallcode/junit5-system-extensions/releases/13571557"],"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":-1,"reason":"internal error: error during branchesHandler.setup: internal error: githubv4.Query: Resource not accessible by integration","details":null,"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":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"SAST","score":10,"reason":"SAST tool detected","details":["Info: SAST configuration detected: CodeQL","Info: SAST configuration detected: Sonar","Warn: 3 commits out of 28 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"}}]},"last_synced_at":"2025-08-19T20:48:27.149Z","repository_id":36814438,"created_at":"2025-08-19T20:48:27.149Z","updated_at":"2025-08-19T20:48:27.149Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30150409,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-05T21:15:50.531Z","status":"ssl_error","status_checked_at":"2026-03-05T21:15:11.173Z","response_time":93,"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":["extension","java","junit","junit5","junit5-extension","unit-testing"],"created_at":"2024-12-20T00:29:39.327Z","updated_at":"2026-03-05T21:31:35.587Z","avatar_url":"https://github.com/itsallcode.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# junit5-system-extensions (J5SE)\n\nThis project provides a set of JUnit 5 extension that allow testing behavior related to functions related to `java.lang.System` (e.g. asserting exit status codes).\n\n[![Build](https://github.com/itsallcode/junit5-system-extensions/actions/workflows/build.yml/badge.svg)](https://github.com/itsallcode/junit5-system-extensions/actions/workflows/build.yml)\n[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=org.itsallcode%3Ajunit5-system-extensions\u0026metric=alert_status)](https://sonarcloud.io/dashboard?id=org.itsallcode%3Ajunit5-system-extensions)\n[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=org.itsallcode%3Ajunit5-system-extensions\u0026metric=coverage)](https://sonarcloud.io/dashboard?id=org.itsallcode%3Ajunit5-system-extensions)\n[![Maven Central](https://img.shields.io/maven-central/v/org.itsallcode/junit5-system-extensions)](https://search.maven.org/artifact/org.itsallcode/junit5-system-extensions)\n\n## Acknowledgments\n\nThe extensions in this project were inspired by a set of JUnit4 rules called \"[System Rules](https://stefanbirkner.github.io/system-rules/)\" which were written by Stefan Brikner and licensed under the Common Public License 1.0 (CPL).\n\n## Runtime Dependencies\n\nStarting with version 1.2.0 `junit5-system-extensions` requires Java 11 to compile and at runtime. If your project requires Java 8, please use version 1.1.0.\n\n| Dependency                                                                   | Purpose                                                | License                       |\n-------------------------------------------------------------------------------|--------------------------------------------------------|--------------------------------\n| [JUnit5](https://junit.org/junit5/)                                          | Unit test framework                                    | Eclipse Public License v2.0   |\n\n## Usage\n\n### Asserting `System.exit(int)` Calls\n\nTo trap and check calls to `System.exit(int)` follow these steps:\n\n1. Extend the test class with the class `ExitGuard`\n2. Use `AssertExit.assertExit(Runnable)` or `AssertExit.assertExitWithStatus(int, Runnable)` to check for exit calls\n\nExample:\n\n```java\nimport static org.itsallcode.junit.AssertExit.assertExit;\n\nimport org.itsallcode.junit.sysextensions.ExitGuard;\nimport org.junit.jupiter.api.Test;\nimport org.junit.jupiter.api.extension.ExtendWith;\n\n@ExtendWith(ExitGuard.class)\nclass TestSystemExit\n{\n    @Test\n    void testSystemExit()\n    {\n        assertExit(() -\u003e System.exit(1));\n    }\n}\n```\n\nThe `ExitGuard` temporarily replaces the existing security manager.\n\nFrom version 1.2.0 on if a security guard existed before, it serves as a delegate for all security checks with the exception of the `checkExit`.\n\n**Warning:** The JREs Security Manager used by `ExitGuard` is deprecated and is not supported by Java 21 and later. It still works with Java 17 but logs the following warning:\n\n```\nWARNING: A terminally deprecated method in java.lang.System has been called\nWARNING: System::setSecurityManager has been called by ...\nWARNING: Please consider reporting this to the maintainers of ...\nWARNING: System::setSecurityManager will be removed in a future release\n```\n\n## Asserting Data Sent to `System.out`\n\nTo capture data sent to `System.out`, follow these steps:\n\n1. Extend the test class with `SystemOutGuard`\n2. Add a parameter of type `Capturable` to the test method (or the before-all-method)\n3. Activate capturing on the stream\n4. Run code under test\n5. Check captured data\n\nExample:\n\n```java\nimport static org.junit.jupiter.api.Assertions.assertEquals;\n\nimport org.itsallcode.io.Capturable;\nimport org.junit.jupiter.api.Test;\nimport org.junit.jupiter.api.extension.ExtendWith;\n\n@ExtendWith(SystemOutGuard.class)\nclass TestSystemOut\n{\n    @Test\n    void testCapture(final Capturable stream)\n    {\n        stream.capture();\n        final String expected = \"This text must be captured.\";\n        System.out.print(expected);\n        assertEquals(stream.getCapturedData(), expected);\n    }\n}\n```\n\nTo mute the output (i.e. don't forward output to `System.out` / `System.err`) call `stream.captureMuted()` instead of `stream.capture()`. This can be useful to speed up unit tests.\n\n## Asserting Data Sent to `System.err`\n\nCapturing data sent to `System.err` works in the exact same way as in the [`System.out` case](#asserting-data-sent-to-system-out). The only difference is that you need to extend the test class with the `SystemErrGuard`.\n\n## Contributing, Feature Requests and Error Reporting\n\nPlease check our [contribution guide](.github/CONTRIBUTING.md) to learn how you can help with the project, report errors or request features.\n\n## Changelog\n\n[Changelog](doc/changes/changelog.md)\n\n## Development\n\n### Build Time Dependencies\n\nThe list below show all build time dependencies in alphabetical order. Note that except the [Maven](https://maven.apache.org/) build tool all required modules are downloaded automatically by Maven.\n\n| Dependency                                                                       | Purpose                                                | License                       |\n-----------------------------------------------------------------------------------|--------------------------------------------------------|--------------------------------\n| [Apache Maven](https://maven.apache.org/)                                        | Build tool                                             | Apache License 2.0            |\n| [License Maven Plugin](https://www.mojohaus.org/license-maven-plugin/)           | Add licenses to source files automatically             | GNU Public License 3.0        |\n| [Maven Compiler Plugin](https://maven.apache.org/plugins/maven-compiler-plugin/) | Maven provided and controlled Java compiler            | Apache License 2.0            |\n| [Maven Source Plugin](https://maven.apache.org/plugins/maven-source-plugin/)     | Create Source JAR packages                             | Apache License 2.0            |\n| [Maven JavaDoc Plugin](https://maven.apache.org/plugins/maven-javadoc-plugin/)   | Create JavaDoc JAR packages                            | Apache License 2.0            |\n| [Mockito](https://site.mockito.org/)                                             | Mocking framework                                      | MIT License                   |\n\n### Essential Build Steps\n\n* `git clone https://github.com/itsallcode/junit5-system-extensions.git`\n* Run `mvn test` to run unit tests.\n* Run `mvn package` to create the JAR file.\n\n## Run local sonar analysis\n\n```bash\nmvn clean org.jacoco:jacoco-maven-plugin:prepare-agent package sonar:sonar \\\n    -Dsonar.token=[token]\n```\n\nSee analysis results at https://sonarcloud.io/dashboard?id=org.itsallcode%3Ajunit5-system-extensions\n\n## Check for updated dependencies / plugins\n\n```bash\nmvn --update-snapshots versions:display-dependency-updates versions:display-plugin-updates\n```\n\n### Publishing to MavenCentral\n#### Prepare the Release\n\n1. Checkout the `main` branch.\n2. Update version in `pom.xml` and changelog.\n3. Commit and push changes.\n4. Create a new pull request, have it reviewed and merged to `main`.\n\n### Perform the Release\n\n1. Start the release workflow\n  * Run command `gh workflow run release.yml --repo itsallcode/junit5-system-extensions --ref main`\n  * or go to [GitHub Actions](https://github.com/itsallcode/junit5-system-extensions/actions/workflows/release.yml) and start the `release.yml` workflow on branch `main`.\n2. Update title and description of the newly created [GitHub release](https://github.com/itsallcode/junit5-system-extensions/releases).\n3. After some time the release will be available at [Maven Central](https://repo1.maven.org/maven2/org/itsallcode/junit5-system-extensions/).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fitsallcode%2Fjunit5-system-extensions","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fitsallcode%2Fjunit5-system-extensions","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fitsallcode%2Fjunit5-system-extensions/lists"}