-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b48f897
commit 2fad8ee
Showing
2 changed files
with
45 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
sandbox-stock/src/main/java/com/platform/utils/FakerTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package com.platform.utils; | ||
|
||
import com.github.javafaker.Faker; | ||
|
||
import java.util.Locale; | ||
|
||
public class FakerTest { | ||
|
||
public static void main(String[] args) { | ||
|
||
|
||
// Locale.CHINA | ||
// new Locale("zh", "CN") | ||
Faker faker = new Faker(Locale.CHINA); | ||
|
||
for (int i = 0; i < 1; i++) { | ||
|
||
// 用户名称 | ||
String username = faker.name().fullName(); | ||
System.out.println("username " + username); | ||
// 随机数 | ||
Integer num = faker.random().nextInt(10, 1000); | ||
System.out.println("num " + num); | ||
// 地址 | ||
String address = faker.address().fullAddress(); | ||
System.out.println("address " + address); | ||
// 邮箱 | ||
String email = faker.internet().emailAddress(String.valueOf(num)); | ||
System.out.println("email " + email); | ||
// 手机号 | ||
String cellphone = faker.phoneNumber().phoneNumber(); | ||
System.out.println("cellphone " + cellphone); | ||
// 日期 | ||
String birthday = faker.date().birthday().toString(); | ||
System.out.println("birthday " + birthday); | ||
// System.out.println(s); | ||
|
||
} | ||
|
||
|
||
|
||
} | ||
} |