Podam is a tool to help developers with their unit tests by auto-filling Plain Old Java Objects (POJOs) with dummy data. It offers a one liner to achieve this goal:
Pojo myPojo = PodamFactory.manufacturePojo(Pojo.class);
Alternatively, if you want to define your own Strategy to assign values (see below), you can use the following version:
DataProviderStrategy strategy = new MyDataProviderStrategy(); Pojo myPojo = PodamFactory.manufacturePojo(Pojo.class, strategy);
That's it!
By default PODAM assigns random values to all its types. However, PODAM can be extended by providing a custom implementation of the uk.co.jemos.podam.api.DataProviderStrategy interface. Please note that methods which return a numeric value between ranges should consider the ranges inclusive, as documented in the interface Javadoc.
PODAM uses the uk.co.jemos.podam.api.RandomDataProviderStrategy class as default Data Provider implementation.
To know more about how PODAM works, please refer to the The walk-through example page or to the Corner Cases page on the left menu.
Using PODAM is easy. You can either download the source and build it yourself or you declare PODAM as a Maven dependency.
The following pre-requisites must be satisfied in order to build PODAM:
Once the pre-requisites have been satisfied, extract the source jar to a folder of your choice. Then, to build PODAM simply execute the following command:
# To build PODAM jar and execute the tests mvn clean install # To build this documentation mvn clean site:site # To build javadocs mvn clean javadoc:jar
To use Podam from within your Maven project, declare the following dependency:
<dependency> <groupId>uk.co.jemos.podam</groupId> <artifactId>podam</artifactId> <version>0.0.1-RC3</version> <!-- <scope>test</scope> --> </dependency>