Skip to content

Commit

Permalink
Improve faker example
Browse files Browse the repository at this point in the history
Javafaker is no longer supported
there is datafaker https://github.com/datafaker-net/datafaker which is a fork of javafaker and has many more featured which are not merged to javafaker
  • Loading branch information
snuyanzin committed Sep 10, 2022
1 parent d784964 commit 0531a9d
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions README.adoc
Expand Up @@ -3615,12 +3615,12 @@ public class Day094 {
}
----

== Day 95 - Using Java-faker to create fake data for testing.
== Day 95 - Using Datafaker to create fake data for testing.
[source,java]
----
package com.thegreatapi.ahundreddaysofjava.day095;
import com.github.javafaker.Faker;
import net.datafaker.Faker;
import java.util.Date;
import java.util.List;
Expand All @@ -3647,6 +3647,10 @@ public class Day095 {
// Person[firstName=Cristie, lastName=Yundt, dateOfBirth=Thu Sep 04 05:28:06 BRT 1980]
// Person[firstName=Brynn, lastName=Tremblay, dateOfBirth=Thu Nov 03 10:28:57 BRST 1988]
// Person[firstName=Ahmad, lastName=Homenick, dateOfBirth=Tue Apr 19 15:46:28 BRT 1977]
// or another way to do the same
people = FAKER.<Person>collection().suppliers(Day095::createPerson).len(10).generate();
people.forEach(System.out::println);
}
private static Person createPerson() {
Expand Down Expand Up @@ -3929,4 +3933,4 @@ public class Day100 {
Benchmark Mode Cnt Score Error Units
Day100.benchmarkNullable thrpt 25 44.593 ± 1.567 ops/s
Day100.benchmarkOptional thrpt 25 44.272 ± 1.001 ops/s
----
----

0 comments on commit 0531a9d

Please sign in to comment.