ダミーデータ作成ライブラリ「Java Faker」の使い方~全ダミーデータの出力結果を解説~
テストデータを作成するとき、名前=山田太郎って入れていませんか?
システム開発あるあるですが、山田太郎さんばかりでは、テストデータとして信頼性にかけしまいます。
そんなときは、ダミーデータ作成ライブラリを使って、実際のデータに近い値を作成したりします。
そこで、今回は弊社でもありがたく利用させていただいているJavaのライブラリ、
「DiUS/java-faker」をご紹介します。
https://github.com/DiUS/java-faker
基本的な使い方から、存在している作成メソッドをほぼ全て実行してみました。
ポケモン、ドラゴンボール、ハリーポッター、ヨーダのセリフなど
気になるデータの出力結果も紹介していますので、良ければ最後までお付き合いください。
Java Fakerの使い方
まずは基本的な使い方の説明です。
1.ライブラリの読込
Mavenプロジェクトの場合は、pom.xmlの
1 2 3 4 5 |
<dependency> <groupId>com.github.javafaker</groupId> <artifactId>javafaker</artifactId> <version>0.16</version> </dependency> |
Gradleプロジェクトの場合は、build.gradleに以下を追加します。
1 2 3 4 5 6 7 |
repositories { mavenCentral() } dependencies { testCompile group: 'com.github.javafaker', name: 'javafaker', version: '0.16' } |
これで準備完了です。
2.Fakerを利用します
基本的な使い方は”new”して、関数を呼ぶだけです。
氏名を5つ取得してみます。
1 2 3 4 |
Faker faker = new Faker(new Locale("ja_JP")); // 日本語対応 for (int i = 0; i < 5; i++) { System.out.println("fullName:" + faker.name().fullName()); // フルネーム } |
【結果】
fullName:新井 亮
fullName:坂本 輝
fullName:酒井 明日香
fullName:吉田 彩
簡単にダミーの名前を作成することできました。
良く使うダミーデータ
名前の生成
名前のダミーデータは良く利用します。
基本的な使い方で紹介したフルネーム以外に、苗字、名前を分けて取得することが出来ます。
1 2 3 4 |
Name name = faker.name(); System.out.println("fullName:" + name.fullName()); // フルネーム System.out.println("lastName:" + name.lastName()); // 苗字 System.out.println("firstName:" + name.firstName()); // 名前 |
【結果】
lastName:田中
firstName:奏太
名前は日本人の名前を生成してくれるので、使いやすいですね。
もちろん「山田 太郎」さんもランダムで出てきます。
住所の生成
住所のダミーデータも良く利用します。
1 2 3 4 5 6 7 8 9 10 |
Address address = faker.address(); System.out.println("zipCode:" + address.zipCode()); // 郵便番号 System.out.println("stateAbbr:" + address.stateAbbr()); // 都道府県コード System.out.println("state:" + address.state()); // 都道府県 System.out.println("cityName:" + address.cityName()); // 市 System.out.println("streetAddress:" + address.streetAddress()); // 通り住所 System.out.println("secondaryAddress:" + address.secondaryAddress()); // その他住所? // 全部繋げて住所にする System.out.println("繋げてみた住所:" + address.zipCode() + address.state() + address.city() + address.cityName() + address.streetAddress(true)); |
【結果】
stateAbbr:2
state:沖縄県
cityName:増田市
streetAddress:606 太一Avenue
secondaryAddress:Suite 789
繋げてみた住所:968-3075山梨県新翔市青木町0377 諒Course Apt. 732
それぞれの値に関連性がないので、おかしな住所になってしまいます。
ただ、精度を求めないのであれば、十分利用できるデータを作成することができます。
ちなみに「streetAddress(true)」の引数にtrueを渡すと、
streetAddress() + secondaryAddress() を生成することができます。
繋げた住所ではこれを利用しています。
ランダムな数字の生成
乱数の生成も簡単にできます。
1 2 3 4 5 6 7 8 9 10 11 |
// randomを利用する方法 RandomService random = faker.random(); System.out.println(random.nextInt(5, 20)); // 指定範囲内のランダムなInteger System.out.println(random.nextInt(15)); // 指定数字"未満"のランダムなint System.out.println(random.nextBoolean()); // true or false // numberを利用する方法 Number number = faker.number(); System.out.println(number.randomNumber(10, true)); // 10桁のlong System.out.println(number.randomNumber(10, false)); // 10桁のlongだけど乱数が0始まりだと桁落ちする System.out.println(number.digits(5)); // 指定桁数の数字文字列 |
【結果】
nextInt(15):7
nextBoolean:true
randomNumber(10, true):8867879735
randomNumber(10, false):5631846532
digits(5):64958
値を指定する場合は、”random”を利用し、桁を指定する場合は、”number”を利用します。
フラグの生成なんかも便利ですね。
メールアドレスの生成
メールアドレスも生成することができます。
1 2 3 4 5 6 7 8 9 10 |
FakeValuesService fakeValuesService = new FakeValuesService( new Locale("ja_JP"), new RandomService()); Internet internet = faker.internet(); // 引数無しの場合は日本語アカウントになってしまう System.out.println("safeEmailAddress:" + internet.safeEmailAddress()); // fakeValuesService.bothify("???_###")を利用して適当なアドレスを生成(?は文字、#は数値) System.out.println("safeEmailAddress:" + internet.safeEmailAddress(fakeValuesService.bothify("???_###"))); |
【結果】
safeEmailAddress:mjs_203@example.com
「safeEmailAddress」を利用すると”@example.com”でアドレスが生成されます。
引数に文字列を指定すると、アカウント部分に設定されます。
引数を指定しない場合は日本語のおかしなアドレスが出来てしまいました。
サンプルで利用している「fakeValuesService.bothify」も非常に便利です。
? が文字に置き換わり、# が数値に置き換わるので、ランダムな文字列を作るときに利用します。
メールアドレスは、他に「emailAddress」でも生成も出来ますが、”@yahoo.com”など
実在するアドレスが生成される可能性があるため、「safeEmailAddress」の利用をお勧めします。
単語の生成
単語の生成もできます。
が、日本語の対応はされてません。
「Lorem ipsum(ロレム・イプサム)」という有名なダミーテキストが基になっているようなので、
ラテン語?の文字が返って来ます。
1 2 3 |
Lorem lorem = faker.lorem(); System.out.println("word:" + lorem.word()); System.out.println("words:" + lorem.words(5)); // 引数無しの場合は3つ |
【結果】
words:[est, sed, velit, repellendus, ut]
日本語の単語が欲しいところですが、
単純に文字列を入れたいだけであればこれでも十分ですね。
文章の生成
文章を生成する場合はこれらを利用します。
1 2 3 4 5 6 7 |
// 5つ以上の単語の文章作成。引数無しの場合は3つ以上の単語以上の文章 System.out.println("sentence:" + lorem.sentence(5)); // 2つ以上の文章で段落作成。引数無しの場合は2つ以上の文章以上の段落 System.out.println("paragraph:" + lorem.paragraph(2)); // 文字数の指定、30文字の文章 System.out.println("fixedString:" + lorem.fixedString(30)); |
【結果】
paragraph:Nihil ut dolore. Eos dolorem aut rerum corporis quo aut. Voluptatibus voluptatum tempore libero voluptas et. Exercitationem et molestiae aliquam fugit.
fixedString:Et non autem iste nihil corrup
内部で単語をつないているだけですが、
メモ項目などに適当な文字を入れたい場合には役立ちそうですね。
利用できそうなダミーデータ
他に利用できそうなものもいくつかPickUpしてみます。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
// 会社名 System.out.println("company.name:" + faker.company().name()); // 大学名 System.out.println("university.name:" + faker.university().name()); // パスワード System.out.println("internet.password:" + faker.internet().password()); // 携帯番号 System.out.println("phoneNumber.cellPhone:" + faker.phoneNumber().cellPhone()); // 電話番号 System.out.println("phoneNumber.phoneNumber:" + faker.phoneNumber().phoneNumber()); // ポケモン System.out.println("pokemon.name:" + faker.pokemon().name()); |
【結果】
university.name:四国藤井音楽大学
internet.password:4s2enzx1
phoneNumber.cellPhone:080-2936-1071
phoneNumber.phoneNumber:01953-4-5659
pokemon.name:ガルーラ
電話番号は実在する可能性もあるので、使い方は要注意です。
日本語にできるデータ
日本語で取得できるダミーデータはソースを見れば良くわかります。
https://github.com/DiUS/java-faker/blob/master/src/main/resources/ja.yml
住所、名前、大学、会社、ポケモンだけであまり日本語対応されていないですが、
この内容を踏まえて利用すれば十分要件は満たせるのではないでしょうか。
(ほぼ)全てのメソッドを実行した結果
実際どんなデータが出力されるかは、動かしてみた方が早いです。
そこで、動かせそうなメソッドを全て呼び出してみました。
使えそうなものがあれば、お試しください。
ちなみに”pokemon”は良く利用しています。
address
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
System.out.println("address().fullAddress():" + faker.address().fullAddress()); System.out.println("address().city():" + faker.address().city()); System.out.println("address().cityName():" + faker.address().cityName()); System.out.println("address().cityPrefix():" + faker.address().cityPrefix()); System.out.println("address().citySuffix():" + faker.address().citySuffix()); System.out.println("address().country():" + faker.address().country()); System.out.println("address().countryCode():" + faker.address().countryCode()); System.out.println("address().firstName():" + faker.address().firstName()); System.out.println("address().lastName():" + faker.address().lastName()); System.out.println("address().latitude():" + faker.address().latitude()); System.out.println("address().longitude():" + faker.address().longitude()); System.out.println("address().secondaryAddress():" + faker.address().secondaryAddress()); System.out.println("address().state():" + faker.address().state()); System.out.println("address().stateAbbr():" + faker.address().stateAbbr()); System.out.println("address().streetAddress():" + faker.address().streetAddress()); System.out.println("address().streetAddress(true):" + faker.address().streetAddress(true)); System.out.println("address().streetAddress(false):" + faker.address().streetAddress(false)); System.out.println("address().streetAddressNumber():" + faker.address().streetAddressNumber()); System.out.println("address().streetName():" + faker.address().streetName()); System.out.println("address().streetPrefix():" + faker.address().streetPrefix()); System.out.println("address().streetSuffix():" + faker.address().streetSuffix()); System.out.println("address().timeZone():" + faker.address().timeZone()); System.out.println("address().zipCode():" + faker.address().zipCode()); |
address().city:大樹区
address().cityName:健区
address().cityPrefix:小
address().citySuffix:村
address().country:Trinidad and Tobago
address().countryCode:ME
address().firstName:悠
address().lastName:西村
address().latitude:58.052421
address().longitude:94.738867
address().secondaryAddress:Suite 149
address().state:福島県
address().stateAbbr:22
address().streetAddress:2415 松尾Loop
address().streetAddress(true):071 美羽Throughway Suite 185
address().streetAddress(false):5464 渡部Wall
address().streetAddressNumber:122
address().streetName:結衣Lane
address().streetPrefix:xx
address().streetSuffix:Tunnel
address().timeZone:Pacific/Tongatapu
address().zipCode:881-0696
artist
1 |
System.out.println("artist().name():" + faker.artist().name()); |
avatar
1 |
System.out.println("avatar().image():" + faker.avatar().image()); |
ancient
1 2 3 4 |
System.out.println("ancient().god():" + faker.ancient().god()); System.out.println("ancient().hero():" + faker.ancient().hero()); System.out.println("ancient().primordial():" + faker.ancient().primordial()); System.out.println("ancient().titan():" + faker.ancient().titan()); |
ancient().hero():Briseis
ancient().primordial():Nesoi
ancient().titan():Themis
app
1 2 3 |
System.out.println("app().author():" + faker.app().author()); System.out.println("app().name():" + faker.app().name()); System.out.println("app().version():" + faker.app().version()); |
app().name():Tres-Zap
app().version():0.80
beer
1 2 3 4 5 |
System.out.println("beer().hop():" + faker.beer().hop()); System.out.println("beer().malt():" + faker.beer().malt()); System.out.println("beer().name():" + faker.beer().name()); System.out.println("beer().style():" + faker.beer().style()); System.out.println("beer().yeast():" + faker.beer().yeast()); |
beer().malt():Munich
beer().name():Yeti Imperial Stout
beer().style():Light Lager
beer().yeast():3942 – Belgian Wheat
book
1 2 3 4 |
System.out.println("book().author():" + faker.book().author()); System.out.println("book().genre():" + faker.book().genre()); System.out.println("book().publisher():" + faker.book().publisher()); System.out.println("book().title():" + faker.book().title()); |
book().genre():Essay
book().publisher():Salt Publishing
book().title():The Soldier’s Art
bool
1 |
System.out.println("bool().bool():" + faker.bool().bool()); |
business
1 2 3 |
System.out.println("business().creditCardExpiry():" + faker.business().creditCardExpiry()); System.out.println("business().creditCardNumber():" + faker.business().creditCardNumber()); System.out.println("business().creditCardType():" + faker.business().creditCardType()); |
business().creditCardNumber():1228-1221-1221-1431
business().creditCardType():maestro
cat
1 2 3 |
System.out.println("cat().breed():" + faker.cat().breed()); System.out.println("cat().name():" + faker.cat().name()); System.out.println("cat().registry():" + faker.cat().registry()); |
cat().name():Poppy
cat().registry():American Cat Fanciers Association
chuckNorris
1 |
System.out.println("chuckNorris().fact():" + faker.chuckNorris().fact()); |
code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
System.out.println("code().asin():" + faker.code().asin()); System.out.println("code().ean13():" + faker.code().ean13()); System.out.println("code().ean8():" + faker.code().ean8()); System.out.println("code().gtin13():" + faker.code().gtin13()); System.out.println("code().gtin8():" + faker.code().gtin8()); System.out.println("code().imei():" + faker.code().imei()); System.out.println("code().isbn10():" + faker.code().isbn10()); System.out.println("code().isbn10(true):" + faker.code().isbn10(true)); System.out.println("code().isbn10(false):" + faker.code().isbn10(false)); System.out.println("code().isbn13():" + faker.code().isbn13()); System.out.println("code().isbn13(true):" + faker.code().isbn13(true)); System.out.println("code().isbn13(false):" + faker.code().isbn13(false)); System.out.println("code().isbnGroup():" + faker.code().isbnGroup()); System.out.println("code().isbnGs1():" + faker.code().isbnGs1()); System.out.println("code().isbnRegistrant():" + faker.code().isbnRegistrant()); |
code().ean13():2275272961108
code().ean8():92938618
code().gtin13():0904670043087
code().gtin8():30111387
code().imei():495687015153576
code().isbn10():1933612347
code().isbn10(true):1-937290-15-8
code().isbn10(false):1284007057
code().isbn13():9781039601635
code().isbn13(true):978-1-17-286188-0
code().isbn13(false):9780964746619
code().isbnGroup():1
code().isbnGs1():978
code().isbnRegistrant():921317-06
color
1 |
System.out.println("color().name():" + faker.color().name()); |
commerce
1 2 3 4 5 6 7 8 |
System.out.println("commerce().color():" + faker.commerce().color()); System.out.println("commerce().department():" + faker.commerce().department()); System.out.println("commerce().material():" + faker.commerce().material()); System.out.println("commerce().price():" + faker.commerce().price()); System.out.println("commerce().price(1100):" + faker.commerce().price(1, 100)); System.out.println("commerce().productName():" + faker.commerce().productName()); System.out.println("commerce().promotionCode():" + faker.commerce().promotionCode()); System.out.println("commerce().promotionCode(10):" + faker.commerce().promotionCode(10)); |
commerce().department():Industrial
commerce().material():Wooden
commerce().price():90.50
commerce().price(1100):10.60
commerce().productName():Lightweight Aluminum Plate
commerce().promotionCode():StellarPromotion720625
commerce().promotionCode(10):CoolPromotion3571144962
company
1 2 3 4 5 6 7 8 9 |
System.out.println("company().bs():" + faker.company().bs()); System.out.println("company().buzzword():" + faker.company().buzzword()); System.out.println("company().catchPhrase():" + faker.company().catchPhrase()); System.out.println("company().industry():" + faker.company().industry()); System.out.println("company().logo():" + faker.company().logo()); System.out.println("company().name():" + faker.company().name()); System.out.println("company().profession():" + faker.company().profession()); System.out.println("company().suffix():" + faker.company().suffix()); System.out.println("company().url():" + faker.company().url()); |
company().buzzword():maximized
company().catchPhrase():Polarised maximized moratorium
company().industry():Defense & Space
company().logo():https://pigment.github.io/fake-logos/logos/medium/color/8.png
company().name():合同会社柴田通信
company().profession():judge
company().suffix():株式会社
company().url():www.xn--ehquz469an0i25ep1bivze4h.name
crypto
1 2 3 4 |
System.out.println("crypto().md5():" + faker.crypto().md5()); System.out.println("crypto().sha1():" + faker.crypto().sha1()); System.out.println("crypto().sha256():" + faker.crypto().sha256()); System.out.println("crypto().sha512():" + faker.crypto().sha512()); |
crypto().sha1():68fe9ec99d3ab12278d739f069e99daaadd765d5
crypto().sha256():328763c6eac985b7d63c1dd9e8f3f29db749355f5a350240c636f0d95243dfc5
crypto().sha512():f824e79504fce1ee01b42fe95414edca6b6d88c01dea6c3a94de145d3459f1630339e50beed79e04037a7b854051616a56a73e938a483f79f7901d55227e7a47
currency
1 2 |
System.out.println("currency().code():" + faker.currency().code()); System.out.println("currency().name():" + faker.currency().name()); |
currency().name():CFA Franc BEAC
date
1 2 3 4 5 |
System.out.println("date().between(new Date()new Date()).toString():" + faker.date().between(new Date(), new Date()).toString()); System.out.println("date().birthday().toString():" + faker.date().birthday().toString()); System.out.println("date().birthday(2030).toString():" + faker.date().birthday(20, 30).toString()); System.out.println("date().future(10TimeUnit.DAYS).toString():" + faker.date().future(10, TimeUnit.DAYS).toString()); System.out.println("date().past(10TimeUnit.DAYS).toString():" + faker.date().past(10, TimeUnit.DAYS).toString()); |
date().birthday().toString():Tue May 17 06:08:15 JST 1983
date().birthday(2030).toString():Tue Aug 06 23:34:39 JST 1996
date().future(10TimeUnit.DAYS).toString():Sun Mar 31 17:57:47 JST 2019
date().past(10TimeUnit.DAYS).toString():Mon Mar 25 02:04:35 JST 2019
demographic
1 2 3 4 5 |
System.out.println("demographic().demonym():" + faker.demographic().demonym()); System.out.println("demographic().educationalAttainment():" + faker.demographic().educationalAttainment()); System.out.println("demographic().maritalStatus():" + faker.demographic().maritalStatus()); System.out.println("demographic().race():" + faker.demographic().race()); System.out.println("demographic().sex():" + faker.demographic().sex()); |
demographic().educationalAttainment():Bachelor’s degree
demographic().maritalStatus():Divorced
demographic().race():Native Hawaiian or Other Pacific Islander
demographic().sex():Male
dog
1 2 3 4 5 6 7 8 |
System.out.println("dog().age():" + faker.dog().age()); System.out.println("dog().breed():" + faker.dog().breed()); System.out.println("dog().coatLength():" + faker.dog().coatLength()); System.out.println("dog().gender():" + faker.dog().gender()); System.out.println("dog().memePhrase():" + faker.dog().memePhrase()); System.out.println("dog().name():" + faker.dog().name()); System.out.println("dog().size():" + faker.dog().size()); System.out.println("dog().sound():" + faker.dog().sound()); |
dog().breed():Samoyed
dog().coatLength():wire
dog().gender():female
dog().memePhrase():big ol’ pupper
dog().name():Ruby
dog().size():extra large
dog().sound():ruff
dragonBall
1 |
System.out.println("dragonBall().character():" + faker.dragonBall().character()); |
ドラゴンボールのキャラは、残念ながら日本語対応していません…
聞いたことないキャラ名も結構でてきます。
educator
1 2 |
System.out.println("educator().campus():" + faker.educator().campus()); System.out.println("educator().course():" + faker.educator().course()); |
educator().course():Associate Degree in Health Science
esports
1 2 3 4 5 |
System.out.println("esports().event():" + faker.esports().event()); System.out.println("esports().game():" + faker.esports().game()); System.out.println("esports().league():" + faker.esports().league()); System.out.println("esports().player():" + faker.esports().player()); System.out.println("esports().team():" + faker.esports().team()); |
esports().game():Overwatch
esports().league():IEM
esports().player():pasha
esports().team():NaVi
file
1 2 3 |
System.out.println("file().extension():" + faker.file().extension()); System.out.println("file().fileName():" + faker.file().fileName()); System.out.println("file().mimeType():" + faker.file().mimeType()); |
file().fileName():aut_itaque\quo.wav
file().mimeType():message/imdn+xml
finance
1 2 3 4 |
System.out.println("finance().bic():" + faker.finance().bic()); System.out.println("finance().creditCard():" + faker.finance().creditCard()); System.out.println("finance().creditCard(CreditCardType.VISA):" + faker.finance().creditCard(CreditCardType.VISA)); System.out.println("finance().iban():" + faker.finance().iban()); |
finance().creditCard():6011-6107-4573-3816
finance().creditCard(CreditCardType.VISA):4653-5018-4917-2266
finance().iban():HR1558031216978368324
food
1 2 3 |
System.out.println("food().ingredient():" + faker.food().ingredient()); System.out.println("food().measurement():" + faker.food().measurement()); System.out.println("food().spice():" + faker.food().spice()); |
food().measurement():1 gallon
food().spice():Biryani Spice Mix
friends
1 2 3 |
System.out.println("friends().character():" + faker.friends().character()); System.out.println("friends().location():" + faker.friends().location()); System.out.println("friends().quote():" + faker.friends().quote()); |
friends().location():Ralph Lauren
friends().quote():It was summer… and it was hot. Rachel was there… A lonely grey couch…”OH LOOK!” cried Ned, and then the kingdom was his forever. The End.
funnyName
1 |
System.out.println("funnyName().name():" + faker.funnyName().name()); |
gameOfThrones
1 2 3 4 5 |
System.out.println("gameOfThrones().character():" + faker.gameOfThrones().character()); System.out.println("gameOfThrones().city():" + faker.gameOfThrones().city()); System.out.println("gameOfThrones().dragon():" + faker.gameOfThrones().dragon()); System.out.println("gameOfThrones().house():" + faker.gameOfThrones().house()); System.out.println("gameOfThrones().quote():" + faker.gameOfThrones().quote()); |
gameOfThrones().city():Tolos
gameOfThrones().dragon():Dreamfyre
gameOfThrones().house():Goodbrother of Orkmont
gameOfThrones().quote():The things I do for love.
hacker
1 2 3 4 5 |
System.out.println("hacker().abbreviation():" + faker.hacker().abbreviation()); System.out.println("hacker().adjective():" + faker.hacker().adjective()); System.out.println("hacker().ingverb():" + faker.hacker().ingverb()); System.out.println("hacker().noun():" + faker.hacker().noun()); System.out.println("hacker().verb():" + faker.hacker().verb()); |
hacker().adjective():online
hacker().ingverb():compressing
hacker().noun():hard drive
hacker().verb():override
harryPotter
1 2 3 4 |
System.out.println("harryPotter().book():" + faker.harryPotter().book()); System.out.println("harryPotter().character():" + faker.harryPotter().character()); System.out.println("harryPotter().location():" + faker.harryPotter().location()); System.out.println("harryPotter().quote():" + faker.harryPotter().quote()); |
harryPotter().character():Trevor
harryPotter().location():Diagon Alley
harryPotter().quote():We could all have been killed – or worse, expelled.
hipster
1 |
System.out.println("hipster().word():" + faker.hipster().word()); |
hitchhikersGuideToTheGalaxy
1 2 3 4 5 6 7 |
System.out.println("hitchhikersGuideToTheGalaxy().character():" + faker.hitchhikersGuideToTheGalaxy().character()); System.out.println("hitchhikersGuideToTheGalaxy().location():" + faker.hitchhikersGuideToTheGalaxy().location()); System.out.println("hitchhikersGuideToTheGalaxy().marvinQuote():" + faker.hitchhikersGuideToTheGalaxy().marvinQuote()); System.out.println("hitchhikersGuideToTheGalaxy().planet():" + faker.hitchhikersGuideToTheGalaxy().planet()); System.out.println("hitchhikersGuideToTheGalaxy().quote():" + faker.hitchhikersGuideToTheGalaxy().quote()); System.out.println("hitchhikersGuideToTheGalaxy().specie():" + faker.hitchhikersGuideToTheGalaxy().specie()); System.out.println("hitchhikersGuideToTheGalaxy().starship():" + faker.hitchhikersGuideToTheGalaxy().starship()); |
hitchhikersGuideToTheGalaxy().location():Café Lou
hitchhikersGuideToTheGalaxy().marvinQuote():Here I am, brain the size of a planet, and they tell me to take you up to the bridge. Call that job satisfaction? ‘Cos I don’t.
hitchhikersGuideToTheGalaxy().planet():Allosimanius Syneca
hitchhikersGuideToTheGalaxy().quote():It’s only half completed, I’m afraid – we haven’t even finished burying the artificial dinosaur skeletons in the crust yet.
hitchhikersGuideToTheGalaxy().specie():Nanites
hitchhikersGuideToTheGalaxy().starship():Billion Year Bunker
hobbit
1 2 3 4 |
System.out.println("hobbit().character():" + faker.hobbit().character()); System.out.println("hobbit().location():" + faker.hobbit().location()); System.out.println("hobbit().quote():" + faker.hobbit().quote()); System.out.println("hobbit().thorinsCompany():" + faker.hobbit().thorinsCompany()); |
hobbit().location():Green Dragon Inn
hobbit().quote():The road goes ever on and on
hobbit().thorinsCompany():Balin
howIMetYourMother
1 2 3 4 |
System.out.println("howIMetYourMother().catchPhrase():" + faker.howIMetYourMother().catchPhrase()); System.out.println("howIMetYourMother().character():" + faker.howIMetYourMother().character()); System.out.println("howIMetYourMother().highFive():" + faker.howIMetYourMother().highFive()); System.out.println("howIMetYourMother().quote():" + faker.howIMetYourMother().quote()); |
howIMetYourMother().character():Lily Aldrin
howIMetYourMother().highFive():Door Five
howIMetYourMother().quote():Revenge fantasies never work out the way you want.
idNumber
1 2 3 4 |
System.out.println("idNumber().invalid():" + faker.idNumber().invalid()); System.out.println("idNumber().invalidSvSeSsn():" + faker.idNumber().invalidSvSeSsn()); System.out.println("idNumber().ssnValid():" + faker.idNumber().ssnValid()); System.out.println("idNumber().validSvSeSsn():" + faker.idNumber().validSvSeSsn()); |
idNumber().invalidSvSeSsn():225692+4274
idNumber().ssnValid():245-57-3973
idNumber().validSvSeSsn():320409-1718
internet
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
System.out.println("internet().avatar():" + faker.internet().avatar()); System.out.println("internet().domainName():" + faker.internet().domainName()); System.out.println("internet().domainSuffix():" + faker.internet().domainSuffix()); System.out.println("internet().domainWord():" + faker.internet().domainWord()); System.out.println("internet().emailAddress():" + faker.internet().emailAddress()); System.out.println("internet().emailAddress(\"hogehoge\"):" + faker.internet().emailAddress("hogehoge")); System.out.println("internet().image():" + faker.internet().image()); System.out.println("internet().image(200, 200, false, \"hoge\"):" + faker.internet().image(200, 200, false, "hoge")); System.out.println("internet().ipV4Address():" + faker.internet().ipV4Address()); System.out.println("internet().ipV4Cidr():" + faker.internet().ipV4Cidr()); System.out.println("internet().ipV6Address():" + faker.internet().ipV6Address()); System.out.println("internet().ipV6Cidr():" + faker.internet().ipV6Cidr()); System.out.println("internet().macAddress():" + faker.internet().macAddress()); System.out.println("internet().macAddress(\"40\"):" + faker.internet().macAddress("40")); System.out.println("internet().password():" + faker.internet().password()); System.out.println("internet().password(8, 16):" + faker.internet().password(8, 16)); System.out.println("internet().password(8, 16, true):" + faker.internet().password(8, 16, true)); System.out.println("internet().password(8, 16, true, true):" + faker.internet().password(8, 16, true, true)); System.out.println("internet().privateIpV4Address():" + faker.internet().privateIpV4Address()); System.out.println("internet().publicIpV4Address():" + faker.internet().publicIpV4Address()); System.out.println("internet().safeEmailAddress():" + faker.internet().safeEmailAddress()); System.out.println("internet().safeEmailAddress(\"fugafuga\"):" + faker.internet().safeEmailAddress("fugafuga")); System.out.println("internet().slug():" + faker.internet().slug()); System.out.println("internet().slug(Arrays.asList(\"aaa, \" + \"bbb, \" + \"ccc\"), \"##\")" + faker.internet().slug(Arrays.asList("aaa", "bbb", "ccc"), "##")); System.out.println("internet().url():" + faker.internet().url()); System.out.println("internet().uuid():" + faker.internet().uuid()); |
internet().domainName():xn--elq416k.net
internet().domainSuffix():co
internet().domainWord():xn--ues438a
internet().emailAddress():大翔.藤原@yahoo.com
internet().emailAddress(“hogehoge”):hogehoge@gmail.com
internet().image():http://lorempixel.com/1366/768/fashion/
internet().image(200, 200, false, “hoge”):http://lorempixel.com/200/200/cats/hoge
internet().ipV4Address():113.6.78.163
internet().ipV4Cidr():180.201.150.65/6
internet().ipV6Address():8d8f:6d8a:7e90:0bd8:2bc9:2554:cff9:f0b5
internet().ipV6Cidr():5330:21f7:c521:8aed:216c:2639:2a16:08d3/16
internet().macAddress():74:b5:c8:69:66:d0
internet().macAddress(“40”):40:3d:b3:03:a0:af
internet().password():oyrgtifau
internet().password(8, 16):4uksf2btc
internet().password(8, 16, true):piNOiQ9oA
internet().password(8, 16, true, true):cd!%KeO*QhK@r
internet().privateIpV4Address():172.30.62.76
internet().publicIpV4Address():79.194.132.160
internet().safeEmailAddress():悠太.石井@example.com
internet().safeEmailAddress(“fugafuga”):fugafuga@example.com
internet().slug():mollitia_quae
internet().slug(Arrays.asList(“aaa, ” + “bbb, ” + “ccc”), “##”)aaa##bbb##ccc
internet().url():www.xn—xn--i8s518j-1n6s.name
internet().uuid():6b993c5d-172c-4419-a88e-780097d95270
job
1 2 3 4 5 |
System.out.println("job().field():" + faker.job().field()); System.out.println("job().keySkills():" + faker.job().keySkills()); System.out.println("job().position():" + faker.job().position()); System.out.println("job().seniority():" + faker.job().seniority()); System.out.println("job().title():" + faker.job().title()); |
job().keySkills():Leadership
job().position():Technician
job().seniority():Central
job().title():Central Orchestrator
leagueOfLegends
1 2 3 4 5 6 |
System.out.println("leagueOfLegends().champion():" + faker.leagueOfLegends().champion()); System.out.println("leagueOfLegends().location():" + faker.leagueOfLegends().location()); System.out.println("leagueOfLegends().masteries():" + faker.leagueOfLegends().masteries()); System.out.println("leagueOfLegends().quote():" + faker.leagueOfLegends().quote()); System.out.println("leagueOfLegends().rank():" + faker.leagueOfLegends().rank()); System.out.println("leagueOfLegends().summonerSpell():" + faker.leagueOfLegends().summonerSpell()); |
leagueOfLegends().location():Demacia
leagueOfLegends().masteries():Greenfather’s Gift
leagueOfLegends().quote():Welcome to the League of Draven.
leagueOfLegends().rank():Diamond I
leagueOfLegends().summonerSpell():Mark
lebowski
1 2 3 |
System.out.println("lebowski().actor():" + faker.lebowski().actor()); System.out.println("lebowski().character():" + faker.lebowski().character()); System.out.println("lebowski().quote():" + faker.lebowski().quote()); |
lebowski().character():The Dude
lebowski().quote():Yeah, well, that’s just, like, your opinion, man.
lordOfTheRings
1 2 |
System.out.println("lordOfTheRings().character():" + faker.lordOfTheRings().character()); System.out.println("lordOfTheRings().location():" + faker.lordOfTheRings().location()); |
lordOfTheRings().location():Gorgoroth
lorem
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
System.out.println("lorem().character():" + String.valueOf(faker.lorem().character())); System.out.println("lorem().character(true):" + String.valueOf(faker.lorem().character(true))); System.out.println("lorem().characters():" + faker.lorem().characters()); System.out.println("lorem().characters(true):" + faker.lorem().characters(true)); System.out.println("lorem().characters(5):" + faker.lorem().characters(5)); System.out.println("lorem().characters(5, true):" + faker.lorem().characters(5, true)); System.out.println("lorem().characters(1, 5):" + faker.lorem().characters(1, 5)); System.out.println("lorem().characters(1, 5, true):" + faker.lorem().characters(1, 5, true)); System.out.println("lorem().fixedString(50):" + faker.lorem().fixedString(50)); System.out.println("lorem().paragraph():" + faker.lorem().paragraph()); System.out.println("lorem().paragraph(5):" + faker.lorem().paragraph(5)); System.out.println("lorem().paragraphs(5):" + String.join(", ", faker.lorem().paragraphs(5))); System.out.println("lorem().sentence():" + faker.lorem().sentence()); System.out.println("lorem().sentence(5):" + faker.lorem().sentence(5)); System.out.println("lorem().sentence(5, 10):" + faker.lorem().sentence(5, 10)); System.out.println("lorem().sentences(10):" + String.join(", ", faker.lorem().sentences(10))); System.out.println("lorem().word():" + faker.lorem().word()); System.out.println("lorem().words():" + String.join(", ", faker.lorem().words())); System.out.println("lorem().words(10):" + String.join(", ", faker.lorem().words(10))); |
lorem().character(true):h
lorem().characters():4eerzc8vwstfdcdxqaa84sfu2e6dbx0za5ze3in6q5a84ilv2qb9vaojbb4a29s472aulyso4xm2xutm8y0t3wrizgwv8656a6bjjvo921tadksdvqqro9uidnsfcao25178hg71ow44mc40fj89nc238rmfnbth3t06m3hgibevcyfb7hjwvz2eedlbp77mg9857eyn4c3kqpq6x3mjpsox28pmp7f482fwryloz68b93o60tk0lcqikgv1n7h
lorem().characters(true):dryvkjwvl9ak38zjagoss27p03qm01rp5hwux66g1zivtc4xhlj3et51nt6aygrzumlbq9lc4iqto9rj9f6brxya71mog2rq6a0jogxrukdjee5tpeyfnfevwrgm9fn831293atw7ybs9rsjy2ejyettyvs2miy37v2lijr0415019hom7vorer865p8r82r1goju02jzzqn7sw57pgtahjc3lv2k8pm9cpz6hd86i3avvha746e9pvlgvbywjc
lorem().characters(5):mfbw2
lorem().characters(5, true):4AW79
lorem().characters(1, 5):vgl8
lorem().characters(1, 5, true):Upcw
lorem().fixedString(50):Et consequatur architecto.Veniam non omnis quaerat
lorem().paragraph():Blanditiis et mollitia nihil itaque natus ut. Qui nulla consequatur est consequatur quos. Non recusandae eum. Voluptatem quia deserunt ea iure asperiores molestiae eum. Et iusto alias laboriosam dolorem consequatur hic ratione.
lorem().paragraph(5):Sint est molestiae nihil. Ut omnis cupiditate velit velit voluptatem. Est est itaque non doloremque quia. Dolorem assumenda sit qui. Ab quas fuga.
lorem().paragraphs(5):Dolores sed nobis temporibus molestiae dolor ipsa deleniti. Accusantium qui dolores praesentium maiores. Autem id dicta aliquam eligendi aliquid et autem. Maiores harum quam et et occaecati aperiam qui., Assumenda in consequuntur sequi dolorem dolorem iste rerum. Omnis soluta qui voluptates mollitia sed sapiente nemo. Illum incidunt enim officiis soluta possimus consequuntur., Possimus libero modi ducimus. Iusto vel dolorum voluptate temporibus ut dolorem excepturi. Natus est ipsam commodi repellat dolor., Molestiae quisquam dolores natus neque rerum. Dolore non adipisci nihil minima quam. Cupiditate non voluptas fugiat. Debitis quo nobis dignissimos porro velit deleniti aut. Fugiat itaque repellendus iure quas., Repellat quia non soluta placeat maxime aut. Sit pariatur perferendis. Sunt harum alias aut perferendis perferendis id. Aut totam et mollitia sint et cupiditate.
lorem().sentence():Dolores libero voluptatem deleniti rerum nulla.
lorem().sentence(5):Omnis id dignissimos maxime et aut iusto numquam.
lorem().sentence(5, 10):Architecto itaque quisquam voluptates et eum ut perferendis veniam laudantium quae aut tempore.
lorem().sentences(10):Facere quas velit et aut aperiam eum., Quo voluptates molestiae., Qui aut provident., Voluptatem commodi ipsum ipsa magnam incidunt quia eos., Sit delectus veniam., Aut enim similique cum., Maxime corrupti nisi officia accusamus praesentium., Porro quae rerum dolor vel ipsa et., Dolore repellat enim aspernatur., Ratione doloremque adipisci doloremque repellendus.
lorem().word():quo
lorem().words():animi, suscipit, numquam
lorem().words(10):perspiciatis, ratione, iure, delectus, minima, sed, sed, beatae, sed, eos
matz
1 |
System.out.println("matz().quote():" + faker.matz().quote()); |
music
1 2 3 |
System.out.println("music().chord():" + faker.music().chord()); System.out.println("music().instrument():" + faker.music().instrument()); System.out.println("music().key():" + faker.music().key()); |
music().instrument():Piano
music().key():Eb
name
1 2 3 4 5 6 7 8 9 |
System.out.println("name().name():" + faker.name().name()); System.out.println("name().fullName():" + faker.name().fullName()); System.out.println("name().firstName():" + faker.name().firstName()); System.out.println("name().lastName():" + faker.name().lastName()); System.out.println("name().username():" + faker.name().username()); System.out.println("name().nameWithMiddle():" + faker.name().nameWithMiddle()); System.out.println("name().title():" + faker.name().title()); System.out.println("name().prefix():" + faker.name().prefix()); System.out.println("name().suffix():" + faker.name().suffix()); |
name().fullName():山下 誠
name().firstName():恵
name().lastName():吉田
name().username():瑛太.加藤
name().nameWithMiddle():大地 大地 竹内
name().title():Customer Integration Supervisor
name().prefix():Miss
name().suffix():PhD
number
1 2 3 4 5 6 7 8 9 |
System.out.println("number().digit():" + faker.number().digit()); System.out.println("number().digits(10):" + faker.number().digits(10)); System.out.println("number().numberBetween(10, 30):" + String.valueOf(faker.number().numberBetween(10, 30))); System.out.println("number().numberBetween(10000000000000L, 10000000000100L):" + String.valueOf(faker.number().numberBetween(10000000000000L, 10000000000100L))); System.out.println("number().randomDigit():" + String.valueOf(faker.number().randomDigit())); System.out.println("number().randomDigitNotZero():" + String.valueOf(faker.number().randomDigitNotZero())); System.out.println("number().randomDouble(2, 5, 10):" + String.valueOf(faker.number().randomDouble(2, 5, 10))); System.out.println("number().randomNumber():" + String.valueOf(faker.number().randomNumber())); System.out.println("number().randomNumber(10, true):" + String.valueOf(faker.number().randomNumber(10, true))); |
number().digits(10):1004932191
number().numberBetween(10, 30):17
number().numberBetween(10000000000000L, 10000000000100L):10000000000074
number().randomDigit():6
number().randomDigitNotZero():7
number().randomDouble(2, 5, 10):6.18
number().randomNumber():40899668
number().randomNumber(10, true):2136815540
options
1 |
System.out.println("options().nextElement(new String[] {\"aa\", \"bb\"}):" + faker.options().nextElement(new String[] { "aa", "bb" })); |
overwatch
1 2 3 |
System.out.println("overwatch().hero():" + faker.overwatch().hero()); System.out.println("overwatch().location():" + faker.overwatch().location()); System.out.println("overwatch().quote():" + faker.overwatch().quote()); |
overwatch().location():Ecopoint: Antarctica
overwatch().quote():Hammer Down!
phoneNumber
1 2 |
System.out.println("phoneNumber().cellPhone():" + faker.phoneNumber().cellPhone()); System.out.println("phoneNumber().phoneNumber():" + faker.phoneNumber().phoneNumber()); |
phoneNumber().phoneNumber():0326-82-9171
pokemon
1 2 |
System.out.println("pokemon().location():" + faker.pokemon().location()); System.out.println("pokemon().name():" + faker.pokemon().name()); |
pokemon().name():マルマイン
rickAndMorty
1 2 3 |
System.out.println("rickAndMorty().character():" + faker.rickAndMorty().character()); System.out.println("rickAndMorty().location():" + faker.rickAndMorty().location()); System.out.println("rickAndMorty().quote():" + faker.rickAndMorty().quote()); |
rickAndMorty().location():Dwarf Terrace-9
rickAndMorty().quote():Oh, I’m sorry Morty, are you the scientist or are you the kid who wanted to get laid?
robin
1 |
System.out.println("robin().quote():" + faker.robin().quote()); |
rockBand
1 |
System.out.println("rockBand().name():" + faker.rockBand().name()); |
shakespeare
1 2 3 4 |
System.out.println("shakespeare().asYouLikeItQuote():" + faker.shakespeare().asYouLikeItQuote()); System.out.println("shakespeare().hamletQuote():" + faker.shakespeare().hamletQuote()); System.out.println("shakespeare().kingRichardIIIQuote():" + faker.shakespeare().kingRichardIIIQuote()); System.out.println("shakespeare().romeoAndJulietQuote():" + faker.shakespeare().romeoAndJulietQuote()); |
shakespeare().hamletQuote():Neither a borrower nor a lender be; For loan oft loses both itself and friend, and borrowing dulls the edge of husbandry.
shakespeare().kingRichardIIIQuote():So wise so young, they say, do never live long.
shakespeare().romeoAndJulietQuote():Good Night, Good night! Parting is such sweet sorrow, that I shall say good night till it be morrow.
slackEmoji
1 2 3 4 5 6 7 8 9 |
System.out.println("slackEmoji().activity():" + faker.slackEmoji().activity()); System.out.println("slackEmoji().celebration():" + faker.slackEmoji().celebration()); System.out.println("slackEmoji().custom():" + faker.slackEmoji().custom()); System.out.println("slackEmoji().emoji():" + faker.slackEmoji().emoji()); System.out.println("slackEmoji().foodAndDrink():" + faker.slackEmoji().foodAndDrink()); System.out.println("slackEmoji().nature():" + faker.slackEmoji().nature()); System.out.println("slackEmoji().objectsAndSymbols():" + faker.slackEmoji().objectsAndSymbols()); System.out.println("slackEmoji().people():" + faker.slackEmoji().people()); System.out.println("slackEmoji().travelAndPlaces():" + faker.slackEmoji().travelAndPlaces()); |
slackEmoji().celebration()::dizzy:
slackEmoji().custom()::rage3:
slackEmoji().emoji()::sushi:
slackEmoji().foodAndDrink()::grapes:
slackEmoji().nature()::turtle:
slackEmoji().objectsAndSymbols()::fax:
slackEmoji().people()::shit:
slackEmoji().travelAndPlaces()::tokyo_tower:
space
1 2 3 4 5 6 7 8 9 10 11 12 13 |
System.out.println("space().agency():" + faker.space().agency()); System.out.println("space().agencyAbbreviation():" + faker.space().agencyAbbreviation()); System.out.println("space().company():" + faker.space().company()); System.out.println("space().constellation():" + faker.space().constellation()); System.out.println("space().distanceMeasurement():" + faker.space().distanceMeasurement()); System.out.println("space().galaxy():" + faker.space().galaxy()); System.out.println("space().meteorite():" + faker.space().meteorite()); System.out.println("space().moon():" + faker.space().moon()); System.out.println("space().nasaSpaceCraft():" + faker.space().nasaSpaceCraft()); System.out.println("space().nebula():" + faker.space().nebula()); System.out.println("space().planet():" + faker.space().planet()); System.out.println("space().star():" + faker.space().star()); System.out.println("space().starCluster():" + faker.space().starCluster()); |
space().agencyAbbreviation():ISRO
space().company():Virgin Galactic
space().constellation():Aquarius
space().distanceMeasurement():53megaparsecs
space().galaxy():Milky Way
space().meteorite():Kaidun
space().moon():Phobos
space().nasaSpaceCraft():Enterprise
space().nebula():Ring Nebula
space().planet():Uranus
space().star():Sirius A
space().starCluster():Koposov I
starTrek
1 2 3 4 |
System.out.println("starTrek().character():" + faker.starTrek().character()); System.out.println("starTrek().location():" + faker.starTrek().location()); System.out.println("starTrek().specie():" + faker.starTrek().specie()); System.out.println("starTrek().villain():" + faker.starTrek().villain()); |
starTrek().location():Delta Quadrant
starTrek().specie():El-Aurian
starTrek().villain():Borg Queen
stock
1 2 |
System.out.println("stock().nsdqSymbol():" + faker.stock().nsdqSymbol()); System.out.println("stock().nyseSymbol():" + faker.stock().nyseSymbol()); |
stock().nyseSymbol():ZBH
superhero
1 2 3 4 5 |
System.out.println("superhero().descriptor():" + faker.superhero().descriptor()); System.out.println("superhero().name():" + faker.superhero().name()); System.out.println("superhero().power():" + faker.superhero().power()); System.out.println("superhero().prefix():" + faker.superhero().prefix()); System.out.println("superhero().suffix():" + faker.superhero().suffix()); |
superhero().name():Blizzard
superhero().power():Energy Manipulation
superhero().prefix():Ultra
superhero().suffix():Brain
team
1 2 3 4 |
System.out.println("team().creature():" + faker.team().creature()); System.out.println("team().name():" + faker.team().name()); System.out.println("team().sport():" + faker.team().sport()); System.out.println("team().state():" + faker.team().state()); |
team().name():千葉県 giants
team().sport():football
team().state():大分県
twinPeaks
1 2 3 |
System.out.println("twinPeaks().character():" + faker.twinPeaks().character()); System.out.println("twinPeaks().location():" + faker.twinPeaks().location()); System.out.println("twinPeaks().quote():" + faker.twinPeaks().quote()); |
twinPeaks().location():Timber Falls Motel
twinPeaks().quote():Black as midnight on a moonless night.
university
1 2 3 |
System.out.println("university().name():" + faker.university().name()); System.out.println("university().prefix():" + faker.university().prefix()); System.out.println("university().suffix():" + faker.university().suffix()); |
university().prefix():九州
university().suffix():芸術大学
weather
1 2 3 4 5 |
System.out.println("weather().description():" + faker.weather().description()); System.out.println("weather().temperatureCelsius():" + faker.weather().temperatureCelsius()); System.out.println("weather().temperatureCelsius(1, 5):" + faker.weather().temperatureCelsius(1, 5)); System.out.println("weather().temperatureFahrenheit():" + faker.weather().temperatureFahrenheit()); System.out.println("weather().temperatureFahrenheit(1, 5):" + faker.weather().temperatureFahrenheit(1, 5)); |
weather().temperatureCelsius():32°C
weather().temperatureCelsius(1, 5):2°C
weather().temperatureFahrenheit():43°F
weather().temperatureFahrenheit(1, 5):5°F
witcher
1 2 3 4 5 |
System.out.println("witcher().character():" + faker.witcher().character()); System.out.println("witcher().location():" + faker.witcher().location()); System.out.println("witcher().monster():" + faker.witcher().monster()); System.out.println("witcher().quote():" + faker.witcher().quote()); System.out.println("witcher().school():" + faker.witcher().school()); |
witcher().location():Tegamo
witcher().monster():Pale Widow
witcher().quote():You get what you get and be happy with it
witcher().school():Manticore
yoda
1 |
System.out.println("yoda().quote():" + faker.yoda().quote()); |
zelda
1 2 |
System.out.println("zelda().character():" + faker.zelda().character()); System.out.println("zelda().game():" + faker.zelda().game()); |
zelda().game():Phantom Hourglass
以上で解説は終了です。
☆☆ウィズテクノロジーでは、大阪、東京を中心としたシステム開発を行っております
システムのご相談はもとより、一緒に働くエンジニアもお待ちしております。☆☆