From 6d4510cf9441125bac52878f31d7b63002e93406 Mon Sep 17 00:00:00 2001 From: SickDawn <68135258+SickDawn@users.noreply.github.com> Date: Sat, 28 May 2022 21:24:13 +0800 Subject: [PATCH 1/5] Add files via upload --- src/main/resources/en/darkSoul.yml | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 src/main/resources/en/darkSoul.yml diff --git a/src/main/resources/en/darkSoul.yml b/src/main/resources/en/darkSoul.yml new file mode 100644 index 00000000..2e21b0f9 --- /dev/null +++ b/src/main/resources/en/darkSoul.yml @@ -0,0 +1,8 @@ +en: + faker: + darkSoul: + stats: ["Vitality","Attunement","Endurance","Strength","Dexterity","Resistance","Intelligence","Faith","Humanity","Soul Level"] + covenants: ["Blade of the Darkmoon","Chaos Servant","Darkwraith","Forest Hunter","Gravelord Servant","Path of the Dragon","Princess's Guard","Warrior of Sunlight","Way of White"] + classes: ["Warrior","Knight","Wanderer","Thief","Bandit","Hunter","Sorcerer","Pyromancer","Cleric","Deprived"] + weapon: ["Fist","Caestus","Claw","Dark Hand","Dragon Bone Fist","Hammers","Blacksmith Giant Hammer","Blacksmith Hammer","Hammer of Vamos","Club","Mace","Morning Star","Pickaxe","Reinforced Club","Warpick","Great Hammers","Demon's Great Hammer","Dragon Tooth","Grant","Great Club","Large Club","Smough's Hammer","Axes","Battle Axe","Butcher Knife","Crescent Axe","Gargoyle Tail Axe","Golem Axe","Hand Axe","Greataxes","Black Knight Greataxe","Demon's Greataxe","Dragon King Greataxe","Greataxe","Stone Greataxe","Daggers","Bandit's Knife","Dagger","Dark Silver Tracer","Ghost Blade","Parrying Dagger","Priscilla's Dagger","Thrusting Swords","Estoc","Mail Breaker","Rapier","Ricard's Rapier","Velka's Rapier","Straight Swords","Astora's Straight Sword","Balder Side Sword","Barbed Straight Sword","Broadsword","Broken Straight Sword","Crystal Straight Sword","Dark Sword","Drake Sword","Longsword","Shortsword","Silver Knight Straight Sword","Straight Sword Hilt","Sunlight Straight Sword","Greatswords","Abyss Greatsword","Bastard Sword","Black Knight Sword","Claymore","Crystal Greatsword","Flamberge","Great Lord Greatsword","Greatsword of Artorias","Greatsword of Artorias (Cursed)","Man Serpent Greatsword","Moonlight Greatsword","Obsidian Greatsword","Stone Greatsword","Ultra Greatswords","Black Knight Greatsword","Demon Great Machete","Dragon Greatsword","Greatsword","Zweihander","Katanas","Chaos Blade","Iaito","Uchigatana","Washing Pole","Curved Swords","Falchion","Gold Tracer","Jagged Ghost Blade","Painting Guardian Sword","Quelaag's Fury Sword","Scimitar","Shotel","Curved Greatswords","Gravelord Sword","Murakumo","Server","Spears","Channeler's Trident","Demon's Spear","Dragonslayer Spear","Four-Pronged Plow","Moonlight Butterfly Horn","Partizan","Pike","Silver Knight Spear","Spear","Winged Spear","Halberds","Black Knight Halberd","Gargoyle's Halberd","Giant's Halberd","Great Scythe","Halberd","Lifehunt Scythe","Lucerne","Scythe","Titanite Catch Pole","Bows","Black Bow of Pharis","Composite Bow","Darkmoon Bow","Long Bow","Short Bow","Crossbows","Avelyn","Heavy Crossbow","Light Crossbow","Sniper Crossbow","Greatbows","Dragonslayer Greatbow","Gough's Greatbow","Whips","Guardian Tail","Notched Whip","Whip"] + shield: ["Small Shields (able to parry)","Buckler","Caduceus Round Shield","Cracked Round Shield","Effigy Shield","Leather Shield","Plank Shield","Red and White Round Shield","Small Leather Shield","Target Shield","Warrior's Round Shield","Normal Shields (able to parry)","Balder Shield","Black Knight Shield","Bloodshield","Caduceus Kite Shield","Crest Shield","Dragon Crest Shield","East-West Shield","Gargoyle's Shield","Grass Crest Shield","Heater Shield","Hollow Soldier Shield","Iron Round Shield","Knight Shield","Large Leather Shield","Sanctus","Silver Knight Shield","Spider Shield","Sunlight Shield","Tower Kite Shield","Wooden Shield","Large Shields (able to bash)","Black Iron Greatshield","Bonewheel Shield","Cleansing Greatshield","Eagle Shield","Giant Shield","Greatshield of Artorias","Havel's Greatshield","Stone Greatshield","Tower Shield","Unique Shields","Crystal Ring Shield","Crystal Shield","Spiked Shield","Pierce Shield","Other","Dark Hand","Skull Lantern"] \ No newline at end of file From 66abe68c3b815f12a9c579e320e290e740b6e68e Mon Sep 17 00:00:00 2001 From: SickDawn <68135258+SickDawn@users.noreply.github.com> Date: Sat, 28 May 2022 21:24:52 +0800 Subject: [PATCH 2/5] Add files via upload --- .../java/com/github/javafaker/DarkSoul.java | 34 +++++++++++++++++++ src/main/java/com/github/javafaker/Faker.java | 4 +++ 2 files changed, 38 insertions(+) create mode 100644 src/main/java/com/github/javafaker/DarkSoul.java diff --git a/src/main/java/com/github/javafaker/DarkSoul.java b/src/main/java/com/github/javafaker/DarkSoul.java new file mode 100644 index 00000000..21ad0dbf --- /dev/null +++ b/src/main/java/com/github/javafaker/DarkSoul.java @@ -0,0 +1,34 @@ +package com.github.javafaker; + +/** + * Add DarkSoul element in the project. + * Issue link: https://github.com/DiUS/java-faker/issues/722 + * @author SickDawn + */ +public class DarkSoul { + private final Faker faker; + + public DarkSoul(final Faker faker) { + this.faker = faker; + } + + public String stats(){ + return faker.resolve("darkSoul.stats"); + } + + public String covenants(){ + return faker.resolve("darkSoul.covenants"); + } + + public String classes(){ + return faker.resolve("darkSoul.classes"); + } + + public String weapon(){ + return faker.resolve("darkSoul.weapon"); + } + + public String shield(){ + return faker.resolve("darkSoul.shield"); + } +} diff --git a/src/main/java/com/github/javafaker/Faker.java b/src/main/java/com/github/javafaker/Faker.java index 751fb779..9429ebe6 100644 --- a/src/main/java/com/github/javafaker/Faker.java +++ b/src/main/java/com/github/javafaker/Faker.java @@ -107,6 +107,7 @@ public class Faker { private final Sip sip; private final EnglandFootBall englandfootball; private final Mountain mountain; + private final DarkSoul darkSoul; public Faker() { this(Locale.ENGLISH); @@ -223,6 +224,7 @@ public Faker(FakeValuesService fakeValuesService, RandomService random) { this.sip = new Sip(this); this.englandfootball = new EnglandFootBall(this); this.mountain = new Mountain(this); + this.darkSoul = new DarkSoul(this); } /** @@ -691,6 +693,8 @@ public StarCraft starCraft() { public Mountain mountain() { return mountain; } + public DarkSoul darkSoul(){ return darkSoul; } + public String resolve(String key) { return this.fakeValuesService.resolve(key, this, this); } From 7b0ddeaae982b71678b669015ef1c7aee8c4a72f Mon Sep 17 00:00:00 2001 From: SickDawn <68135258+SickDawn@users.noreply.github.com> Date: Sat, 28 May 2022 21:25:32 +0800 Subject: [PATCH 3/5] Add files via upload --- .../com/github/javafaker/DarkSoulTest.java | 94 +++++++++++++++++++ 1 file changed, 94 insertions(+) create mode 100644 src/test/java/com/github/javafaker/DarkSoulTest.java diff --git a/src/test/java/com/github/javafaker/DarkSoulTest.java b/src/test/java/com/github/javafaker/DarkSoulTest.java new file mode 100644 index 00000000..da2bdf50 --- /dev/null +++ b/src/test/java/com/github/javafaker/DarkSoulTest.java @@ -0,0 +1,94 @@ +package com.github.javafaker; + +import com.github.javafaker.matchers.MatchesRegularExpression; +import org.junit.Test; + +import static com.github.javafaker.matchers.MatchesRegularExpression.matchesRegularExpression; +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.isEmptyOrNullString; +import static org.hamcrest.Matchers.not; + +public class DarkSoulTest extends AbstractFakerTest { + + /** + * Basic test for generating classes. + */ + @Test + public void classes(){ + assertThat(faker.darkSoul().classes(),matchesRegularExpression("[A-Za-z]+")); + } + + /** + * Basic test for checking whether generating-classes is empty. + */ + @Test + public void classesNotNull(){ + assertThat(faker.darkSoul().classes(),not(isEmptyOrNullString())); + } + + /** + * Basic test for generating weapon. + */ + @Test + public void weapon(){ + assertThat(faker.darkSoul().weapon(), matchesRegularExpression("[A-Za-z' ]+")); + } + + /** + * Basic test for checking whether generating-weapon is empty. + */ + @Test + public void weaponNotNull(){ + assertThat(faker.darkSoul().weapon(),not(isEmptyOrNullString())); + } + + /** + * Basic test for generating shield. + */ + @Test + public void shield(){ + assertThat(faker.darkSoul().shield(), matchesRegularExpression("[A-Za-z' ]+")); + } + + /** + * Basic test for checking whether generating-shield is empty. + */ + @Test + public void shieldNotNull(){ + assertThat(faker.darkSoul().shield(),not(isEmptyOrNullString())); + } + + + /** + * Basic test for generating stats. + */ + @Test + public void stats(){ + assertThat(faker.darkSoul().stats(), matchesRegularExpression("[A-Za-z' ]+")); + } + + /** + * Basic test for checking whether generating-stats is empty. + */ + @Test + public void statsNotNull(){ + assertThat(faker.darkSoul().stats(),not(isEmptyOrNullString())); + } + + + /** + * Basic test for generating covenants. + */ + @Test + public void covenants(){ + assertThat(faker.darkSoul().covenants(), matchesRegularExpression("[A-Za-z' ]+")); + } + + /** + * Basic test for checking whether generating-covenants is empty. + */ + @Test + public void covenantsNotNull(){ + assertThat(faker.darkSoul().covenants(),not(isEmptyOrNullString())); + } +} From 8a4e44efa9547886d9886403383578e42a0d1570 Mon Sep 17 00:00:00 2001 From: SickDawn <68135258+SickDawn@users.noreply.github.com> Date: Sat, 28 May 2022 21:26:59 +0800 Subject: [PATCH 4/5] Add files via upload --- src/main/java/com/github/javafaker/service/files/EnFile.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/com/github/javafaker/service/files/EnFile.java b/src/main/java/com/github/javafaker/service/files/EnFile.java index 4a77ac01..7ec7f3c5 100644 --- a/src/main/java/com/github/javafaker/service/files/EnFile.java +++ b/src/main/java/com/github/javafaker/service/files/EnFile.java @@ -60,6 +60,7 @@ public String getPath() { "country.yml", "crypto_coin.yml", "currency.yml", + "darkSoul.yml", "dc_comics.yml", "demographic.yml", "dessert.yml", From 1dfffaee4674d9d78f1b32a7297c0eb67646c94b Mon Sep 17 00:00:00 2001 From: SickDawn <727266309@qq.com> Date: Sun, 29 May 2022 14:40:32 +0800 Subject: [PATCH 5/5] Update for test --- src/main/resources/en/darkSoul.yml | 2 +- .../com/github/javafaker/DarkSoulTest.java | 19 +++++++++++++++---- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/src/main/resources/en/darkSoul.yml b/src/main/resources/en/darkSoul.yml index 2e21b0f9..51ff8587 100644 --- a/src/main/resources/en/darkSoul.yml +++ b/src/main/resources/en/darkSoul.yml @@ -5,4 +5,4 @@ en: covenants: ["Blade of the Darkmoon","Chaos Servant","Darkwraith","Forest Hunter","Gravelord Servant","Path of the Dragon","Princess's Guard","Warrior of Sunlight","Way of White"] classes: ["Warrior","Knight","Wanderer","Thief","Bandit","Hunter","Sorcerer","Pyromancer","Cleric","Deprived"] weapon: ["Fist","Caestus","Claw","Dark Hand","Dragon Bone Fist","Hammers","Blacksmith Giant Hammer","Blacksmith Hammer","Hammer of Vamos","Club","Mace","Morning Star","Pickaxe","Reinforced Club","Warpick","Great Hammers","Demon's Great Hammer","Dragon Tooth","Grant","Great Club","Large Club","Smough's Hammer","Axes","Battle Axe","Butcher Knife","Crescent Axe","Gargoyle Tail Axe","Golem Axe","Hand Axe","Greataxes","Black Knight Greataxe","Demon's Greataxe","Dragon King Greataxe","Greataxe","Stone Greataxe","Daggers","Bandit's Knife","Dagger","Dark Silver Tracer","Ghost Blade","Parrying Dagger","Priscilla's Dagger","Thrusting Swords","Estoc","Mail Breaker","Rapier","Ricard's Rapier","Velka's Rapier","Straight Swords","Astora's Straight Sword","Balder Side Sword","Barbed Straight Sword","Broadsword","Broken Straight Sword","Crystal Straight Sword","Dark Sword","Drake Sword","Longsword","Shortsword","Silver Knight Straight Sword","Straight Sword Hilt","Sunlight Straight Sword","Greatswords","Abyss Greatsword","Bastard Sword","Black Knight Sword","Claymore","Crystal Greatsword","Flamberge","Great Lord Greatsword","Greatsword of Artorias","Greatsword of Artorias (Cursed)","Man Serpent Greatsword","Moonlight Greatsword","Obsidian Greatsword","Stone Greatsword","Ultra Greatswords","Black Knight Greatsword","Demon Great Machete","Dragon Greatsword","Greatsword","Zweihander","Katanas","Chaos Blade","Iaito","Uchigatana","Washing Pole","Curved Swords","Falchion","Gold Tracer","Jagged Ghost Blade","Painting Guardian Sword","Quelaag's Fury Sword","Scimitar","Shotel","Curved Greatswords","Gravelord Sword","Murakumo","Server","Spears","Channeler's Trident","Demon's Spear","Dragonslayer Spear","Four-Pronged Plow","Moonlight Butterfly Horn","Partizan","Pike","Silver Knight Spear","Spear","Winged Spear","Halberds","Black Knight Halberd","Gargoyle's Halberd","Giant's Halberd","Great Scythe","Halberd","Lifehunt Scythe","Lucerne","Scythe","Titanite Catch Pole","Bows","Black Bow of Pharis","Composite Bow","Darkmoon Bow","Long Bow","Short Bow","Crossbows","Avelyn","Heavy Crossbow","Light Crossbow","Sniper Crossbow","Greatbows","Dragonslayer Greatbow","Gough's Greatbow","Whips","Guardian Tail","Notched Whip","Whip"] - shield: ["Small Shields (able to parry)","Buckler","Caduceus Round Shield","Cracked Round Shield","Effigy Shield","Leather Shield","Plank Shield","Red and White Round Shield","Small Leather Shield","Target Shield","Warrior's Round Shield","Normal Shields (able to parry)","Balder Shield","Black Knight Shield","Bloodshield","Caduceus Kite Shield","Crest Shield","Dragon Crest Shield","East-West Shield","Gargoyle's Shield","Grass Crest Shield","Heater Shield","Hollow Soldier Shield","Iron Round Shield","Knight Shield","Large Leather Shield","Sanctus","Silver Knight Shield","Spider Shield","Sunlight Shield","Tower Kite Shield","Wooden Shield","Large Shields (able to bash)","Black Iron Greatshield","Bonewheel Shield","Cleansing Greatshield","Eagle Shield","Giant Shield","Greatshield of Artorias","Havel's Greatshield","Stone Greatshield","Tower Shield","Unique Shields","Crystal Ring Shield","Crystal Shield","Spiked Shield","Pierce Shield","Other","Dark Hand","Skull Lantern"] \ No newline at end of file + shield: ["Small Shields","Buckler","Caduceus Round Shield","Cracked Round Shield","Effigy Shield","Leather Shield","Plank Shield","Red and White Round Shield","Small Leather Shield","Target Shield","Warrior's Round Shield","Normal Shields","Balder Shield","Black Knight Shield","Bloodshield","Caduceus Kite Shield","Crest Shield","Dragon Crest Shield","East-West Shield","Gargoyle's Shield","Grass Crest Shield","Heater Shield","Hollow Soldier Shield","Iron Round Shield","Knight Shield","Large Leather Shield","Sanctus","Silver Knight Shield","Spider Shield","Sunlight Shield","Tower Kite Shield","Wooden Shield","Large Shields","Black Iron Greatshield","Bonewheel Shield","Cleansing Greatshield","Eagle Shield","Giant Shield","Greatshield of Artorias","Havel's Greatshield","Stone Greatshield","Tower Shield","Unique Shields","Crystal Ring Shield","Crystal Shield","Spiked Shield","Pierce Shield","Other","Dark Hand","Skull Lantern"] \ No newline at end of file diff --git a/src/test/java/com/github/javafaker/DarkSoulTest.java b/src/test/java/com/github/javafaker/DarkSoulTest.java index da2bdf50..bb8edf0d 100644 --- a/src/test/java/com/github/javafaker/DarkSoulTest.java +++ b/src/test/java/com/github/javafaker/DarkSoulTest.java @@ -31,7 +31,10 @@ public void classesNotNull(){ */ @Test public void weapon(){ - assertThat(faker.darkSoul().weapon(), matchesRegularExpression("[A-Za-z' ]+")); + for (int i = 0; i < 1000; i++) { + assertThat(faker.darkSoul().weapon(), matchesRegularExpression("[A-Za-z' ()-]+")); + } + } /** @@ -47,7 +50,10 @@ public void weaponNotNull(){ */ @Test public void shield(){ - assertThat(faker.darkSoul().shield(), matchesRegularExpression("[A-Za-z' ]+")); + for (int i = 0; i < 1000; i++) { + assertThat(faker.darkSoul().shield(), matchesRegularExpression("[A-Za-z' -]+")); + } + } /** @@ -64,7 +70,10 @@ public void shieldNotNull(){ */ @Test public void stats(){ - assertThat(faker.darkSoul().stats(), matchesRegularExpression("[A-Za-z' ]+")); + for (int i = 0; i < 1000; i++) { + assertThat(faker.darkSoul().stats(), matchesRegularExpression("[A-Za-z' ]+")); + } + } /** @@ -81,7 +90,9 @@ public void statsNotNull(){ */ @Test public void covenants(){ - assertThat(faker.darkSoul().covenants(), matchesRegularExpression("[A-Za-z' ]+")); + for (int i = 0; i < 1000; i++) { + assertThat(faker.darkSoul().covenants(), matchesRegularExpression("[A-Za-z' ]+")); + } } /**