Skip to content

Commit

Permalink
adding documentation about multiple templates support. closes #68
Browse files Browse the repository at this point in the history
  • Loading branch information
nykolaslima committed Jan 28, 2015
1 parent ac364fd commit 1c6b90f
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ Gimme one object from label "valid"
Gimme N objects from label "valid"

List<Client> clients = Fixture.from(Client.class).gimme(5, "valid");

Gimme N objects each one from one label

List<Client> clients = Fixture.from(Client.class).gimme(2, "valid", "invalid");

Additional helper functions to create generic template:

Expand Down Expand Up @@ -119,6 +123,7 @@ In case you want to persist the generated object in your database and you are us
Fixture.of(Order.class).addTemplate("valid", new Rule(){{
add("id", random(Long.class, range(1L, 200L)));
add("items", has(3).of(Item.class, "valid"));
// add("items", has(3).of(Item.class, "valid", "invalid", "external")); this will generate three Item, each one from one of the given templates
add("payment", one(Payment.class, "valid"));
}});

Expand Down

0 comments on commit 1c6b90f

Please sign in to comment.