{"id":20189264,"url":"https://github.com/robsonbittencourt/utility-generator","last_synced_at":"2025-04-10T07:50:49.927Z","repository":{"id":68552508,"uuid":"53011063","full_name":"robsonbittencourt/utility-generator","owner":"robsonbittencourt","description":"Generate fixtures class to use in your tests","archived":false,"fork":false,"pushed_at":"2017-07-26T01:00:27.000Z","size":145,"stargazers_count":3,"open_issues_count":1,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-24T08:05:50.054Z","etag":null,"topics":["fixture","fixture-generator","generator","java","mapper"],"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/robsonbittencourt.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":"2016-03-03T01:44:17.000Z","updated_at":"2018-03-12T16:53:29.000Z","dependencies_parsed_at":"2023-09-13T13:38:17.639Z","dependency_job_id":null,"html_url":"https://github.com/robsonbittencourt/utility-generator","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robsonbittencourt%2Futility-generator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robsonbittencourt%2Futility-generator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robsonbittencourt%2Futility-generator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robsonbittencourt%2Futility-generator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/robsonbittencourt","download_url":"https://codeload.github.com/robsonbittencourt/utility-generator/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248182019,"owners_count":21060891,"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":["fixture","fixture-generator","generator","java","mapper"],"created_at":"2024-11-14T03:35:29.755Z","updated_at":"2025-04-10T07:50:49.922Z","avatar_url":"https://github.com/robsonbittencourt.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Utility Generator  \n[![Build Status](https://travis-ci.org/robsonbittencourt/utility-generator.svg?branch=master)](https://travis-ci.org/robsonbittencourt/utility-generator) [![Quality Gate](https://sonarcloud.io/api/badges/gate?key=com.github.robsonbittencourt%3Autility-generator)](https://sonarcloud.io/dashboard?id=com.github.robsonbittencourt%3Autility-generator) [![Coverage](https://sonarcloud.io/api/badges/measure?key=com.github.robsonbittencourt%3Autility-generator\u0026metric=coverage)](https://sonarcloud.io/component_measures/metric/coverage/list?id=com.github.robsonbittencourt%3Autility-generator) [![Vulnerabilities](https://sonarcloud.io/api/badges/measure?key=com.github.robsonbittencourt%3Autility-generator\u0026metric=vulnerabilities)](https://sonarcloud.io/project/issues?id=com.github.robsonbittencourt%3Autility-generator\u0026resolved=false\u0026types=VULNERABILITY) [![Bugs](https://sonarcloud.io/api/badges/measure?key=com.github.robsonbittencourt%3Autility-generator\u0026metric=bugs)](https://sonarcloud.io/project/issues?id=com.github.robsonbittencourt%3Autility-generator\u0026resolved=false\u0026types=BUG) [![Code Smells](https://sonarcloud.io/api/badges/measure?key=com.github.robsonbittencourt%3Autility-generator\u0026metric=code_smells)](https://sonarcloud.io/project/issues?id=com.github.robsonbittencourt%3Autility-generator\u0026resolved=false\u0026types=CODE_SMELL)\n\n\u003e Generate utility class to use in your project\n\n## Generate Jar File\n\nTo generate this project as a jar file you need to run a maven command with these parameters:\n- clean compile assembly:single\n\n## Usage\n\n## To use the Fixture class\n- You should instantiate a FixtureConfiguration.\n- The default method prefix is `with` but you can use any word.\n- The default root path is `src/test/java/`, also you can use any path.\n- Instantiate the Fixture and call the generate method\n\n### Example:\n\nPerson:\n```java\npublic class Person {\n  private String name;\n  private int age;\n  //getters and setters\n}\n\n```\n\nYou Generator class:\n```java\nFixtureConfiguration config = new FixtureConfiguration();\nconfig.setMethodPrefix(\"with\");\nconfig.setRootPath(loader.getAbsolutePath() + config.getRootPath());\n\nAbstractGeneratedClass fixture = new Fixture(Person.class, config);\nfixture.generate();\n\n```\n\nOutput:\n```java\npackage com.utility.generator.main;\n\nimport com.utility.generator.main.Person;\nimport java.util.List;\nimport java.util.ArrayList;\n\npublic class PersonFixture {\n\n  private Person person = new Person();\n\n  public static PersonFixture get() {\n\t  return new PersonFixture();\n  }\n\n  public Person build() {\n\t  return person;\n  }\n\n  public List\u003cPerson\u003e buildList(Integer amount) {\n\t  List\u003cPerson\u003e persons = new ArrayList\u003c\u003e();\n\n\t  for (int i = 0; i \u003c amount; i++) {\n\t\t  persons.add(this.build());\n\t  }\n\n\t  return persons;\n  }\n\n  public PersonFixture withName(String name) {\n\t  this.person.setName(name);\n\t  return this;\n  }\n\n  public PersonFixture withAge(int age) {\n\t  this.person.setAge(age);\n\t  return this;\n  }\n\n}\n\n```\n## To use the Mapper Test Generator Method\n- You must specify a `Class Name Suffix`\n- You must specify a `Method Name` that will be used in your test method\n- You must set your `TypeClass` and `EntityClass`, they are required in any mapper.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frobsonbittencourt%2Futility-generator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frobsonbittencourt%2Futility-generator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frobsonbittencourt%2Futility-generator/lists"}