-
Notifications
You must be signed in to change notification settings - Fork 845
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Witcher added * Regexp in unit tests fixed
- Loading branch information
Showing
6 changed files
with
87 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -103,6 +103,7 @@ Fakers | |
* Team | ||
* TwinPeaks | ||
* University | ||
* Witcher | ||
* Yoda | ||
* Zelda | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package com.github.javafaker; | ||
|
||
public class Witcher { | ||
private final Faker faker; | ||
|
||
protected Witcher(Faker faker) { | ||
this.faker = faker; | ||
} | ||
|
||
public String character() { | ||
return faker.fakeValuesService().resolve("witcher.characters", this, faker); | ||
} | ||
|
||
public String witcher() { | ||
return faker.fakeValuesService().resolve("witcher.witchers", this, faker); | ||
} | ||
|
||
public String school() { | ||
return faker.fakeValuesService().resolve("witcher.schools", this, faker); | ||
} | ||
|
||
public String location() { | ||
return faker.fakeValuesService().resolve("witcher.locations", this, faker); | ||
} | ||
|
||
public String quote() { | ||
return faker.fakeValuesService().resolve("witcher.quotes", this, faker); | ||
} | ||
|
||
public String monster() { | ||
return faker.fakeValuesService().resolve("witcher.monsters", this, faker); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package com.github.javafaker; | ||
|
||
import org.junit.Test; | ||
|
||
import static com.github.javafaker.matchers.MatchesRegularExpression.matchesRegularExpression; | ||
import static org.junit.Assert.assertThat; | ||
|
||
public class WitcherTest extends AbstractFakerTest { | ||
|
||
@Test | ||
public void testCharacter() { | ||
assertThat(faker.witcher().character(), matchesRegularExpression("[A-Za-z' -éúï]+")); | ||
} | ||
|
||
@Test | ||
public void testWitcher() { | ||
assertThat(faker.witcher().character(), matchesRegularExpression("[A-Za-z -ë]+")); | ||
} | ||
|
||
@Test | ||
public void testSchool() { | ||
assertThat(faker.witcher().school(), matchesRegularExpression("[A-Za-z]+")); | ||
} | ||
|
||
@Test | ||
public void testLocation() { | ||
assertThat(faker.witcher().location(), matchesRegularExpression("[A-Za-z -áâé]+")); | ||
} | ||
|
||
@Test | ||
public void testQuote() { | ||
assertThat(faker.witcher().quote(), matchesRegularExpression("[A-Za-z0-9 …\\?\\!\\.’',]+")); | ||
} | ||
|
||
@Test | ||
public void testMonster() { | ||
assertThat(faker.witcher().monster(), matchesRegularExpression("[A-Za-z -]+")); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters