{"id":25776508,"url":"https://github.com/six2six/fixture-factory","last_synced_at":"2026-04-05T01:32:41.615Z","repository":{"id":43171053,"uuid":"1553628","full_name":"six2six/fixture-factory","owner":"six2six","description":"Generator fake objects from a template","archived":false,"fork":false,"pushed_at":"2023-04-14T18:11:04.000Z","size":444,"stargazers_count":447,"open_issues_count":34,"forks_count":86,"subscribers_count":50,"default_branch":"master","last_synced_at":"2025-07-12T19:48:23.744Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Java","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/six2six.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}},"created_at":"2011-04-01T01:29:25.000Z","updated_at":"2025-06-25T14:15:37.000Z","dependencies_parsed_at":"2024-01-03T01:26:32.284Z","dependency_job_id":"b11edc7c-87c9-4f61-b4ee-af8c9eeeae3b","html_url":"https://github.com/six2six/fixture-factory","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/six2six/fixture-factory","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/six2six%2Ffixture-factory","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/six2six%2Ffixture-factory/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/six2six%2Ffixture-factory/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/six2six%2Ffixture-factory/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/six2six","download_url":"https://codeload.github.com/six2six/fixture-factory/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/six2six%2Ffixture-factory/sbom","scorecard":{"id":828368,"data":{"date":"2025-08-11","repo":{"name":"github.com/six2six/fixture-factory","commit":"a098d6c65356b93aac77e680f9c2c9920029f2bb"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2,"checks":[{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","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":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"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":"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":"Code-Review","score":4,"reason":"Found 7/16 approved changesets -- score normalized to 4","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":-1,"reason":"No tokens found","details":null,"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":"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":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"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":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: Apache License 2.0: LICENSE: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 3.0.0 not signed: https://api.github.com/repos/six2six/fixture-factory/releases/895440","Warn: release artifact 2.2.0 not signed: https://api.github.com/repos/six2six/fixture-factory/releases/289718","Warn: release artifact 3.0.0 does not have provenance: https://api.github.com/repos/six2six/fixture-factory/releases/895440","Warn: release artifact 2.2.0 does not have provenance: https://api.github.com/repos/six2six/fixture-factory/releases/289718"],"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":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"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":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 21 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"}},{"name":"Vulnerabilities","score":0,"reason":"10 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-6phf-73q6-gh87","Warn: Project is vulnerable to: GHSA-p66x-2cv9-qq3v","Warn: Project is vulnerable to: GHSA-wxr5-93ph-8wr9","Warn: Project is vulnerable to: GHSA-j288-q9x7-2f5v","Warn: Project is vulnerable to: GHSA-269g-pwp5-87pp","Warn: Project is vulnerable to: GHSA-2qrg-x229-3v8q","Warn: Project is vulnerable to: GHSA-65fg-84f6-3jq3","Warn: Project is vulnerable to: GHSA-f7vh-qwp3-x37m","Warn: Project is vulnerable to: GHSA-fp5r-v3w9-4333","Warn: Project is vulnerable to: GHSA-w9p3-5cr8-m3jj"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-23T17:05:57.230Z","repository_id":43171053,"created_at":"2025-08-23T17:05:57.230Z","updated_at":"2025-08-23T17:05:57.230Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31421869,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-05T00:25:07.052Z","status":"ssl_error","status_checked_at":"2026-04-05T00:25:05.923Z","response_time":60,"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":[],"created_at":"2025-02-27T06:01:25.715Z","updated_at":"2026-04-05T01:32:41.587Z","avatar_url":"https://github.com/six2six.png","language":"Java","funding_links":[],"categories":["测试","Projects","项目","Solutions"],"sub_categories":["Testing","测试"],"readme":"![Fixture Factory](http://s27.postimg.org/g2cbltgv7/fixture_factory.png)\n==================================================================\n[![Build Status](https://travis-ci.org/six2six/fixture-factory.png?branch=master)](https://travis-ci.org/six2six/fixture-factory)\n[![codecov](https://codecov.io/gh/six2six/fixture-factory/branch/master/graph/badge.svg)](https://codecov.io/gh/six2six/fixture-factory)\n\nFixture Factory is a tool to help developers quickly build and organize fake objects for unit tests. The key idea is to create specification limits of the data (templates) instead of hardcoded data. Try using F-F, then you can focus on the behavior of your methods and we manage the data.\n\n## Installing\n\nUse it like a maven dependency on your project\n\n\t\u003cdependency\u003e\n\t\t\u003cgroupId\u003ebr.com.six2six\u003c/groupId\u003e\n\t\t\u003cartifactId\u003efixture-factory\u003c/artifactId\u003e\n\t\t\u003cversion\u003e3.1.0\u003c/version\u003e\n\t\u003c/dependency\u003e\n\n## Usage\n\nWriting template rules\n\n\tFixture.of(Client.class).addTemplate(\"valid\", new Rule(){{\n\t\tadd(\"id\", random(Long.class, range(1L, 200L)));\n\t\tadd(\"name\", random(\"Anderson Parra\", \"Arthur Hirata\"));\n\t\tadd(\"nickname\", random(\"nerd\", \"geek\"));\n\t\tadd(\"email\", \"${nickname}@gmail.com\");\n\t\tadd(\"birthday\", instant(\"18 years ago\"));\n\t\tadd(\"address\", one(Address.class, \"valid\"));\n\t}});\n\n\tFixture.of(Address.class).addTemplate(\"valid\", new Rule(){{\n\t\tadd(\"id\", random(Long.class, range(1L, 100L)));\n\t\tadd(\"street\", random(\"Paulista Avenue\", \"Ibirapuera Avenue\"));\n\t\tadd(\"city\", \"São Paulo\");\n\t\tadd(\"state\", \"${city}\");\n\t\tadd(\"country\", \"Brazil\");\n\t\tadd(\"zipCode\", random(\"06608000\", \"17720000\"));\n\t}});\n\nYou can also create a new template based on another existing template. Using this you can override the definition for a property\n\n\tFixture.of(Address.class).addTemplate(\"augustaStreet\").inherits(\"valid\", new Rule(){{\n\t\tadd(\"street\", \"Augusta Street\");\n\t}});\n\nUsing on your tests code:\n\nGimme one object from label \"valid\"\n\n\tClient client = Fixture.from(Client.class).gimme(\"valid\");\n\nGimme N objects from label \"valid\"\n\n\tList\u003cClient\u003e clients = Fixture.from(Client.class).gimme(5, \"valid\");\n\t\nGimme N objects each one from one label\n\n\tList\u003cClient\u003e clients = Fixture.from(Client.class).gimme(2, \"valid\", \"invalid\");\n\nAdditional helper functions to create generic template:\n\n### Managing Templates\n\nTemplates can be written within TemplateLoader interface\n\n\tpublic class ClientTemplateLoader implements TemplateLoader {\n\t    @Override\n\t    public void load() {\n\t        Fixture.of(Client.class).addTemplate(\"valid\", new Rule(){{\n\t            add(\"id\", random(Long.class, range(1L, 200L)));\n\t            add(\"name\", random(\"Anderson Parra\", \"Arthur Hirata\"));\n\t            add(\"nickname\", random(\"nerd\", \"geek\"));\n\t            add(\"email\", \"${nickname}@gmail.com\");\n\t            add(\"birthday\", instant(\"18 years ago\"));\n\t            add(\"address\", one(Address.class, \"valid\"));\n\t        }});\n\n\t        Fixture.of(Address.class).addTemplate(\"valid\", new Rule(){{\n\t            add(\"id\", random(Long.class, range(1L, 100L)));\n\t            add(\"street\", random(\"Paulista Avenue\", \"Ibirapuera Avenue\"));\n\t            add(\"city\", \"São Paulo\");\n\t            add(\"state\", \"${city}\");\n\t            add(\"country\", \"Brazil\");\n\t            add(\"zipCode\", random(\"06608000\", \"17720000\"));\n\t        }});\n\t    }\n\t}\n\nAll templates can be loaded using FixtureFactoryLoader telling what package that contains the templates\n\n\tFixtureFactoryLoader.loadTemplates(\"br.com.six2six.template\");\n\nExample of loading templates with JUnit tests\n\n\t@BeforeClass\n\tpublic static void setUp() {\n\t    FixtureFactoryLoader.loadTemplates(\"br.com.six2six.template\");\n\t}\n\n### Processors\n\nFixture-Factory comes with a simple mechanism to execute custom logic after the generation of each object.\n\nTo do so, implement the Processor interface:\n\n \tpublic class MyCustomProcessor implements Processor {\n   \t\tpublic void execute(Object object) {\n     \t\t//do something with the created object\n   \t\t}\n \t}\n\nAnd use it:\n\n\tFixture.from(SomeClass.class).uses(new MyCustomProcessor()).gimme(\"someTemplate\");\n\nThe #execute method will be called for each object that Fixture-Factory generates. For instance, if a Client has an Address, the framework will generate the Address, call #execute with the generated Address as argument, set the Address into the Client, call #execute with the generated Client as argument and then return it.  \n\nIn case you want to persist the generated object in your database and you are using Hibernate, we already have a `HibernateProcessor` that persists all created objects using the provided session:\n\n\tFixture.from(Client.class).uses(new HibernateProcessor(session)).gimme(\"valid\");\n\n### Relationship (one-to-one and one-to-many)\n\n\tFixture.of(Order.class).addTemplate(\"valid\", new Rule(){{\n\t\tadd(\"id\", random(Long.class, range(1L, 200L)));\n\t\tadd(\"items\", has(3).of(Item.class, \"valid\"));\n\t\t// add(\"items\", has(3).of(Item.class, \"valid\", \"invalid\", \"external\")); this will generate three Item, each one from one of the given templates\n\t\tadd(\"payment\", one(Payment.class, \"valid\"));\n\t}});\n\n\tFixture.of(Item.class).addTemplate(\"valid\", new Rule(){{\n\t\tadd(\"productId\", random(Integer.class, range(1L, 200L)));\n\t}});\n\n\tFixture.of(Payment.class).addTemplate(\"valid\", new Rule(){{\n\t\tadd(\"id\", random(Long.class, range(1L, 200L)));\n\t}});\n\n### Regex\n\n\tFixture.of(Any.class).addTemplate(\"valid\", new Rule(){{\n\t\tadd(\"id\", regex(\"\\\\d{3,5}\"));\n\t\tadd(\"phoneNumber\", regex(\"(\\\\d{2})-(\\\\d{4})-(\\\\d{4})\"));\n\t});\n\n### Date\n\n\tFixture.of(Any.class).addTemplate(\"valid\", new Rule(){{\n\t\tadd(\"dueDate\", beforeDate(\"2011-04-15\", new SimpleDateFormat(\"yyyy-MM-dd\")));\n\t\tadd(\"payDate\", afterDate(\"2011-04-15\", new SimpleDateFormat(\"yyyy-MM-dd\")));\n\t\tadd(\"birthday\", randomDate(\"2011-04-15\", \"2011-11-07\", new SimpleDateFormat(\"yyyy-MM-dd\")));\n\t\tadd(\"cutDate\", instant(\"now\"));\n\t});\n\n### Name\n\n\tFixture.of(Any.class).addTemplate(\"valid\", new Rule(){{\n\t\tadd(\"firstName\", firstName());\n\t\tadd(\"lastName\", lastName());\n\t});\n\n### Unique random\n\t\n\tFixture.of(Any.class).addTemplate(\"valid\", new Rule() {{\n\t\tadd(\"country\", \"Brazil\");\n\t\tadd(\"state\", uniqueRandom(\"São Paulo\", \"Rio de Janeiro\", \"Minas Gerais\", \"Bahia\"));\n\t}});\n\nThe attribute state of this fixture will contain an unique value each time it is generated. \nNote that if this fixture is generated more times than there are available state values, the state values will start to repeat.\n\n### CNPJ\n\n\tFixture.of(User.class).addTemplate(\"valid\", new Rule() {{\n\t\tadd(\"cnpj\", cnpj()); // this will generate an unformatted CNPJ e.g. 11111111111111\n\t\tadd(\"cnpj\", cnpj(true)); this will generate a formatted CNPJ e.g. 11.111.111/1111-11\n\t}});\n\nYou can see more utilization on [tests](https://github.com/six2six/fixture-factory/tree/master/src/test/java/br/com/six2six/fixturefactory)!\n\n## Contributing\n\nWant to contribute with code, documentation or bug report?\n\nDo it by [joining the mailing list](http://groups.google.com/group/fixture-factory) on Google Groups.\n\n## Credits\n\nFixture-Factory was written by:\n\n* [Anderson Parra](https://github.com/aparra)\n* [Arthur Hirata](https://github.com/ahirata)\n* [Douglas Rodrigo](https://github.com/douglasrodrigo)\n\nwith contributions from several authors, including:\n\n* [Nykolas Lima](https://github.com/nykolaslima)\n\n## License\n\nFixture-Factory is released under the Apache 2.0 license. See the LICENSE file included with the distribution for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsix2six%2Ffixture-factory","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsix2six%2Ffixture-factory","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsix2six%2Ffixture-factory/lists"}