Skip to content

Commit

Permalink
faker
Browse files Browse the repository at this point in the history
  • Loading branch information
thedestiny committed May 26, 2024
1 parent b48f897 commit 2fad8ee
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 10 deletions.
12 changes: 2 additions & 10 deletions sandbox-stock/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>easyexcel</artifactId>
<version>3.3.2</version>
<version>3.3.4</version>
</dependency>

<!-- commons-upload -->
Expand All @@ -36,14 +36,6 @@
</dependency>

<!-- commons-io -->
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.4</version>
</dependency>



<dependency>
<groupId>com.alibaba</groupId>
<artifactId>easyexcel-core</artifactId>
Expand Down Expand Up @@ -95,7 +87,7 @@
<version>5.4.1</version>
</dependency>


<!-- commons-io -->
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
Expand Down
43 changes: 43 additions & 0 deletions sandbox-stock/src/main/java/com/platform/utils/FakerTest.java
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);

}



}
}

0 comments on commit 2fad8ee

Please sign in to comment.