Merge pull request #10 from olim7t/github-58

github #58 - add example for Properties.ofType().
This commit is contained in:
Joel Costigliola 2012-07-28 08:44:11 -07:00
commit 8c0e92c538
1 changed files with 5 additions and 0 deletions

View File

@ -125,6 +125,11 @@ public class IterableAssertionsExamples extends AbstractAssertionsExamples {
.doesNotContain("Sauron", "Elrond");
// in Fest 1.x, this would have been written :
// assertThat(fellowshipOfTheRing).onProperty("name").contains("Boromir", "Gandalf", "Frodo", "Legolas");
// same extraction with an alternate syntax
assertThat(extractProperty("name").ofType(String.class).from(fellowshipOfTheRing))
.contains("Boromir", "Gandalf", "Frodo", "Legolas")
.doesNotContain("Sauron", "Elrond");
// extracting property works also with user's types (here Race)
assertThat(extractProperty("race").from(fellowshipOfTheRing)).contains(HOBBIT, ELF).doesNotContain(ORC);