Skip to content

Commit

Permalink
Add methods for missing Harry Potter entries
Browse files Browse the repository at this point in the history
  • Loading branch information
ubulem committed Aug 20, 2019
1 parent 5f357f7 commit e481bde
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 e481bde

Please sign in to comment.