Giter Site home page Giter Site logo

test-beangen's Introduction

test-beangen

Supports unit testing by dynamically creating bean objects and populating their fields to default values.

Maven Repository: http://mvnrepository.com/artifact/com.gregmarut.support/test-beangen

##Getting Started The easiest way to use the framework is to create a new BeanPropertyGenerator object and call the .get() method while passing in the class that you would like to be fully populated. The bean generator will then attempt to instantiate the class and traverse the entire object graph and recursively initialize all of the fields. It will then return an object with all of its fields initialized according to the default values or Rules (if any have been specified)

Example: BeanPropertyGenerator beanPropertyGenerator = new BeanPropertyGenerator(); SomeObject someObject = beanPropertyGenerator.get(SomeObject.class);

##Default Values By default, com.gregmarut.support.beangenerator.DefaultValues simply contains a Map of Class and Object which allows the framework to know what the default values should be considering the object type. If the map contains an object for a class, whenever that class is found, it is used instead of attempting to recursively initialize the object.

##Configuration BeanPropertyGenerator has a Properties object which stores the instructions for how fields are populated. These can be completely customized by either changing or setting new default values for a class, map concrete classes to interfaces, or set Rule objects that allow for unique values to be set based on attributes of the field name and type.

##Examples See the unit tests for more examples on how to use and configure the BeanPropertyGenerator to help automate your unit testing needs.

test-beangen's People

Contributors

gregmarut avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.