{"id":20532361,"url":"https://github.com/unitvectory-labs/fileparamunit","last_synced_at":"2026-02-24T09:31:48.910Z","repository":{"id":225427074,"uuid":"765969599","full_name":"UnitVectorY-Labs/fileparamunit","owner":"UnitVectorY-Labs","description":"Library for creating parameterized JUnit 5 tests based on files that exist in resources.","archived":false,"fork":false,"pushed_at":"2026-02-21T11:59:48.000Z","size":328,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-02-21T18:08:04.675Z","etag":null,"topics":["java-17","junit5","mavencentral"],"latest_commit_sha":null,"homepage":"","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/UnitVectorY-Labs.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-03-02T01:40:30.000Z","updated_at":"2026-02-21T12:00:09.000Z","dependencies_parsed_at":"2024-06-16T13:49:43.115Z","dependency_job_id":"716a8e15-1901-4efa-a1c6-447b7c6ea581","html_url":"https://github.com/UnitVectorY-Labs/fileparamunit","commit_stats":null,"previous_names":["unitvectory-labs/fileparamunit"],"tags_count":9,"template":false,"template_full_name":null,"purl":"pkg:github/UnitVectorY-Labs/fileparamunit","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/UnitVectorY-Labs%2Ffileparamunit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/UnitVectorY-Labs%2Ffileparamunit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/UnitVectorY-Labs%2Ffileparamunit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/UnitVectorY-Labs%2Ffileparamunit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/UnitVectorY-Labs","download_url":"https://codeload.github.com/UnitVectorY-Labs/fileparamunit/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/UnitVectorY-Labs%2Ffileparamunit/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29777876,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-24T04:54:30.205Z","status":"ssl_error","status_checked_at":"2026-02-24T04:53:58.628Z","response_time":75,"last_error":"SSL_read: 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":["java-17","junit5","mavencentral"],"created_at":"2024-11-16T00:14:31.785Z","updated_at":"2026-02-24T09:31:48.886Z","avatar_url":"https://github.com/UnitVectorY-Labs.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![GitHub release](https://img.shields.io/github/release/UnitVectorY-Labs/fileparamunit.svg)](https://github.com/UnitVectorY-Labs/fileparamunit/releases/latest) [![License](https://img.shields.io/badge/License-EPL%202.0-blue.svg)](https://www.eclipse.org/legal/epl-v20.html) [![Active](https://img.shields.io/badge/Status-Active-green)](https://guide.unitvectorylabs.com/bestpractices/status/#active) [![Maven Central](https://img.shields.io/maven-central/v/com.unitvectory/fileparamunit)](https://central.sonatype.com/artifact/com.unitvectory/fileparamunit) [![javadoc](https://javadoc.io/badge2/com.unitvectory/fileparamunit/javadoc.svg)](https://javadoc.io/doc/com.unitvectory/fileparamunit) [![codecov](https://codecov.io/gh/UnitVectorY-Labs/fileparamunit/graph/badge.svg?token=4V52PCKXPU)](https://codecov.io/gh/UnitVectorY-Labs/fileparamunit)\n\n# fileparamunit\n\nLibrary for creating parameterized JUnit 5 tests based on files that exist in resources.\n\n## Purpose\n\nThis library provides an extension to the JUnit 5 Parameterized Tests [junit-jupiter-params](https://mvnrepository.com/artifact/org.junit.jupiter/junit-jupiter-params), a very helpful way to implement multiple test cases without needing to duplicate code.\n\nWhile JUnit 5 provides useful methods for parameters including Arguments, CSV file contents, enumerations, methods, and values, `fileparamunit` provides an additional mechanism looping through a directory of files and providing the path to each file as an input to the test case. The annotation can specify the file extensions to include in the output and recursion can be turned on if desired.\n\nThe reasoning behind this is that a set of test data can be used with a common JUnit test code to acchieve a testing objective while reducing the amount of code needed shifting that complexity over to the contexts of the files.\n\n## Getting Started\n\nThis library requires Java 17 and JUnit 5 and is available in the Maven Central Repository:\n\n```xml\n\u003cdependency\u003e\n    \u003cgroupId\u003ecom.unitvectory\u003c/groupId\u003e\n    \u003cartifactId\u003efileparamunit\u003c/artifactId\u003e\n    \u003cversion\u003e0.1.1\u003c/version\u003e\n    \u003cscope\u003etest\u003c/scope\u003e\n\u003c/dependency\u003e\n```\n\n## Usage\n\nThe `@ListFileSource` annotation is provided by this library and is used in conjunction with `@ParameterizedTest` to provide the parameterized test. It provides a single parameter, a String populated with the absolute path to the files specifed by providing `resources` which is the path under resources to crawl along with `fileExtension` which must be specified to filter into files with the indicated file extension. By default only the specified directory is crawled, but `recurse` can be set to true to recursive crawl the directories for additional files.\n\nThe following example looks at all files under resources in the `testData` folder with the `.json` file extension recursing through any subfolders. The fileName is passed to the method where it can be used to complete a test.\n\n```java\npackage example;\n\nimport static org.junit.jupiter.api.Assertions.assertTrue;\nimport com.unitvectory.fileparamunit.ListFileSource;\nimport java.io.File;\nimport org.junit.jupiter.params.ParameterizedTest;\n\npublic class ExampleTest {\n\n    @ParameterizedTest\n    @ListFileSource(resources = \"/testData/\", fileExtension = \".json\", recurse = true)\n    public void exampleTest(String fileName) {\n        File file = new File(fileName);\n\n        // This is where logic to use the content of the file would go\n        assertTrue(file.exists());\n    }\n}\n```\n\n## Dependencies and Compatibility\n\nThis library depends on JUnit 5.13.0 or newer specifically due to a breaking change in the `AnnotationBasedArgumentsProvider` class. The `junit-jupiter-params` module must be included in your project as a dependency to use the `@ListFileSource` annotation.\n\nIf you have compilation issues related to JUnit 5 when using this library, it is recommended to use the JUnit BOM (Bill of Materials) to ensure compatibility with the JUnit 5 version you are using. You can add the following dependency management section to your `pom.xml`:\n\n```xml\n\u003cdependencyManagement\u003e\n  \u003cdependencies\u003e\n    \u003cdependency\u003e\n      \u003cgroupId\u003eorg.junit\u003c/groupId\u003e\n      \u003cartifactId\u003ejunit-bom\u003c/artifactId\u003e\n      \u003cversion\u003e5.13.1\u003c/version\u003e\n      \u003ctype\u003epom\u003c/type\u003e\n      \u003cscope\u003eimport\u003c/scope\u003e\n    \u003c/dependency\u003e\n  \u003c/dependencies\u003e\n\u003c/dependencyManagement\u003e\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Funitvectory-labs%2Ffileparamunit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Funitvectory-labs%2Ffileparamunit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Funitvectory-labs%2Ffileparamunit/lists"}