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

Finished request of Add Dark Soul #730

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
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
34 changes: 34 additions & 0 deletions src/main/java/com/github/javafaker/DarkSoul.java
Original file line number Diff line number Diff line change
@@ -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");
}
}
4 changes: 4 additions & 0 deletions src/main/java/com/github/javafaker/Faker.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
}

/**
Expand Down Expand Up @@ -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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ public String getPath() {
"country.yml",
"crypto_coin.yml",
"currency.yml",
"darkSoul.yml",
"dc_comics.yml",
"demographic.yml",
"dessert.yml",
Expand Down
8 changes: 8 additions & 0 deletions src/main/resources/en/darkSoul.yml
Original file line number Diff line number Diff line change
@@ -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","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"]
105 changes: 105 additions & 0 deletions src/test/java/com/github/javafaker/DarkSoulTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
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(){
for (int i = 0; i < 1000; i++) {
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(){
for (int i = 0; i < 1000; i++) {
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(){
for (int i = 0; i < 1000; i++) {
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(){
for (int i = 0; i < 1000; i++) {
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()));
}
}