Skip to content
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
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ Fakers
* Bojack Horseman
* Book
* Bool
* Blood
* Business
* ChuckNorris
* Cat
Expand Down
14 changes: 14 additions & 0 deletions src/main/java/com/github/javafaker/Blood.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package com.github.javafaker;

public class Blood {
private final Faker faker;

protected Blood(Faker faker) {
this.faker = faker;
}

public String name() {
return faker.fakeValuesService().resolve("blood.name", this, faker);
}

}
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 @@ -33,6 +33,7 @@ public class Faker {
private final Book book;
private final ChuckNorris chuckNorris;
private final Color color;
private final Blood blood;
private final Commerce commerce;
private final Country country;
private final Currency currency;
Expand Down Expand Up @@ -149,6 +150,7 @@ public Faker(FakeValuesService fakeValuesService, RandomService random) {
this.business = new Business(this);
this.chuckNorris = new ChuckNorris(this);
this.color = new Color(this);
this.blood = new Blood(this);
this.idNumber = new IdNumber(this);
this.hacker = new Hacker(this);
this.company = new Company(this);
Expand Down Expand Up @@ -419,6 +421,10 @@ public Color color() {
return color;
}

public Blood blood() {
return blood;
}

public Commerce commerce() {
return commerce;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ public String getPath() {
"bank.yml",
"basketball.yml",
"beer.yml",
"blood.yml",
"bojack_horseman.yml",
"book.yml",
"bossa_nova.yml",
Expand Down
2 changes: 2 additions & 0 deletions src/main/resources/ar.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ ar:

color:
name: [أحمر, أخضر, أزرق, أصفر, بنفسجيّ, نعناعيّ, أبيض, أسود, برتقاليّ, ورديّ, رماديّ, كستنائيّ, تركواز, سماريّ, خوخيّ, أوركيديّ, زيتونيّ, أرجوانيّ, ليمونيّ, نيليّ, ذهبيّ, فوشيه, لازورديّ, فضّي]
blood:
name: ["A+", "A-", "B+", "B-", "AB+", "AB-", "O+", "O-"]

commerce:
department: ["كتب", "أفلام", "موسيقى", "آلعاب", "الكترونيات", "حاسبات", "منزل", "حديقة", "أدوات", "بقالة", "صحة", "جمال", "آلعاب", "أطفال", "رضّع", "ملابس", "أحذية", "مجوهرات", "رياضة", "أنشطة خارجيّة", "سيّارات", "صناعات"]
Expand Down
2 changes: 2 additions & 0 deletions src/main/resources/ca.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,5 @@ ca:
- "#{first_name} #{last_name} #{last_name}"
color:
name: [aiguamarina, albercoc, amarant, ambre, ametista, atzur, beix, bistre, blanc, blat, blau, blau cel, blau fosc, blau marí, blau reial, blauet, bronze, camussa, canyella, caqui, cardenal, carmesí, carmí, carnació, castany rogenc, celadont, ceruli, chartreuse, cian, cirera, corall, coure, crema, escarlata, granat, gris, gris fosc, groc, lavanda, lila, llima, magenta, malva, marró, morat, ocre, or, orquídia, panotxa, plata, porpra, préssec, pruna, verd, verd maragda, verd oliva, verd veronès, vermell, vermell fosc, vermelló, vinca, violat, vori]
blood:
name: ["A+", "A-", "B+", "B-", "AB+", "AB-", "O+", "O-"]
2 changes: 2 additions & 0 deletions src/main/resources/cs-CZ.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ cs-CZ:
- "#{male_first_name}.#{male_last_name}"
color:
name: [červená, zelená, modrá, žlutá, purpurová, bílá, černá, oranžová, růžová, šedá, fialová, tyrkysová, lososová, švesková, cihlová, olivová, magenta, hnědá, vínová, zlatá, stříbrná, azurová]
blood:
name: ["A+", "A-", "B+", "B-", "AB+", "AB-", "O+", "O-"]
phone_number:
formats: ['###-###-####', '(###) ###-####', '1-###-###-####', '###.###.####', '###-###-####', '(###) ###-####', '1-###-###-####', '###.###.####', '###-###-#### x###', '(###) ###-#### x###', '1-###-###-#### x###', '###.###.#### x###', '###-###-#### x####', '(###) ###-#### x####', '1-###-###-#### x####', '###.###.#### x####', '###-###-#### x#####', '(###) ###-#### x#####', '1-###-###-#### x#####', '###.###.#### x#####']
cell_phone:
Expand Down
2 changes: 2 additions & 0 deletions src/main/resources/de.yml
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,8 @@ de:

color:
name: [rot, grün, blau, gelb, lila, weiß, schwarz, orange, rosa, grau, braun, violett, türkis, oliv, beige, ocker, sand, mocka, bordeaux, aprikose, mint-grün, magenta, gold, silber, bronze, limette, azur, pink]
blood:
name: ["A+", "A-", "B+", "B-", "AB+", "AB-", "O+", "O-"]

commerce:
department: ["Bücher", "Filme", "Musik", "Spiele", "Elektronik", "Computer", "Haushalt", "Garten", "Werkzeug", "Lebensmittel", "Gesundheit", "Beauty", "Spielzeug", "Kinder", "Kleinkinder", "Kleider", "Schuhe", "Schmuck", "Sport", "Outdoor", "Auto", "Industrie"]
Expand Down
4 changes: 4 additions & 0 deletions src/main/resources/en/blood.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
en:
faker:
blood:
name: ["A+", "A-", "B+", "B-", "AB+", "AB-", "O+", "O-"]
2 changes: 2 additions & 0 deletions src/main/resources/fr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ fr:

color:
name: ["rouge", "vert", "bleu", "jaune", "violet", "vert menthe", "bleu sarcelle", "blanc", "noir", "orange", "rose", "gris", "marron", "turquoise", "brun", "bleu ciel", "saumon", "prune", "orchidée", "olive", "magenta", "vert citron", "ivoire", "indigo", "or", "fuchsia", "cyan", "azur", "lavande", "argent"]
blood:
name: ["A+", "A-", "B+", "B-", "AB+", "AB-", "O+", "O-"]

compass:
cardinal:
Expand Down
2 changes: 2 additions & 0 deletions src/main/resources/hu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ hu:

color:
name: [vörös, zöld, kék, sárga, lila, mentazöld, zöldeskék, fehér, fekete, narancssárga, rózsaszín, szürke, gesztenyebarna, ibolya, türkiz, cser, égszínkék, lazacszín, szilvakék, oliva, bíborvörös, lime, csontfehér, indigókék, aranyszín, fukszia, ciánkék, levendula, ezüst]
blood:
name: ["A+", "A-", "B+", "B-", "AB+", "AB-", "O+", "O-"]

commerce:
department: ["Könyvek", "Filmek", "Zene", "Játékok", "Műszaki készülékek", "Számítógépek", "Otthon", "Kert", "Szerszámok", "Élelmiszer", "Egészség", "Kozmetika", "Gyermekholmik", "Babaholmik", "Ruházat", "Cipők", "Ékszer", "Sportszer", "Túrafelszerelés", "Gépjármű"]
Expand Down
2 changes: 2 additions & 0 deletions src/main/resources/hy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,8 @@ hy:

color:
name: [կարմիր, կանաչ, կապույտ, դեղին, մանուշակագույն, սպիտակ, սև, նարնջագույն, վարդագույն, մոխրագույն, շագանակագույն, մանուշակագույն, փիրուզագույն, երկնագույն, դեղնավարդագույն, մուգ մանուշակագույն, դեղնականաչ, ոսկեգույն, դարչնագույն]
blood:
name: ["A+", "A-", "B+", "B-", "AB+", "AB-", "O+", "O-"]

commerce:
department: [Գրքեր, Ֆիլմեր, Երաժշտություն, Խաղեր, Խաղալիքեր, Էլեկտրոնիկա, Համակարգիչներ, Ապրանքներ Տան Համար, Ապրանքներ Այգեգործության Համար, Գործիքներ, Նպարեղեն, Առողջապահական Ապրանքներ, Կոսմետիկ Ապրանքներ, Մանկական Ապրանքներ, Ապրանքներ Նորածինների Համար, Հագուստ, Կոշկեղեն, Ոսկերչական Իրեր, Սպորտային Ապրանքներ, Ավտոմոբիլների Պահեստամասեր, Արդյունաբերական Ապրանքներ]
Expand Down
2 changes: 2 additions & 0 deletions src/main/resources/ja.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ ja:

color:
name: ["赤", "緑", "青", "黄", "紫", "ミントグリーン", "ティール", "白", "黒", "オレンジ", "ピンク", "灰色", "栗色", "バイオレット", "ターコイズブルー", "タン", "空色", "サーモン", "プラム", "オーキッド", "オリーブ", "マゼンタ", "ライム", "アイボリー", "藍色", "金", "フクシア", "シアン", "紺碧", "ラベンダー", "銀"]
blood:
name: ["A+", "A-", "B+", "B-", "AB+", "AB-", "O+", "O-"]

company:
suffix: ["株式会社", "有限会社", "合名会社", "合資会社", "合同会社"]
Expand Down
2 changes: 2 additions & 0 deletions src/main/resources/pt-BR.yml
Original file line number Diff line number Diff line change
Expand Up @@ -642,6 +642,8 @@ pt-BR:
suffix: ["Jr.", "Neto", "Filho"]
color:
name: ["Abóbora", "Amaranto", "Amarelo", "Âmbar", "Ameixa", "Ardósia", "Azul", "Azul-bebê", "Azul-claro", "Azul-cobalto", "Azul-esverdeado", "Azul-marinho", "Azul-persa", "Azul-violeta", "Bege", "Branco", "Carmesim", "Carmim", "Cereja", "Cerúleo", "Champagne", "Chocolate", "Cinza", "Coral", "Escarlate", "Framboesa", "Índigo", "Laranja", "Lavanda", "Lilás", "Lima", "Magenta", "Marfim", "Marrom", "Oliva", "Ouro", "Pêssego", "Prata", "Preto", "Rosa", "rosa-arroxeado", "Rosa-magenta", "Roxo", "Salmão", "Turquesa", "Uva", "Verde", "Verde-água", "Verde-claro", "Verde-jade", "Verde-limão", "Verde-primavera", "Vermelho", "Violeta"]
blood:
name: ["A+", "A-", "B+", "B-", "AB+", "AB-", "O+", "O-"]
team:
main_teams: ['Flamengo', 'Fluminense', 'Botafogo', 'Vasco da Gama', 'Corinthians','Grêmio','Flamengo','Palmeiras','Santos','Coritiba','Cruzeiro','Ponte Preta', 'Chapecoense', 'Sport','São Paulo','Bahia', 'Vitória', 'Avaí', 'América']
prefix: ['Grêmio', 'Atlético', 'Clube de Regatas', 'Esporte']
Expand Down
2 changes: 2 additions & 0 deletions src/main/resources/th.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ th:

color:
name: [แดง, สัม, แสด, เหลือง, เขียวอ่อน, เขียวแก่, ฟ้า, น้ำเงิน, ม่วง, ชมพู, ขาว, ดำ, เทา, น้ำตาล, เนื้อ, น้ำตาลไหม้, น้ำตาลอ่อน, เกาลัด, ธัญพืช, โอ๊ต, ชานม, ทราย, น้ำตาลดำ, เหลืองไหล, นวลจันทร์, เหลืองรงค์, นวล, เหลืองดิน, แดงชาด, เสน, ดินแดง, หิงส์ดิน, แดงดอกชบา, บัวโรย, แดงเลือดหมู, แดงเลือดนก, หงชาด, ลิ้นจี่, ม่วงดอกตะแบก, ฟ้าแลบ, ควายเผือก, ม่วงดอกผักตบ, คราม, เมฆคราม, ม่วงเม็ดมะปราง, ลูกหว้า, ขาวกระบัง, น้ำไหล, ผ่านคราม, เขียวใบแค, เขียวไหล, ผุ่นแดง, ดำเขม่า, หมึกจีน, เขียวตังแข]
blood:
name: ["A+", "A-", "B+", "B-", "AB+", "AB-", "O+", "O-"]

internet:
domain_suffix: [co.th, net, io, com, org]
Expand Down
14 changes: 14 additions & 0 deletions src/test/java/com/github/javafaker/BloodTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package com.github.javafaker;

import org.junit.Test;

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

public class BloodTest extends AbstractFakerTest {
// must match one of the blood types in the list
@Test
public void testName() {
assertThat(faker.blood().name(), matchesRegularExpression("A\\+|A-|B\\+|B-|AB\\+|AB-|O\\+|O-"));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ public void testAllFakerMethodsThatReturnStrings() throws Exception {
testAllMethodsThatReturnStringsActuallyReturnStrings(faker.book());
testAllMethodsThatReturnStringsActuallyReturnStrings(faker.chuckNorris());
testAllMethodsThatReturnStringsActuallyReturnStrings(faker.color());
testAllMethodsThatReturnStringsActuallyReturnStrings(faker.blood());
testAllMethodsThatReturnStringsActuallyReturnStrings(faker.commerce());
testAllMethodsThatReturnStringsActuallyReturnStrings(faker.company());
testAllMethodsThatReturnStringsActuallyReturnStrings(faker.country());
Expand Down