Skip to content

Commit

Permalink
Merge pull request #421 from ubulem/master
Browse files Browse the repository at this point in the history
Add methods for missing Harry Potter entries
  • Loading branch information
codingricky committed Aug 20, 2019
2 parents 5f357f7 + e481bde commit 33f96e1
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/main/java/com/github/javafaker/HarryPotter.java
Expand Up @@ -22,4 +22,12 @@ public String quote() {
public String book() {
return faker.resolve("harry_potter.books");
}

public String house() {
return faker.resolve("harry_potter.houses");
}

public String spell() {
return faker.resolve("harry_potter.spells");
}
}
10 changes: 10 additions & 0 deletions src/test/java/com/github/javafaker/HarryPotterTest.java
Expand Up @@ -28,4 +28,14 @@ public void quote() {
public void book() {
assertThat(faker.harryPotter().book(), matchesRegularExpression("Harry Potter and the ([A-Za-z'\\-]+ ?)+"));
}

@Test
public void house() {
assertThat(faker.harryPotter().house(), matchesRegularExpression("[A-Za-z ]+"));
}

@Test
public void spell() {
assertThat(faker.harryPotter().spell(), matchesRegularExpression("[A-Za-z ]+"));
}
}

0 comments on commit 33f96e1

Please sign in to comment.