{"id":22072936,"url":"https://github.com/unruly/junit-rules","last_synced_at":"2025-07-24T11:30:58.232Z","repository":{"id":21982945,"uuid":"25307856","full_name":"unruly/junit-rules","owner":"unruly","description":"A collection of useful JUnit rules from Unruly's codebases","archived":false,"fork":false,"pushed_at":"2018-03-21T14:42:03.000Z","size":44,"stargazers_count":17,"open_issues_count":0,"forks_count":2,"subscribers_count":22,"default_branch":"master","last_synced_at":"2024-03-25T13:10:24.330Z","etag":null,"topics":["java","junit","junit-rule","tdd"],"latest_commit_sha":null,"homepage":"http://tech.unruly.co/junit-rules/","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/unruly.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-10-16T15:09:48.000Z","updated_at":"2024-03-25T13:10:24.331Z","dependencies_parsed_at":"2022-08-20T03:21:37.999Z","dependency_job_id":null,"html_url":"https://github.com/unruly/junit-rules","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unruly%2Fjunit-rules","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unruly%2Fjunit-rules/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unruly%2Fjunit-rules/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unruly%2Fjunit-rules/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/unruly","download_url":"https://codeload.github.com/unruly/junit-rules/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":227432290,"owners_count":17775894,"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":["java","junit","junit-rule","tdd"],"created_at":"2024-11-30T21:16:05.821Z","updated_at":"2024-11-30T21:16:08.687Z","avatar_url":"https://github.com/unruly.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"junit-rules\n===========\n\n[![Build Status](https://travis-ci.org/unruly/junit-rules.svg?branch=master)](https://travis-ci.org/unruly/junit-rules)\n\nA collection of useful JUnit rules from Unruly's codebases\n\n## Install from Maven Central\n\n```xml\n\u003cdependency\u003e\n    \u003cgroupId\u003eco.unruly\u003c/groupId\u003e\n    \u003cartifactId\u003ejunit-rules\u003c/artifactId\u003e\n    \u003cversion\u003e1.1\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\n## Ignore tests until a certain date or datetime.\n\nThis allows you to write an acceptance/integration test before implementing a feature, and integrate it into your codebase before the implementation is complete.\n\n`@IgnoreUntil` must be present on the test method you wish to ignore. \n\nThe date/datetime value of the class level annotation can be shared across methods in the class or overridden by the method annotation.\n\n```java\n\n@IgnoreUntil(\"2099-01-01\")\npublic class MyIgnorableTest {\n\n    @Rule public IgnoreUntilRule rule = new IgnoreUntilRule();\n\n    @IgnoreUntil\n    @Test\n    public void ignoredUntil20990101() {\n    }\n\n    @IgnoreUntil\n    @Test\n    public void alsoIgnoredUntil20990101() {\n    }\n\n    @IgnoreUntil(\"2014-10-30\")\n    @Test\n    public void ignoredUntil20141030() {\n    }\n\n    @IgnoreUntil(\"2014-10-30T17:30:00\")\n    @Test\n    public void ignoredUntil20141030T173000() {\n    }\n\n    @Test\n    public void notIgnored() {\n    }\n}\n```\n\nThe class annotation is optional, you can just annotate the method.\n\n```java\n\npublic class MyIgnorableTest {\n\n    @Rule public IgnoreUntilRule rule = new IgnoreUntilRule();\n\n    @IgnoreUntil(\"2014-10-30T17:30:00\")\n    @Test\n    public void ignoredUntil20141030T173000() {\n    }\n\n    @Test\n    public void notIgnored() {\n    }\n}\n```\n\n## Quarantine non-deterministic tests\n\n```java\n@Rule QuarantineRule rule = new QuarantineRule();\n\n@NonDeterministic(retries=3)\npublic void some_sporadically_failing_test() {\n\n}\n```\n\nQuarantineRule supports a functional interface called QuarantineRuleLogger as a constructor argument for additional logging capabilities. For example, we email ourselves failures so it's harder to ignore.\n\n```java\n@Rule QuarantineRule rule = new QuarantineRule(msg -\u003e System.err.println(msg));\n```\n\n## Make sure tests pass reliably\n\nWe use this to diagnose tests as being non-deterministic. To run each test 10 times:\n\n```java\n@Rule ReliabilityRule rule = new ReliabilityRule(10);\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Funruly%2Fjunit-rules","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Funruly%2Fjunit-rules","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Funruly%2Fjunit-rules/lists"}