Class Generators
- java.lang.Object
-
- de.skuzzle.test.snapshots.normalize.Generators
-
@API(status=EXPERIMENTAL) public final class Generators extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description static java.util.regex.PatternUUID
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.util.function.Function<java.lang.Integer,java.lang.String>constant(java.lang.String replacement)Generator that produces only the given constant replacement.static java.util.function.Function<java.lang.Integer,java.lang.String>dateLike(java.time.format.DateTimeFormatter formatter, java.time.temporal.ChronoUnit stepWidth)A generator that produces deterministic date strings from a counter.static java.util.function.Function<java.lang.Integer,java.time.ZonedDateTime>dateLike(java.time.temporal.ChronoUnit stepWidth)A generator that produces deterministic dates from a counter.static java.util.function.Function<java.lang.Integer,java.lang.String>deterministicUUID()Generator that produces deterministic UUIDs from a counter.
-
-
-
Method Detail
-
constant
public static java.util.function.Function<java.lang.Integer,java.lang.String> constant(java.lang.String replacement)
Generator that produces only the given constant replacement.- Parameters:
replacement- The constant replacement string.- Returns:
- A function that always returns the given constant.
-
deterministicUUID
public static java.util.function.Function<java.lang.Integer,java.lang.String> deterministicUUID()
Generator that produces deterministic UUIDs from a counter.- Returns:
- A function that deterministically creates a UUID from the counter passed to it.
-
dateLike
public static java.util.function.Function<java.lang.Integer,java.time.ZonedDateTime> dateLike(java.time.temporal.ChronoUnit stepWidth)
A generator that produces deterministic dates from a counter. The date will be calculated by addingstepdWidthtimescountermilliseconds to the UTC base date 1970-01-01 00:00.- Parameters:
stepWidth- Defines how to calculate a new date from a counter.- Returns:
- A function that calculates a deterministic date from the counter passed to it.
-
dateLike
public static java.util.function.Function<java.lang.Integer,java.lang.String> dateLike(java.time.format.DateTimeFormatter formatter, java.time.temporal.ChronoUnit stepWidth)A generator that produces deterministic date strings from a counter. The date will be calculated by addingstepdWidthtimescountermilliseconds to the UTC base date 1970-01-01 00:00.- Parameters:
formatter- For formatting the calculated date.stepWidth- Defines how to calculate a new date from a counter.- Returns:
- A function that calculates a deterministic date from the counter passed to it.
-
-