public class Main {
public static void main(String[] args) {
DataFactory df = new DataFactory();
for (int i = 0; i < 100; i++) {
String name = df.getFirstName() + " "+ df.getLastName();
System.out.println(name);
}
}
}
Output :
Lindsey Craft
Erica Larsen
Ryan Levine
Erika Smith
Brooklyn Sloan
Karen Mayer
Eddie O'neill
Nancy Stevens
发布评论
评论(4)
尝试 jFairy。这是处于早期阶段的新项目。
附言。我是一个贡献者。
Try jFairy. This is new project in early stage.
PS. I'm a contributor.
http://www.andygibson.net/blog/article/生成测试数据与数据工厂/
如何使用:
将其添加到您的
pom.xml
测试它...
输出:
http://www.andygibson.net/blog/article/generate-test-data-with-datafactory/
How to use:
Add it in your
pom.xml
Test it...
Output :
Perl Data::Faker 有一个 Java 端口 - java-faker
There is a Java port of the Perl Data::Faker - java-faker
如果您使用 Hibernate,请尝试 HibernateMock。
另:
ThinkUI
Benerator
If you're using Hibernate, try HibernateMock.
Also:
ThinkUI
Benerator