Skip to content

Commit

Permalink
complete issue DiUS#723
Browse files Browse the repository at this point in the history
  • Loading branch information
Uncle-Road committed May 19, 2022
1 parent e1dfd7c commit 2813dbe
Show file tree
Hide file tree
Showing 5 changed files with 192 additions and 0 deletions.
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 @@ -108,6 +108,7 @@ public class Faker {
private final EnglandFootBall englandfootball;
private final Mountain mountain;
private final Weapon weapon;
private final SoulKnight soulKnight;

public Faker() {
this(Locale.ENGLISH);
Expand Down Expand Up @@ -225,6 +226,7 @@ public Faker(FakeValuesService fakeValuesService, RandomService random) {
this.englandfootball = new EnglandFootBall(this);
this.mountain = new Mountain(this);
this.weapon = new Weapon(this);
this.soulKnight = new SoulKnight(this);
}

/**
Expand Down Expand Up @@ -697,6 +699,10 @@ public Weapon weapon(){
return weapon;
}

public SoulKnight soulKnight() {
return soulKnight;
}

public String resolve(String key) {
return this.fakeValuesService.resolve(key, this, this);
}
Expand Down
70 changes: 70 additions & 0 deletions src/main/java/com/github/javafaker/SoulKnight.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
package com.github.javafaker;

/**
* @author zhou mintao
* CS304 issue link:https://github.com/DiUS/java-faker/issues/723
* A class for generating random value of soul Knight
*/

public class SoulKnight {
private final Faker faker;

protected SoulKnight(final Faker faker){
this.faker = faker;
}

/**
* @return a random value of characters
*/

public String characters(){
String characters = faker.resolve("soulKnight.characters");
return characters;
}

/**
* @return a random value of buffs
*/

public String buffs(){
String buffs = faker.resolve("soulKnight.buffs");
return buffs;
}

/**
* @return a random value of statues
*/

public String statues(){
String statues = faker.resolve("soulKnight.statues");
return statues;
}

/**
* @return a random value of weapons
*/

public String weapons(){
String weapons = faker.resolve("soulKnight.weapons");
return weapons;
}

/**
* @return a random value of bosses
*/

public String bosses(){
String bosses = faker.resolve("soulKnight.bosses");
return bosses;
}

/**
* @return a random value of enemies
*/

public String enemies(){
String enemies = faker.resolve("soulKnight.enemies");
return enemies;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ public String getPath() {
"sip.yml",
"slack_emoji.yml",
"sonic_the_hedgehog.yml",
"soulKnight.yml",
"source.yml",
"south_park.yml",
"space.yml",
Expand Down
9 changes: 9 additions & 0 deletions src/main/resources/en/soulKnight.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
en:
faker:
soulKnight:
characters: ["Knight", "Rogue", "Wizard", "Assassin", "Alchemist", "Engineer", "Vampire", "Paladin", "Elf", "Werewolf", "Priest", "Druid", "Robot", "Berserker", "Necromancer", "Officer", "Taoist", "Element Envoy", "Inter-dimension Traveler", "The Beheaded", "Time Traveling Ninja", "Special Forces"]
buffs: ["Precise", "Ejection", "Penetrate", "Statue", "End", "Discount", "Explosion-proof", "Antifreeze", "Antivirus", "Trap", "Laser", "Sucking blood", "Back Magic", "Rebound", "Pet", "Case", "Impact", "Shield", "Shrapnel", "Golden devil", "Energy storage", "Element", "Three shots", "Armor", "Cooling", "Staff", "Potion", "Life"]
statues: ["Thief", "Elf", "Sorcerer", "Priest", "Assassin", "Knight", "Paladin", "Engineer", "Berserker", "Werewolf"]
weapons: ["40m Long Blade", "Advanced Scientific Calculator", "AK47 Gold", "AK-47", "Ancient Bow", "Assault Rifle", "Assault Shotgun", "Axe", "Bad Pistol", "Basketball", "Battle Axe", "Blaster", "Bleach", "Blind Missile Battery", "Blood Blade", "Bow", "Box", "Boxing Gloves", "Broadsword", "Broken Hilt", "Butcher's Knife", "Candied Hawberries", "Coilgun", "Composite Bow", "Crimson Wine Glass", "Crispy Bone", "Crossbow", "Crowbar", "Damaged Blade", "Deadly Frisbee", "Desert Eagle Gold", "Desert Eagle", "Dimensional Grip", "Dormant Bubble Machine", "Double Blade Sword", "Fertilizer", "Fine Machine Gun", "Flaring Claw", "Football", "Goblin Spear", "Green Essence", "Groundwater", "Guardian Railgun", "H2O", "Hammer", "Happy New Year", "Headgear Hero's Machine Gun", "Hope", "Improved SMG", "Iron Claw", "Jack and Mary", "Javelin", "Katana", "Legendary Apprentice’s Magic Staff", "Long-handled Axe", "M4", "M14", "Machete", "Magic Staff", "Mercenary Intern's Shotgun", "Mini Knight Figure", "Mini UZI", "Molotov Cocktail", "Monster Cuisine", "MP5", "Nemesis of Villains", "Ninja Stars", "Old Rocket Launcher", "Old Sniper Rifle", "P250 Pistol", "Paper Slip", "Pioneer", "Pirate Saber", "Pitchfork", "PKP", "Rapier", "Raw Axe", "Red Dragon", "Retouch-free Camera", "Retro Spear", "Revolver", "Rings", "Royal Knight's Short Sword", "S.O. Firearm", "Sacred Flail", "Satellite Floating Gun", "Sawed-off Shotgun", "Scratch Card", "Shaky Blaster", "Shotgun M1", "Shotgun Pro", "Shotgun", "Shovel", "Slingshot", "SMG M1", "Sniper Rifle", "Snow Fox L", "Spear", "Splitter Gun", "Staff of Nature", "Staff of Plague", "Strong Bow", "Tao Sword", "The Code", "Throwing Axe", "Tidal Staff", "TNT", "Trekking Pole", "Trumpet", "Twin-barrel Pistol", "Umbrella", "UZI", "Visage of Elemental Power", "Volcanic Blaster", "Vorpan", "Watering Can", "Wooden Cross", "Wooden Hammer", "Woodstick", "Worn Bazooka", "Alien Eagle", "Arbitrator", "Assault Sniper Rifle", "Bamboo", "Bayonet Rifle", "Bazooka", "Blowpipe", "Boomerang", "Bouncing Assault Rifle", "Broken Warbow of Royal Guard", "Broom", "Burp Gun", "Carrot", "Channeling Monkey", "Chu Ko Nu", "Executioner", "Feathered Crossbow", "Flame Blaster", "Flame Eagle", "Forgotten Staff of Wizard Guard", "Frost Eagle", "Gas Blaster", "Grand Wizard's Old Staff", "Gray Fox", "Green Basin", "Green Onions", "Grenade Pistol", "Grilled Carrot", "Grilled Green Onion", "Grilled Meat", "Guardian Rifle", "Halberd", "Heavenly Sword", "Horn", "Hunter Bow", "Ion Coilgun", "Ion Railgun", "Knight Spear", "Lasso Gun", "Mace", "Meat", "Next-gen SMG", "Old Sword of Royal Guard", "Plasma Eagle", "Poison Eagle", "Reusable Energy Pot", "Reusable Health Pot", "RYB Assault Rifle", "Shotgun Galaxy", "Shotgun M2", "Sickle", "Sidewinder Green", "Sidewinder Red", "SMG Helix", "Sniper Rifle Gold", "Snow Fox XL -SMG M2", "Spike Knives", "Splitter Cannon", "Staff of Light", "The Judge", "Triple Crossbow", "Twin-barrel Rifle", "Vine", "Wrenches", "Alien Plasma Eagle", "Assault Rifle Pro", "Assault Rocket", "Badminton Racket", "Baseball Bat", "Bouncing Railgun", "Bow Plus", "Brownian Coilgun", "Buckler", "Centennial Carrot", "Cherry Blossom", "Cluster Missile", "Crossbow Plus", "Crystal Bow", "Eagle of Ice and Fire", "Electric Therapy", "EM Sniper Rifle", "Firecrackers", "Fish", "Flame Bow", "Frost Bow", "Frost Spear", "Furnace", "Giant Axe", "Glacier", "Goddess Staff", "Gold Staff", "Grilled Fish", "Grilled Heavenly Sword", "Handmade Rod", "Heavy Hunter Axe", "Ice Breaker", "Ice Spikes", "Ion Railgun M2", "Jade Bow", "Jumper", "Knight's Fist", "Laser Sword Blue", "Laser Sword Green", "Laser Sword Red", "Laser Therapy", "Laser", "Molecule Ichimonji", "Nasty Laser", "Next-next-gen SMG", "Ninja Stars Plus", "Nunchaku", "Octopus", "Organic Wave", "Paper Bomb Kunai", "Pill", "Plunger", "Poker Cards", "Prototype Railgun", "Pufferfish", "Pulse", "Reusable Restoration Potion", "Revolver Gold", "Shotgun M3", "SMG M3", "Snow Fox XXL", "Splash Railgun", "Staff of Flame", "Staff of Frost", "Staff of Wizard Guard", "Stone Hammer", "Sweet Talk", "Sword of Royal Guard", "Trident", "Void Sword", "Warbow of Royal Guard", "Webber", "Windforce", "Wizard's Staff", "Assault Rifle Elite", "Assault Rifle Pro+", "Aurora", "Average Rod", "Ballista", "Bayonet in a Gourd", "Black Hole Missile", "Blue Fire Gatling", "Bouncing Sniper Rifle", "Bubble Gun", "Charged Railgun", "Cleaner", "Electric Drill", "Electric Ninja Stars", "EM Railgun", "Explosive Warhammer", "Firebolt", "Flame Axe", "Flame Sword", "Frost Battle Axe", "Frost Sword", "Fusion Drill", "Gatling Gun", "Hammerhead Shark", "Hand Grenade", "Hero Bow", "Hurricane Gauntlets", "Ice Bazooka", "Ion Laser", "Laser Rain", "Laser Shotgun", "Laser Sword Purple", "Meat Grinder", "Millennia Bamboo", "Mo Dao", "Next-next-next-gen SMG", "Plunger Plus", "Portable Bomber", "Rainbow Gatling", "Rainbow", "Reforged Sacred Sword", "Rocket Fireworks", "Rocket Gun", "Romantic UZI SMG", "Salamander", "Short Staff of Valiant Youngster", "SMG M4", "Sniper Rifle Gold Pro", "Snow Fox XXXL", "Spike Knives Eagle", "Staff of Thunder", "Super Monster Card", "Super Shotgun", "Sword of King Hero", "Swordfish", "Thunder Warhammer", "Toxic Webber", "Verbal Fire", "Viper", "Weeping Eagle", "Windforce Ninja Stars", "Breath of Hades", "Deep-sea Laser Fish", "Double Therapy", "Explosive Crossbow", "Fine Magic Staff", "Fist of Heaven", "Grenade SMG", "Grilled Laser Fish", "Illusion", "Implosion", "Laser Fish", "Laser Sword Gold", "Magic Bow", "Meteo Laser Gun", "Missile Battery", "Next-next-next-next-gen SMG", "Quality Rod", "Quantum Ninja Stars", "Rainbow Horse", "Ranger's Revolver", "Rocket Gun M1", "Shuddering Thunder", "Snow Fox Rose Gold", "Snow Fox Vintage", "Soul Calibre", "Staff of Illusion", "Star Bow", "Thunderstorm Warhammer", "Xuan Ming", "Zeus Thunderbolt", "Agitated Trunk", "Bomber", "Caliburn", "Cannibal Plant", "Captain's Medal", "Crystal Crab's Katana", "Cytoplasm", "Dark Shadow", "Dead Star Laser Gun", "Death Note", "Deep Dark Blade", "Dimension Travel Guide", "Dragon Bros’ Sniper Rifle", "Echo Amber", "Extra Crown", "Fantastic Gun", "Fine Magic Staff Gold", "Fist Bump", "Floating Gun", "Floating Laser", "Golden Crab Warhammer", "Golden Cudgel", "Grand Knight's Sword", "Grave Guard's Hatchet", "Magic Gloves", "Money Gun", "Nirvana Cross", "Oathbreaker- Oathkeeper", "One Punch", "Ordeal in Disguise", "Pharaoh's Blade", "Premium Rod", "Sandworm", "Shield", "Snow Ape's Longbow", "Snowman Eagle", "Staff of Anubis", "Staff of Shooting Stars", "Staff of Skeleton", "Staff of Wizard", "Strength Potion", "Super Buddy", "Time Traveler's Gadget", "The Emperor's New Gun", "Thunder Sword", "Unfinished Shark Gun", "Varkolyn Assault Rifle", "Walkie Talkie", "Warhammer of Sealed Souls", "Whisper of Dark", "Whistle"]
bosses: ["Nian", "Sir Sangria", "Sir Violet", "Alien Aircraft Carrier", "Iron Pirate King Level", "Iron Will Wavebreaker", "Volcanic Sandworm", "Baby Dragon Bros", "Anubis", "Varkolyn Leader", "Zulan The Colossus", "Floating Laser UFO", "Cave Ice Bug", "Grave Guard Scarab Archon", "Phantom King", "Headless Knight", "Skeleton King", "C6H8O6", "Grand Knight", "Grand Wizard", "Grand Slime", "Dark Grand Knight", "Zulan In Ruins", "Prehistoric Colossus", "Gold Mask", "The Giant", "King Snow Ape", "Giant Crystal Crab", "Snowman King", "Giant Golden Crab", "Devil's Snare", "Goblin Priest", "Christmas Treant", "Easter Bunny", "Goblin Priest", "Lord of Infinite Dark"]
enemies: ["Goblin Guard(Pistol)", "Goblin Guard(Spear)", "Goblin Guard(Bow)", "Elite Goblin Guard(Shotgun)", "Elite Goblin Guard(Blowpipe)", "Elite Goblin Guard(Axe)", "Goblin Giant", "Goblin Shaman", "Boar", "Dire Boar", "GunShark", "Trumpet Flower","Fire Goblin Priest", "Elite Goblin Archer", "Christmas Treant", "Easter Bunny", "Devil's Snare", "Goblin Priest", "Goblin Priest (Haunted)", "Miner(Pickaxe)", "Miner(Drill)", "Miner(Heavy)", "Elite Miner(Shotgun)","Elite Miner(Rifle)", "Elite Miner(Heavy)", "Snow Ape", "Baby Snow Ape", "Crystal Starfish", "Crystal Beetle", "Golden Beetle", "Snow Ape Pitcher", "Mining Electrician", "King Snow Ape", "Giant Crystal Crab", "Snowman King", "Giant Golden Crab", "Stone Guard", "Stone Laser", "Stone Archer", "Elite Monkey (AK47)", "Monkey (Poo)", "Monkey (Vine)", "Monkey (Club)", "Elite Monkey (Rocket Fireworks)", "Rock Crab", "Toxic Worm", "Guard Crab", "Prehistoric Colossus", "Gold Mask", "The Giant", "Ruins Sentry (Spear)", "Ruins Sentry (Bow)", "Portal", "Ruins Searcher", "Ruins Guard", "Ancient Gear Set", "Ruins Turret", "Zulan In Ruins", "Knight(Sword)", "Knight(Pistol)", "Knight(SMG)", "Elite Knight(Sword)", "Elite Knight(Shotgun)", "Elite Knight(Rifle)", "Big Soldier", "Wizard", "Battery", "Slime", "Dark Knight", "Grand Knight", "Grand Wizard", "Grand Slime", "Dark Grand Knight", "Skeleton(Sword)", "Skeleton(Shotgun)", "Skeleton(Bow)", "Elite Skeleton(Sword)", "Elite Skeleton(Shotgun)", "Elite Skeleton(Rifle)", "Big Skeleton", "Spider", "Poison Spider", "Skeleton Shaman", "Skeleton Doggy", "Skeleton King", "C6H8O6", "Pumpkin Man(Pitchfork)", "Pumpkin Man(Scythe)", "Pumpkin Man(Handgun)", "Elite Pumpkin Man(Scythe)", "Elite Pumpkin Man(Rifle)", "Elite Pumpkin Man(Shotgun)", "Zombie", "Frog", "Phantom", "Witch", "Pumpkin Coach", "Phantom King", "Headless Knight and His Horse", "Mega Mining Extractor(Claw)", "Mega Mining Extractor(Cannon)", "Manned Mecha Guardian(Cannon)", "Manned Mecha Guardian(Drill)", "Explosive Worker", "Crystal Giant", "Crystal Giant Jr.", "Miner Lead(Beam Gun)", "Ice Bug Larva", "Miner Lead(Pickaxe)", "Mushroom Baby", "Mushroom Man", "Tentacle of the Past", "Goblin Artist", "Haunted Goblin(Pioneer)", "Haunted Goblin(Goblin Spear)", "Haunted Goblin(Bow)", "Haunted Goblin(Shotgun)", "Haunted Goblin(Blowpipe)", "Haunted Goblin(Axe)", "Haunted Goblin Shaman", "Haunted Goblin Giant", "Abyss Knight(Blue Spear)", "Abyss Knight(Green Spear)", "Abyss Knight(Orange Spear)", "Lord of Infinite Dark", "Scarab(Red)", "Scarab(Blue)", "Scarab(Green)", "Grave Robber", "Top Gun", "Grave Skeleton(Staff)", "Grave Skeleton(Bow)", "Elite Grave Skeleton(Sword)","Grave Guard Scarab Archon", "Elite Grave Skeleton(Mace)", "Elite Grave Skeleton(Javelin)", "Alien(Laser Sword)", "Alien(Laser Gun)", "Alien(Machine Gun)", "Battery", "UFO", "Goblin Fly", "Goblin", "Tentacle", "Varkolyn Guard(Axe)", "Varkolyn Guard(Machine Gun)", "Varkolyn", "Transition Device", "Varkolyn Leader", "Zulan The Colossus", "Floating Laser UFO", "Mummy(Handgun)", "Mummy(Rifle)", "Mummy(Bomb)", "Elite Mummy(Staff)","Elite Mummy(SMG)", "Flame Knight(Spear)", "Flame Knight Captain", "Flame Knight(Hammer)", "Volcanic Bug", "Burning Beetle", "Volcanic Turtle", "Lava Beehive", "Volcanic Sandworm", "Baby Dragon Bros", "Anubis", "Infantry PirateType A (Scimitar)", "Infantry PirateType A (Rifle)", "Infantry PirateType A (Sawed-off)", "Infantry Pirate(Boxer Model) Type B", "Code Name:Dancer", "Amphibian PirateType C", "SOF InfantryPirate Type E", "Sentry OwlPilot Type", "Floating Laser Crab MPT", "Robot of Fragile Core", "Iron Pirate King Level", "Iron Will Wavebreaker", "Sir Sangria", "Sir Violet", "Alien Aircraft Carrier", "Turret", "Chester", "Gold Mine", "Crystal Mine", "Nian"]
106 changes: 106 additions & 0 deletions src/test/java/com/github/javafaker/SoulKnightTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
package com.github.javafaker;

import org.junit.Test;

import static com.github.javafaker.matchers.MatchesRegularExpression.matchesRegularExpression;
import static org.junit.Assert.assertThat;
import static org.hamcrest.Matchers.*;


public class SoulKnightTest extends AbstractFakerTest{
/**
* CS304 issue link:https://github.com/DiUS/java-faker/issues/723
*/
@Test
public void charactersTest(){
assertThat(faker.soulKnight().characters(), matchesRegularExpression("[a-zA-Z0-9\\-\\.\\ \\/\\(\\)\\']+"));
}

/**
* CS304 issue link:https://github.com/DiUS/java-faker/issues/723
*/
@Test
public void charactersNotNullTest(){
assertThat(faker.soulKnight().characters(),not(isEmptyOrNullString()));
}

/**
* CS304 issue link:https://github.com/DiUS/java-faker/issues/723
*/
@Test
public void buffsTest(){
assertThat(faker.soulKnight().buffs(), matchesRegularExpression("[a-zA-Z0-9\\-\\.\\ \\/\\(\\)\\']+"));
}

/**
* CS304 issue link:https://github.com/DiUS/java-faker/issues/723
*/
@Test
public void buffsNotNullTest(){
assertThat(faker.soulKnight().buffs(),not(isEmptyOrNullString()));
}

/**
* CS304 issue link:https://github.com/DiUS/java-faker/issues/723
*/
@Test
public void statuesTest(){
assertThat(faker.soulKnight().statues(), matchesRegularExpression("[a-zA-Z0-9\\-\\.\\ \\/\\(\\)\\']+"));
}

/**
* CS304 issue link:https://github.com/DiUS/java-faker/issues/723
*/
@Test
public void statuesNotNullTest(){
assertThat(faker.soulKnight().statues(),not(isEmptyOrNullString()));
}

/**
* CS304 issue link:https://github.com/DiUS/java-faker/issues/723
*/
@Test
public void weaponsTest(){
assertThat(faker.soulKnight().weapons(), matchesRegularExpression("[a-zA-Z0-9\\-\\.\\ \\/\\(\\)\\']+"));
}

/**
* CS304 issue link:https://github.com/DiUS/java-faker/issues/723
*/
@Test
public void weaponsNotNullTest(){
assertThat(faker.soulKnight().weapons(),not(isEmptyOrNullString()));
}

/**
* CS304 issue link:https://github.com/DiUS/java-faker/issues/723
*/
@Test
public void bossesTest(){
assertThat(faker.soulKnight().bosses(), matchesRegularExpression("[a-zA-Z0-9\\-\\.\\ \\/\\(\\)\\']+"));
}

/**
* CS304 issue link:https://github.com/DiUS/java-faker/issues/723
*/
@Test
public void bossesNotNullTest(){
assertThat(faker.soulKnight().bosses(),not(isEmptyOrNullString()));
}

/**
* CS304 issue link:https://github.com/DiUS/java-faker/issues/723
*/
@Test
public void enemiesTest(){
assertThat(faker.soulKnight().enemies(), matchesRegularExpression("[a-zA-Z0-9\\-\\.\\ \\/\\(\\)\\(\\)\\']+"));
}

/**
* CS304 issue link:https://github.com/DiUS/java-faker/issues/723
*/
@Test
public void enemiesNotNullTest(){
assertThat(faker.soulKnight().enemies(),not(isEmptyOrNullString()));
}
}

0 comments on commit 2813dbe

Please sign in to comment.