Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Witcher added #251

Merged
merged 3 commits into from
Sep 24, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ Fakers
* Team
* TwinPeaks
* University
* Witcher
* Yoda
* Zelda

Expand Down
6 changes: 6 additions & 0 deletions src/main/java/com/github/javafaker/Faker.java
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ public class Faker {
private final RickAndMorty rickAndMorty;
private final Yoda yoda;
private final Matz matz;
private final Witcher witcher;

public Faker() {
this(Locale.ENGLISH);
Expand Down Expand Up @@ -135,6 +136,7 @@ public Faker(Locale locale, Random random) {
this.rickAndMorty = new RickAndMorty(this);
this.yoda = new Yoda(this);
this.matz = new Matz(this);
this.witcher = new Witcher(this);
}

/**
Expand Down Expand Up @@ -458,6 +460,10 @@ public Matz matz() {
return matz;
}

public Witcher witcher() {
return witcher;
}

public String resolve(String key) {
return this.fakeValuesService.resolve(key, this, this);
}
Expand Down
33 changes: 33 additions & 0 deletions src/main/java/com/github/javafaker/Witcher.java
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);
}
}
7 changes: 7 additions & 0 deletions src/main/resources/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -775,3 +775,10 @@ en:
]
species: ["Algolian Suntiger", "Arcturan MegaDonkey", "Arcturan Megagrasshopper", "Azgoths of Kria", "Babel Fish", "Belcerebon", "Boghog", "Cow", "Damogran Frond Crested Eagle", "Dentrassis", "Dolphins", "Flaybooz", "Golgafrinchan", "Grebulon", "Grebulons", "Hingefreel", "Hooloovoo", "Human", "Jatravartid", "Mattress", "Mice", "Mouse", "Nanites", "Perfectly Normal Beast", "Ravenous Bugblatter Beast of Traal", "Sarkopsi", "Shaltanac", "Silastic Armorfiends", "Silver Tongued Devils", "Vl'Hurg", "Vogon"]
starships: ["Billion Year Bunker", "Bistromath", "Golgafrinchan Ark Fleet Ship B", "Heart of Gold", "Krikkit One", "RW6", "Starship Titanic", "Tanngrisnir", "Vogon Constructor Fleet"]
witcher:
characters: ["Triss Merigold", "Shani", "Philippa Eilhart", "Dandelion", "King Radovid", "King Foltest", "King Henselt", "King Demavend","Zoltan Chivay","Thaler","Ciri","Yennefer of Vengerberg","Keira Metz","Anna Strenger","Birna Bran","Jenge Frett","Uma","Vernon Roche","Ves","Donar an Hindar","Dudu Biberveldt","Emhyr van Emreis","Emiel Regis Rohellec Terzieff-Godefroy","Eredin","Caranthir","Imlerith","Nithral","Olgierd von Everec","Skjall","Sigismund Dijkstra","Avallac'h","Pavetta","Whoreson Junior","The Bloody Baron","Johnny","Gaunter O'Dimm","Vilgefortz","Iorveth","Fringilla Vigo","Morvran Voorhis","Crach an Craite","Jan Calveit","Francesca Findabair","Carthia van Canten","Sabrina Glevissig","Calanthe","Roach","Ermion","Priscilla","Margarita Laux-Antille","Milva","Maria Louisa La Valette","Stefan Skellen","Assire var Anahid","Mousesack","Hjalmar an Craite","Yarpen Zigrin","Dethmold","Eithné","Isengrim","Yaevinn","Nenneke","Jan Natalis","Bran an Tuirseach","Menno Coehoorn","Schirrú","Milton de Peyrac-Peyran","Vattier de Rideaux","Palmerin de Launfal","Tibor Eggebracht","Esterad Thyssen","Joachim de Wett","Brouver Hoog","Aglaïs","Xarthisius","Aelirenn","Adam Pangratt","Sweers","Sheldon Skaggs","Carduin","Albrich","Zyvik","Saskia","Sigrdrifa","Addario Bach"]
witchers: ["Geralt of Rivia", "Coën", "Vesemir", "Eskel", "Lambert", "Letho of Gulet","Ciri","George of Kagen","Jerome Moreau","Auckes","Serrit","Kolgrim","Ivar Evil-Eye","Junod of Belhaven","Gerd"]
schools: ["Wolf", "Griffin", "Cat", "Viper", "Manticore", "Bear"]
locations: ["Aedd Gynvael","Aldersberg","Beauclair","Cidaris","Cintra","Gors Velen","Maribor","Novigrad","Oxenfurt","Tretogor","Vengerberg","Vizima","Ard Carraigh","Bremervoord","Brugge","Claremont","Creyden","Fen Aspra","Hengfors","Lan Exeter","Pont Vanis","Lyria","Maecht","Malleore","Metinna","Nilfgaard","Neunreuth","Rakverelin","Rivia","Thurn","Acorn Bay","Anchor","Assengard","Attre","Ban Ard","Ban Gleán","Barefield","Belhaven","Blaviken","Brenna","Breza","Burdorff","Caelf","Carreras","Craag An","Crinfrid","Daevon","Dillingen","Dorian","Druigh","Dudno","Duén Canell","Dun Dâre","Ellander","Eysenlaan","Fano","Foam","Forgeham","Fox Hollow","Ghelibol","Glyswen","Gulet","Hochebuz","Jealousy","Kaczan","Kagen","Kerack","Kernow","Klucz","Knotweed Meadow","Little Marsh","Lower Posada","Malhoun","Mirt","Murivel","New Ironworks","Porog","Riedbrune","Rinde","Roggeveen","Tegamo","Tigg","Tridam","Tyffi","Unicorn","Upper Posada","Vattweir","Vole","White Bridge","Zavada","Armeria","Baldhorn","Ban Gleán","Beauclair","Bodrog","Carcano","Castel Ravello","Darn Dyffra","Darn Rowan","Darn Ruach","Dillingen","Dorndal","Drakenborg","Fen Aspra","Glevitzingen","Gwendeith","Hagge","Houtborg","Kaer Morhen","Kaer Trolde","Leyda","Loc Grim","Mayena","Mirt","Montecalvo","Montsalvat","Nastrog","Razwan","Red Binduga","Rocayne","Rhys-Rhun","Riedbrune","Rozrog","Sarda","Scala","Schwemmland","Spalla","Stygga","Tigg","Vartburg","Vedette","Vidort","Winneburg","Zurbarran","Est Haemlet","Loc Muinne","Shaerrawedd"]
quotes: ["Just five more minutes… Is it 1358 yet? No? Then fuck off!","Finish all your business before you die. Bid loved ones farewell. Write your will. Apologize to those you’ve wronged. Otherwise, you’ll never truly leave this world.","Hide the wenches, Witcher's coming!!","Oh year... the Elder Blood can be fiery","Damn, Eskel... you got an hourglass figure","No Lollygagin'!","You get what you get and be happy with it","I'll stick me boot so far up yer arse your tongue'll taste like wench twat"]
monsters: ["Archespore","Berserker","Botchling","Lubberkin","Ulfhedinn","Werewolf","The Toad Prince","Basilisk","Cockatrice","Forktail","Royal Wyvern","Shrieker","Silver Basilisk","Slyzard Matriarch","Slyzard","Dragon of Fyresdal","Wyvern","Djinn","Earth Elemental","Fire Elemental","Gargoyle","Golem","Hound of the Wild Hunt","Ice Elemental","Pixie","Apiarian Phantom","Therazane","Ekhidnae","Erynias","Griffin","Harpy","Melusine","Opinicus","Salma","Siren","Succubus","Arachas","Arachnomorph","Endrega Drone","Endrega Warrior","Endrega Worker","Giant Centipede","Kikimore","Kikimore Worker","Pale Widow","Abaya","Alghoul","Drowner","Foglet","Ghoul","Grave Hag","Ignis Fatuus","Mourntart","Mucknixer","Rotfiend","Scurver","Spotted Wight","Water Hag","Wight","Cloud Giant","Cyclopse","Golyat","Hagubman","Ice Giant","Ice Troll","Nekker","Rock Troll","Wham-a-Wham","Chort","Crone","Doppler","Fiend","Fugas","Godling","Grottore","Howler","Imp","Kernun","Leshen","Morvudd","Shaelmaar","Spriggan","Sylvan","The Caretaker","Barghests","Ethereal","Hym","Longlocks","Nightwraith","Noonwraith","Penitent","Plague Maiden","Umbra","Wraith","Alp","Bruxa","Ekimmara","Gael","Garkain","Higher Vampire","Katakan"]
39 changes: 39 additions & 0 deletions src/test/java/com/github/javafaker/WitcherTest.java
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 -]+"));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ public void testAllFakerMethodsThatReturnStrings() throws Exception {
testAllMethodsThatReturnStringsActuallyReturnStrings(faker.rickAndMorty());
testAllMethodsThatReturnStringsActuallyReturnStrings(faker.yoda());
testAllMethodsThatReturnStringsActuallyReturnStrings(faker.matz());
testAllMethodsThatReturnStringsActuallyReturnStrings(faker.witcher());
}

private void testAllMethodsThatReturnStringsActuallyReturnStrings(Object object) throws Exception {
Expand Down