{"id":19260084,"url":"https://github.com/fhofherr/junit5-class-source","last_synced_at":"2025-10-29T14:46:26.159Z","repository":{"id":139501316,"uuid":"155057755","full_name":"fhofherr/junit5-class-source","owner":"fhofherr","description":"@ClassSource annotation for Juni5 parameterized tests","archived":false,"fork":false,"pushed_at":"2019-04-06T14:51:39.000Z","size":64,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-05T09:42:42.665Z","etag":null,"topics":["java","junit5","parameterized-tests","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":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fhofherr.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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-10-28T10:14:24.000Z","updated_at":"2019-04-06T14:51:41.000Z","dependencies_parsed_at":null,"dependency_job_id":"fddd03fc-f1c6-4bd9-8567-5832b3854c2c","html_url":"https://github.com/fhofherr/junit5-class-source","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fhofherr%2Fjunit5-class-source","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fhofherr%2Fjunit5-class-source/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fhofherr%2Fjunit5-class-source/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fhofherr%2Fjunit5-class-source/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fhofherr","download_url":"https://codeload.github.com/fhofherr/junit5-class-source/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240357002,"owners_count":19788646,"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","junit5","parameterized-tests","testing"],"created_at":"2024-11-09T19:18:51.674Z","updated_at":"2025-10-29T14:46:21.135Z","avatar_url":"https://github.com/fhofherr.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# junit5-class-source\n\n[![Build Status](https://travis-ci.org/fhofherr/junit5-class-source.svg?branch=master)](https://travis-ci.org/fhofherr/junit5-class-source)\n\nA simple `@ClassSource` annotation to use with\n[JUnit5](https://junit.org) [parameterized\ntests](https://junit.org/junit5/docs/current/user-guide/#writing-tests-parameterized-tests).\n\n## Example\n\n```java\n...\n\n@ParameterizedTest\n@ClassSource(SampleDataProvider.class)\nvoid showClassSourceUsage(SampleData data) {\n    assertTrue(asList(\"value1\", \"value2\").contains(data.value));\n}\n\n...\n\nprivate static class SampleDataProvider implements TestDataProvider\u003cSampleData\u003e {\n\n    @Override\n    public Stream\u003cSampleData\u003e provideTestData() {\n        return Stream.of(\n                new SampleData(\"value1\"),\n                new SampleData(\"value2\"));\n    }\n}\n\nprivate static class SampleData {\n    String value;\n\n    SampleData(String value) {\n        this.value = value;\n    }\n}\n```\n\n## Rationale\n\nI really love to use the [parameterized\ntests](https://junit.org/junit5/docs/current/user-guide/#writing-tests-parameterized-tests)\nfeature of JUnit5. Mostly I use the `@MethodSource`. However, often I wish\nI could specify the source my test data in a more refactoring-save way instead\nof a string pointing to a method in a class.\n\nThe `@ClassSource` allows me to do just this. Instead of a string I specify\na class. I don't have to bother about updating the string (or count on my IDE\ndoing it) when I decide to refactor my sources.\n\n## License\n\nCopyright © 2018 Ferdinand Hofherr\n\nDistributed under the MIT License.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffhofherr%2Fjunit5-class-source","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffhofherr%2Fjunit5-class-source","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffhofherr%2Fjunit5-class-source/lists"}