{"id":27106315,"url":"https://github.com/mikybars/junit5-randomizer-extension","last_synced_at":"2025-04-06T19:39:54.664Z","repository":{"id":120006663,"uuid":"421572930","full_name":"mikybars/junit5-randomizer-extension","owner":"mikybars","description":"Populate test objects with random content via annotations","archived":false,"fork":false,"pushed_at":"2021-10-26T21:19:38.000Z","size":136,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-02T04:58:06.332Z","etag":null,"topics":["easy-random","junit5","object-mother"],"latest_commit_sha":null,"homepage":"https://mperezi.github.io/junit5-randomizer-extension/allclasses-index.html","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mikybars.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2021-10-26T20:22:24.000Z","updated_at":"2023-07-25T14:50:56.000Z","dependencies_parsed_at":"2023-06-14T16:45:32.509Z","dependency_job_id":null,"html_url":"https://github.com/mikybars/junit5-randomizer-extension","commit_stats":null,"previous_names":["mikybars/junit5-randomizer-extension"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mikybars%2Fjunit5-randomizer-extension","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mikybars%2Fjunit5-randomizer-extension/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mikybars%2Fjunit5-randomizer-extension/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mikybars%2Fjunit5-randomizer-extension/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mikybars","download_url":"https://codeload.github.com/mikybars/junit5-randomizer-extension/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247543138,"owners_count":20955860,"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":["easy-random","junit5","object-mother"],"created_at":"2025-04-06T19:39:49.008Z","updated_at":"2025-04-06T19:39:54.652Z","avatar_url":"https://github.com/mikybars.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# junit5-randomizer-extension\n\n\u003e The randomizer extension for JUnit5 is just a convenient wrapper around [easy-random](https://github.com/j-easy/easy-random), a sort of dumb [ObjectMother](https://martinfowler.com/bliki/ObjectMother.html) for the JVM.\n\n## Basic usage\n\n### Single entities\n\n```java\n@ExtendWith(RandomizerExtension.class)\nclass CreateOrderUseCaseImplTest {\n  \n  @Random\n  private MyObject randomField;\n  \n  //...\n\n  @Test\n  void shouldNotCreateOrder_WhenOrderTypeIsMissing(@Random Order newOrder) {\n\t\t// given\n    newOrder.setType(null);\n\n    // when\n    createOrderUseCase.execute(newOrder);\n    \n    // then\n    verify(orderRepository, never()).save(any());\n  }\n}\n```\n\n### Collections\n\n```java\n@Test\nvoid givenItemListTooLong_thenReturnBadRequest(\n  @Random(type=ItemDto.class, size=30) List\u003cItemDto\u003e manyItems) {\n  //...\n}\n```\n\n## Advanced usage\n\n### Custom mappings\n\n```java\n@ExtendWith(RandomizerExtension.class)\nclass EntityApiControllerUpdateItemsTest implements CustomRandomFieldProvider {\n\n  @Override\n  public void registerCustomRandomizers(CustomRandomizerRegistry registry) {\n    registry.registerRandomizer(\n      StringField.named(\"state\"),\n      StringRandomizerFactory.ofEnum(SubmissionState.class));\n  }\n}\n```\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmikybars%2Fjunit5-randomizer-extension","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmikybars%2Fjunit5-randomizer-extension","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmikybars%2Fjunit5-randomizer-extension/lists"}