add Pokemon (#166)
This commit is contained in:
committed by
Ricky Yim
parent
5ee72af8aa
commit
69ad288f3a
@@ -94,6 +94,7 @@ Fakers
|
||||
* Number
|
||||
* Options
|
||||
* PhoneNumber
|
||||
* Pokemon
|
||||
* Shakespeare
|
||||
* Space
|
||||
* Superhero
|
||||
|
||||
@@ -23,6 +23,7 @@ public class Faker {
|
||||
private final Number number;
|
||||
private final Internet internet;
|
||||
private final PhoneNumber phoneNumber;
|
||||
private final Pokemon pokemon;
|
||||
private final Address address;
|
||||
private final Business business;
|
||||
private final Book book;
|
||||
@@ -73,6 +74,7 @@ public class Faker {
|
||||
this.number = new Number(this);
|
||||
this.internet = new Internet(this);
|
||||
this.phoneNumber = new PhoneNumber(this);
|
||||
this.pokemon = new Pokemon(this);
|
||||
this.address = new Address(this);
|
||||
this.book = new Book(this);
|
||||
this.business = new Business(this);
|
||||
@@ -202,6 +204,10 @@ public class Faker {
|
||||
return phoneNumber;
|
||||
}
|
||||
|
||||
public Pokemon pokemon() {
|
||||
return pokemon;
|
||||
}
|
||||
|
||||
public Lorem lorem() {
|
||||
return lorem;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.github.javafaker;
|
||||
|
||||
public class Pokemon {
|
||||
|
||||
private final Faker faker;
|
||||
|
||||
Pokemon(Faker faker) {
|
||||
this.faker = faker;
|
||||
}
|
||||
|
||||
public String name() {
|
||||
return faker.resolve("pokemon.names");
|
||||
}
|
||||
|
||||
public String location() {
|
||||
return faker.resolve("pokemon.locations");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.github.javafaker;
|
||||
|
||||
import static com.github.javafaker.matchers.MatchesRegularExpression.matchesRegularExpression;
|
||||
import static org.junit.Assert.assertThat;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
public class PokemonTest extends AbstractFakerTest {
|
||||
|
||||
@Test
|
||||
public void name() {
|
||||
assertThat(faker.pokemon().name(), matchesRegularExpression("[\\w']+.?"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void location() {
|
||||
assertThat(faker.pokemon().location(), matchesRegularExpression("\\w+( \\w+)?( \\w+)?"));
|
||||
}
|
||||
}
|
||||
@@ -105,6 +105,7 @@ public class FakerIT {
|
||||
testAllMethodsThatReturnStringsActuallyReturnStrings(faker.internet());
|
||||
testAllMethodsThatReturnStringsActuallyReturnStrings(faker.lorem());
|
||||
testAllMethodsThatReturnStringsActuallyReturnStrings(faker.phoneNumber());
|
||||
testAllMethodsThatReturnStringsActuallyReturnStrings(faker.pokemon());
|
||||
testAllMethodsThatReturnStringsActuallyReturnStrings(faker.music());
|
||||
testAllMethodsThatReturnStringsActuallyReturnStrings(faker.name());
|
||||
testAllMethodsThatReturnStringsActuallyReturnStrings(faker.file());
|
||||
|
||||
Reference in New Issue
Block a user