{"id":20652541,"url":"https://github.com/bradleywood/mockdata","last_synced_at":"2026-06-06T15:02:25.047Z","repository":{"id":107253397,"uuid":"128128003","full_name":"BradleyWood/MockData","owner":"BradleyWood","description":"Test data generation","archived":false,"fork":false,"pushed_at":"2018-08-12T11:49:52.000Z","size":842,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-02T12:52:00.101Z","etag":null,"topics":["test-data","test-data-generator","testing","testing-tools"],"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/BradleyWood.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":"2018-04-04T22:10:14.000Z","updated_at":"2018-08-12T11:49:53.000Z","dependencies_parsed_at":null,"dependency_job_id":"4ed57414-0c69-43a6-9d91-9ea861142215","html_url":"https://github.com/BradleyWood/MockData","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/BradleyWood%2FMockData","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BradleyWood%2FMockData/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BradleyWood%2FMockData/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BradleyWood%2FMockData/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/BradleyWood","download_url":"https://codeload.github.com/BradleyWood/MockData/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242752499,"owners_count":20179513,"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":["test-data","test-data-generator","testing","testing-tools"],"created_at":"2024-11-16T17:35:30.772Z","updated_at":"2025-03-09T21:20:49.994Z","avatar_url":"https://github.com/BradleyWood.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# MockData\n\n## What is this?\n\nThis is a project designed to generate realistic mock data for\ntesting purposes. Very few things are supported at the moment.\nHowever, we can generate bounded numbers, names, arrays, row numbers,\netc.\n\n## Goals\n\n- Data dependencies between fields of the same row\n\n- Data generation based on statistical distributions\n\n- Invalid test data\n\n\n## Data Dependencies\n\nSometimes it is useful for data fields to depend on other fields. For example,\nif we are generating a number of user accounts to populate a database, you might\nwant correlation between a person's name and gender or other such fields.\nThis can be accomplished by using the \u003cfont color=\"red\"\u003e@DependentField\u003c/font\u003e annotation.\nThe annotation has the class parameter which tells the record engine the type of data\nfield that this field is dependent on. The value of the field is set prior to execution\nof the data field's generate() method.\n\n```java\npublic class FirstNameField extends DataField\u003cString\u003e {\n    \n    @DependentField(dependentOn = GenderField.class)\n    private Gender gender;\n    \n    ...\n    ...\n}\n```\n\nIn this example if the record has a GenderField we can generate first names based\non the gender that was generated by the GenderField. If not, the field is set to null\nand we could generate any first name.\n\n## Cyclic Data Dependencies\n\nA cyclic data dependency may occur when two data fields both depend on each other.\nThis type of problem does not cause a deadlock, instead the first field in the record\nis generated independently of its dependent field.\n\n\n## Project Layout\n\n- [mockdata-gen](mockdata-gen/src/main/java/org/mockdata) - Api to generate mock data\n\n- [mockdata-api](mockdata-api/src/main/java/org/mockdata/api) - Restful api to request mock data\n\n\n## Examples\n\n#### Junit Parameterized Test example\n\n```java\n@Parameterized.Parameters\npublic static Collection parameters() {\n    final RecordEngine re = new RecordEngine(new RowNumberField(), new FirstNameField(), new LastNameField(),\n            new EmailField(), new IntField(18, 65));\n\n    return re.generate(10);\n}\n```\n\n#### Generate streamable records\n\n```java\n@Parameterized.Parameters(name = \"Selector Test\")\npublic static Collection parameters() {\n    final IntField intField = new IntField(1, 100);\n    final ArrayField af = new ArrayField(new IntField(), intField.generate());\n    final RecordEngine re = new RecordEngine(af);\n\n    // generate 100 random sets of varying length containing random integers\n\n    return re.stream().limit(100).peek(a -\u003e af.setSize(intField.generate()))\n            .map(Record::getValues).collect(Collectors.toList());\n}\n```\n\n## Testing\n\n```\ncurl --header \"Content-Type: application/json\" \\\n--request POST \\\n--data \"{\n  \"num_records\": 5,\n  \"format\": \"json\", // json or csv\n  \"field_config\": [ // array of objects defining each field\n    {\n      \"type\": \"row_number\"\n    },\n    {\n      \"type\": \"first_name\"\n    },\n    {\n      \"type\": \"integer\",\n      \"parameters\": { // specify parameters for the integer field\n      \"min\": 18,\n      \"max\": 65\n      }\n    }\n  ]\n}\" \\\nhttp://localhost:8000/datarequest\n```\n\nResponse:\n\n```json\n[\n  [0, \"Britt\", 18],\n  [1, \"Joan\", 48],\n  [2, \"Lee\", 62],\n  [3, \"Morton\", 26],\n  [4, \"Jacqueline\", 43]\n]\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbradleywood%2Fmockdata","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbradleywood%2Fmockdata","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbradleywood%2Fmockdata/lists"}