{"id":20622509,"url":"https://github.com/blindpirate/junit5-unroll-extension","last_synced_at":"2025-10-25T02:22:59.591Z","repository":{"id":133234591,"uuid":"126752942","full_name":"blindpirate/junit5-unroll-extension","owner":"blindpirate","description":"JUnit 5 Unroll Extension for Kotlin","archived":false,"fork":false,"pushed_at":"2018-08-02T02:06:58.000Z","size":100,"stargazers_count":9,"open_issues_count":0,"forks_count":4,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-08-30T21:52:46.282Z","etag":null,"topics":["data-driven-tests","junit5","junit5-framework","kotlin","spock"],"latest_commit_sha":null,"homepage":"","language":"Kotlin","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/blindpirate.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-03-26T00:30:50.000Z","updated_at":"2025-08-24T04:03:54.000Z","dependencies_parsed_at":"2023-07-03T22:02:11.611Z","dependency_job_id":null,"html_url":"https://github.com/blindpirate/junit5-unroll-extension","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/blindpirate/junit5-unroll-extension","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blindpirate%2Fjunit5-unroll-extension","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blindpirate%2Fjunit5-unroll-extension/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blindpirate%2Fjunit5-unroll-extension/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blindpirate%2Fjunit5-unroll-extension/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/blindpirate","download_url":"https://codeload.github.com/blindpirate/junit5-unroll-extension/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blindpirate%2Fjunit5-unroll-extension/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273233242,"owners_count":25068725,"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","status":"online","status_checked_at":"2025-09-02T02:00:09.530Z","response_time":77,"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":["data-driven-tests","junit5","junit5-framework","kotlin","spock"],"created_at":"2024-11-16T12:23:12.550Z","updated_at":"2025-10-25T02:22:54.571Z","avatar_url":"https://github.com/blindpirate.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"# JUnit 5 Unroll Extension for Kotlin\n\n\n[![Build Status](https://travis-ci.org/blindpirate/junit5-unroll-extension.svg?branch=master)](https://travis-ci.org/blindpirate/junit5-unroll-extension)\n[![Apache License 2](https://img.shields.io/badge/license-APL2-blue.svg)](http://www.apache.org/licenses/LICENSE-2.0.txt)\n\n\nJUnit 5 Unroll Extension is a JUnit 5 extension which supports parameterized tests in kotlin. TL;DR:\n\n```\nimport com.github.blindpirate.junit.extension.unroll.Param\nimport com.github.blindpirate.junit.extension.unroll.Unroll\nimport com.github.blindpirate.junit.extension.unroll.where\nimport java.lang.Math\n\nclass Math {\n    @Unroll\n    fun `max number of {0} and {1} is {2}`(\n            a: Int, b: Int, c: Int, param: Param = where {\n                1 _ 3 _ 3\n                7 _ 4 _ 7 \n                0 _ 0 _ 0\n            }) {\n        assert(Math.max(a, b) == c)\n    }\n}\n``` \n\nyields the following result:\n\n```\nmax number of {0} and {1} is {2}(int, int, int, com.github.blindpirate.Param) ✔\n├─ max number of 0 and 0 is 0 ✔\n├─ max number of 1 and 3 is 3 ✔\n└─ max number of 7 and 4 is 7 ✔\n```\n\n## How to use\n\nMaven:\n\n```\n\u003cdependency\u003e\n    \u003cgroupId\u003ecom.github.blindpirate\u003c/groupId\u003e\n    \u003cartifactId\u003ejunit5-unroll-extension\u003c/artifactId\u003e\n    \u003cversion\u003e0.1.2\u003c/version\u003e\n    \u003cscope\u003etest\u003c/scope\u003e\n\u003c/dependency\u003e\n```\n\nGradle:\n\n```\nrepositories {\n    jcenter()\n}\n\ndependencies {\n    testCompile 'com.github.blindpirate:junit5-unroll-extension:0.1.2'\n}\n```\n\n- Add configuration to your `pom.xml` or `build.gradle`.\n- Add `@Unroll` to your test method. Note `@Unroll` can't be used together with `@Test` or `@ParamerizedTest`.\n- Put the arguments in the `where` function as shown above.\n\n## Why Unroll Extension\n\nThis extension is greatly inspired by [Spock](http://spockframework.org/). If you have used [Spock](http://spockframework.org/), \nyou may be impressed by its powerful [Data Driven Test](http://spockframework.org/spock/docs/1.0/data_driven_testing.html):\n\n\n```\nclass Math extends Specification {\n    def \"maximum of two numbers\"(int a, int b, int c) {\n        expect:\n        Math.max(a, b) == c\n\n        where:\n        a | b | c\n        1 | 3 | 3\n        7 | 4 | 7 \n        0 | 0 | 0\n    }\n}\n```\n\nOther frameworks have similar features:\n\n[JUnit 4 Parmeterized Tests](https://github.com/junit-team/junit4/wiki/parameterized-tests):\n\n```\n@RunWith(Parameterized.class)\npublic class FibonacciTest {\n    @Parameters\n    public static Collection\u003cObject[]\u003e data() {\n        return Arrays.asList(new Object[][] {\n                 { 0, 0 }, { 1, 1 }, { 2, 1 }, { 3, 2 }, { 4, 3 }, { 5, 5 }, { 6, 8 }  \n           });\n    }\n\n    @Parameter // first data value (0) is default\n    public /* NOT private */ int fInput;\n\n    @Parameter(1)\n    public /* NOT private */ int fExpected;\n\n    @Test\n    public void test() {\n        assertEquals(fExpected, Fibonacci.compute(fInput));\n    }\n}\n```\n\n[JUnit 5 Parameterized Tests](https://junit.org/junit5/docs/current/user-guide/#writing-tests-parameterized-tests):\n\n```\n@ParameterizedTest\n@ValueSource(ints = { 1, 2, 3 })\nvoid testWithValueSource(int argument) {\n    assertTrue(argument \u003e 0 \u0026\u0026 argument \u003c 4);\n}\n```\n\nHowever, you can hardly add anything other than strings and numbers into `@ValueSource`. Extra `ArgumentsProvider`\nand `ArgumentConverter` make things much more complex.\n\n\nWith this extension, you can have your parameters as they are.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fblindpirate%2Fjunit5-unroll-extension","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fblindpirate%2Fjunit5-unroll-extension","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fblindpirate%2Fjunit5-unroll-extension/lists"}