diff --git a/src/main/java/net/datafaker/internal/helper/CopyOnWriteMap.java b/src/main/java/net/datafaker/internal/helper/CopyOnWriteMap.java index fc5e69896..692e8dbbd 100644 --- a/src/main/java/net/datafaker/internal/helper/CopyOnWriteMap.java +++ b/src/main/java/net/datafaker/internal/helper/CopyOnWriteMap.java @@ -6,13 +6,13 @@ import java.util.function.Supplier; /** - * This is a Copy On Write map. The main idea behind is that - * there is lots of static info per provider to make this provider working. - * At the same time there is no need to load all this info at start since + * This is a Copy On Write map. The main idea behind this is that + * there is lots of static info per provider to make the providers operate. + * At the same time there is no need to load all the info at the start since * we don't know which providers will be used and loading for all takes time. - * For that reason it is loaded on request and stores in these Copy On Write maps. + * For that reason it is loaded on request and stored in these Copy On Write maps. * Since it is loaded only once per provider and after that is only read then - * it should be ok and moreover it will allow to have non blocking reads. + * it should be ok and moreover it will allow to have non-blocking reads. * * In case for whatever reason there is a need to change this class, * please double check jmh report before and after e.g. diff --git a/src/main/java/net/datafaker/providers/base/TimeAndDate.java b/src/main/java/net/datafaker/providers/base/TimeAndDate.java index 989bf24c5..30a768947 100644 --- a/src/main/java/net/datafaker/providers/base/TimeAndDate.java +++ b/src/main/java/net/datafaker/providers/base/TimeAndDate.java @@ -21,8 +21,8 @@ */ public class TimeAndDate extends AbstractProvider { - private static final int DEFAULT_MIN_AGE = 18; - private static final int DEFAULT_MAX_AGE = 65; + public static final int DEFAULT_MIN_AGE = 18; + public static final int DEFAULT_MAX_AGE = 65; protected TimeAndDate(BaseProviders faker) { super(faker); @@ -329,7 +329,7 @@ public Period period(Period min, Period max) { faker.random().nextInt(min.getDays(), max.getDays())); } - private String formatInstant(TemporalAccessor instant, String pattern) { + private static String formatInstant(TemporalAccessor instant, String pattern) { DateTimeFormatter formatter = DateTimeFormatter.ofPattern(pattern) .withZone(ZoneId.systemDefault()); diff --git a/src/test/java/net/datafaker/providers/base/TimeAndDateTest.java b/src/test/java/net/datafaker/providers/base/TimeAndDateTest.java index 0358728a1..568872623 100644 --- a/src/test/java/net/datafaker/providers/base/TimeAndDateTest.java +++ b/src/test/java/net/datafaker/providers/base/TimeAndDateTest.java @@ -107,8 +107,8 @@ void testBetweenThenLargerThanNow() { @RepeatedTest(100) void testBirthday() { final LocalDateTime now = LocalDateTime.now(); - final LocalDate from = now.minusYears(18).toLocalDate(); - final LocalDate to = now.minusYears(65).toLocalDate(); + final LocalDate from = now.minusYears(TimeAndDate.DEFAULT_MIN_AGE).toLocalDate(); + final LocalDate to = now.minusYears(TimeAndDate.DEFAULT_MAX_AGE).toLocalDate(); LocalDate birthday = timeAndDate.birthday(); assertThat(birthday).isBetween(to, from); }