{"id":37029784,"url":"https://github.com/ignaciotcrespo/mrpolite","last_synced_at":"2026-01-14T03:35:45.055Z","repository":{"id":57720222,"uuid":"83149901","full_name":"ignaciotcrespo/MrPolite","owner":"ignaciotcrespo","description":"Mr Polite will create or change any java object for you, if you kindly ask for it :)","archived":false,"fork":false,"pushed_at":"2017-05-30T20:21:37.000Z","size":311,"stargazers_count":2,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2023-08-19T09:22:07.905Z","etag":null,"topics":["android","java","javabeans","mock","random","testing"],"latest_commit_sha":null,"homepage":"","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/ignaciotcrespo.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}},"created_at":"2017-02-25T17:40:50.000Z","updated_at":"2017-03-23T15:25:10.000Z","dependencies_parsed_at":"2022-09-26T21:41:19.900Z","dependency_job_id":null,"html_url":"https://github.com/ignaciotcrespo/MrPolite","commit_stats":null,"previous_names":[],"tags_count":1,"template":null,"template_full_name":null,"purl":"pkg:github/ignaciotcrespo/MrPolite","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ignaciotcrespo%2FMrPolite","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ignaciotcrespo%2FMrPolite/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ignaciotcrespo%2FMrPolite/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ignaciotcrespo%2FMrPolite/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ignaciotcrespo","download_url":"https://codeload.github.com/ignaciotcrespo/MrPolite/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ignaciotcrespo%2FMrPolite/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28408844,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T01:52:23.358Z","status":"online","status_checked_at":"2026-01-14T02:00:06.678Z","response_time":107,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["android","java","javabeans","mock","random","testing"],"created_at":"2026-01-14T03:35:44.296Z","updated_at":"2026-01-14T03:35:45.046Z","avatar_url":"https://github.com/ignaciotcrespo.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"![Mr Polite Logo](https://raw.githubusercontent.com/ignaciotcrespo/MrPolite/master/designs/mrpolite.jpg)\n\n\n![build status](https://img.shields.io/badge/build-info-yellow.svg) [![Build Status](https://travis-ci.org/ignaciotcrespo/MrPolite.svg?branch=master)](https://travis-ci.org/ignaciotcrespo/MrPolite) [![codecov.io](http://codecov.io/github/ignaciotcrespo/MrPolite/coverage.svg?branch=master)](http://codecov.io/github/ignaciotcrespo/MrPolite?branch=master) [![MIT License](http://img.shields.io/badge/license-MIT-green.svg) ](https://github.com/ignaciotcrespo/MrPolite/blob/master/LICENSE)\n\n# Mr Polite\nMr Polite will give you anything you need, if you kindly ask for it.\n\nLet's say you have a class `Animal` and you want to generate an instance of it:\n```java\nAnimal animal = MrPolite.one(Animal.class).please();\n```\nMr Polite will create the `Animal` for you and populate with random data. He is so good with you. Very important, you need to be gentle with Mr Polite, remember to say please at the end.\n \n Ok, what if you need many animals? Let's see another example:\n ```java\nList\u003cAnimal\u003e animals = MrPolite.aListOf(15, Animal.class).please();\n```\n\nMr Polite will create 15 animals for you. Nice, but sometimes you already have the instance and just want to change some fields. Let's take a look:\n```java\nMrPolite.change(animal)\n   .withFieldEqualTo(\"type\", \"cat\")\n   .please();\n```\n\nNotice you must say which field needs to be changed using `withFieldEqualTo(\"type\", \"cat\")`. MrPolite will not change anything in the object unless you specify what needs to be changed. He doesn't want to be rude and change everything without being asked for it.\n\n# Polite desires\n\nMr Polite can do much more than just populating random data. You can express to him your desires, and you will be pleased.\n```java\nMrPolite.one(Animal.class)\n   .withDepth(1)\n   .withFieldEqualTo(\"type\", \"cat\")\n   .withClassEqualTo(Integer.class, 25)\n   .withCollectionSizeRange(3, 10)\n   .withGenerics(Long.class)\n   .withFieldImageLink(\"\\\\w*[iI]mage\\\\w*\", 200, 300)\n   .withFieldNamesInStrings()\n   .withNumberRange(1000, 2000)\n   .withStringsMaxLength(10)\n   .overrideValues(true)\n   .overrideFinals()\n   .exclude(\".+Uri.+\")\n   .exclude(String.class)\n   .withDataGenerator(...) //1.0.7.2-SNAPSHOT\n   .please();\n```\n\nFor more details about these parameters, please refer to the [wiki](https://github.com/ignaciotcrespo/MrPolite/wiki) section.\n\n# Interfaces\nMr. Polite kindly checks for the most common interfaces like `List`, `Set`, `Map` and create `ArrayList`, `HashSet`, `HashMap`,\nfor other interfaces a proxy is created returning random objects on each method.\n\n# Current Version\n* The current stable version is `1.0.6`\n* The current snapshot version is `1.0.7.2-SNAPSHOT`\n\n# Android support\nMrPolite works fine in android, it is compiled with JDK 1.6 and tested on real projects.\n\n# Kotlin\nThe variables declared with `val` are generated ok, for constants declared with `val` force to overwrite everything using\n```java\n        Animal animal = one(Animal.class)\n                .overrideValues(true)\n                .overrideFinals()\n                .please();\n\n```\n\n# Adding Mr Polite to your project\nUsing gradle: \n```properties\ncompile 'com.github.ignaciotcrespo:mrpolite:1.0.6'\n```\n\n# Contribution\nMr Polite is a work in progress, it is stable but of course there are still some edge cases not covered.\n\nYou are welcome to contribute to the project, feel free to create a pull request with your changes.\n\nFor questions, suggestions or feedback, create an issue in this repository.\n\n# License\n\nMr Polite is released under the [![MIT license](http://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat)](http://opensource.org/licenses/MIT).\n\n```\nThe MIT License\n\nCopyright (c) 2017, Ignacio Tomas Crespo (itcrespo@gmail.com)\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fignaciotcrespo%2Fmrpolite","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fignaciotcrespo%2Fmrpolite","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fignaciotcrespo%2Fmrpolite/lists"}