Package org.approvej.scrub
Class Scrubbers
java.lang.Object
org.approvej.scrub.Scrubbers
Collection of static methods to create
Scrubber
instances.-
Method Summary
Modifier and TypeMethodDescriptionstatic DateTimeScrubber
static DateTimeScrubber
dateTimeFormat
(String dateTimePattern) CreatesDateTimeScrubber
to replace date/time strings of the given pattern localized by the defaultLocale
.static DateTimeScrubber
dateTimeFormat
(String dateTimePattern, Locale locale) CreatesDateTimeScrubber
to replace date/time strings of the given pattern localized by the given locale.static DateTimeScrubber
isoDates()
static DateTimeScrubber
Creates aDateTimeScrubber
for ISO-8601 date/times, like2019-02-25T12:34:56
,2019-02-25T12:34:56.123456789
,2019-02-25T12:34:56+02:00
, or2019-02-25T12:34:56.123456789+02:00[Europe/Berlin]
.static DateTimeScrubber
isoDateTimes
(Locale locale) Creates aDateTimeScrubber
for ISO-8601 date/times, like2019-02-25T12:34:56
,2019-02-25T12:34:56.123456789
,2019-02-25T12:34:56+02:00
, or2019-02-25T12:34:56.123456789+02:00[Europe/Berlin]
.static DateTimeScrubber
Creates aDateTimeScrubber
for ISO-8601 instants, like2019-02-25T12:34:56.123456789+02:00
, or2019-02-25T12:34:56.123456789Z
.static DateTimeScrubber
Creates aDateTimeScrubber
for ISO-8601 local dates, like2019-02-25
.static DateTimeScrubber
Creates aDateTimeScrubber
for ISO-8601 local date/times, like12:34:56
,12:34:56+02:00
,12:34:56.123456789
, or12:34:56.123456789+02:00
.static DateTimeScrubber
static DateTimeScrubber
Creates aDateTimeScrubber
for ISO-8601 offset dates, like2019-02-25+02:00
.static DateTimeScrubber
Creates aDateTimeScrubber
for ISO-8601 offset date/times, like2019-02-25T12:34:56+02:00
, or2019-02-25T12:34:56.123456789+02:00
.static DateTimeScrubber
Creates aDateTimeScrubber
for ISO-8601 offset times, like12:34:56+02:00
, or12:34:56.123456789+02:00
.static DateTimeScrubber
static DateTimeScrubber
isoTimes()
Creates aDateTimeScrubber
for ISO-8601 times, like12:34:56
,12:34:56+02:00
,12:34:56.123456789
, or12:34:56.123456789+02:00
.static DateTimeScrubber
static DateTimeScrubber
Creates aDateTimeScrubber
for ISO-8601 zoned date/times, like2019-02-25T12:34:56+02:00
,2019-02-25T12:34:56.123456789+02:00
,2019-02-25T12:34:56+02:00[Europe/Berlin]
, or2019-02-25T12:34:56.123456789+02:00[Europe/Berlin]
.static DateTimeScrubber
isoZonedDateTimes
(Locale locale) Creates aDateTimeScrubber
for ISO-8601 zoned date/times, like2019-02-25T12:34:56+02:00
,2019-02-25T12:34:56.123456789+02:00
,2019-02-25T12:34:56+02:00[Europe/Berlin]
, or2019-02-25T12:34:56.123456789+02:00[Europe/Berlin]
.static DateTimeScrubber
Creates aDateTimeScrubber
for RFC-1123 date/times, likeMon, 35 Feb 2019 12:34:56 GMT
.static RegexScrubber
Creates aRegexScrubber
for all given strings.static RegexScrubber
stringsMatching
(String pattern) Creates aRegexScrubber
with the given pattern.static RegexScrubber
stringsMatching
(Pattern pattern) Creates aRegexScrubber
with the given pattern.static RegexScrubber
uuids()
Creates aRegexScrubber
for UUIDs.
-
Method Details
-
strings
Creates aRegexScrubber
for all given strings.This type of
Scrubber
is particularly useful if dynamic parts of the value are known. E.g. if they were part of the import parameters of the method under test.- Parameters:
first
- the firstString
that should be scrubbedmore
- moreString
s that should be scrubbed- Returns:
- a
RegexScrubber
for all given strings
-
stringsMatching
Creates aRegexScrubber
with the given pattern.- Parameters:
pattern
- thePattern
matching the strings to be scrubbed- Returns:
- a
RegexScrubber
with the given pattern
-
stringsMatching
Creates aRegexScrubber
with the given pattern.- Parameters:
pattern
- the pattern matching the string to be scrubbed asString
- Returns:
- a
RegexScrubber
with the given pattern - See Also:
-
dateTimeFormat
CreatesDateTimeScrubber
to replace date/time strings of the given pattern localized by the given locale.- Parameters:
dateTimePattern
- a pattern as defined byDateTimeFormatter
locale
- theLocale
to localize the date/time pattern (influences names of months or weekdays for example)- Returns:
- a
DateTimeScrubber
for the given date/time pattern - See Also:
-
dateTimeFormat
CreatesDateTimeScrubber
to replace date/time strings of the given pattern localized by the defaultLocale
.- Parameters:
dateTimePattern
- a pattern as defined byDateTimeFormatter
- Returns:
- a
DateTimeScrubber
for the given date/time pattern - See Also:
-
isoLocalDates
Creates aDateTimeScrubber
for ISO-8601 local dates, like2019-02-25
.- Returns:
- a
DateTimeScrubber
for ISO-8601 local dates - See Also:
-
isoOffsetDates
Creates aDateTimeScrubber
for ISO-8601 offset dates, like2019-02-25+02:00
.- Returns:
- a
DateTimeScrubber
for ISO-8601 offset dates - See Also:
-
isoDates
- Returns:
- a
DateTimeScrubber
for ISO-8601 dates - See Also:
-
isoLocalTimes
- Returns:
- a
DateTimeScrubber
for ISO-8601 local times - See Also:
-
isoOffsetTimes
Creates aDateTimeScrubber
for ISO-8601 offset times, like12:34:56+02:00
, or12:34:56.123456789+02:00
.- Returns:
- a
DateTimeScrubber
for ISO-8601 offset times - See Also:
-
isoTimes
Creates aDateTimeScrubber
for ISO-8601 times, like12:34:56
,12:34:56+02:00
,12:34:56.123456789
, or12:34:56.123456789+02:00
.- Returns:
- a
DateTimeScrubber
for ISO-8601 times - See Also:
-
isoLocalDateTimes
Creates aDateTimeScrubber
for ISO-8601 local date/times, like12:34:56
,12:34:56+02:00
,12:34:56.123456789
, or12:34:56.123456789+02:00
.- Returns:
- a
DateTimeScrubber
for ISO-8601 local date/times - See Also:
-
isoOffsetDateTimes
Creates aDateTimeScrubber
for ISO-8601 offset date/times, like2019-02-25T12:34:56+02:00
, or2019-02-25T12:34:56.123456789+02:00
.- Returns:
- a
DateTimeScrubber
for ISO-8601 offset date/times - See Also:
-
isoZonedDateTimes
Creates aDateTimeScrubber
for ISO-8601 zoned date/times, like2019-02-25T12:34:56+02:00
,2019-02-25T12:34:56.123456789+02:00
,2019-02-25T12:34:56+02:00[Europe/Berlin]
, or2019-02-25T12:34:56.123456789+02:00[Europe/Berlin]
.- Parameters:
locale
- theLocale
to localize the date/time pattern (influences names for zones codes)- Returns:
- a
DateTimeScrubber
for ISO-8601 zoned date/times - See Also:
-
isoZonedDateTimes
Creates aDateTimeScrubber
for ISO-8601 zoned date/times, like2019-02-25T12:34:56+02:00
,2019-02-25T12:34:56.123456789+02:00
,2019-02-25T12:34:56+02:00[Europe/Berlin]
, or2019-02-25T12:34:56.123456789+02:00[Europe/Berlin]
.- Returns:
- a
DateTimeScrubber
for ISO-8601 zoned date/times - See Also:
-
isoDateTimes
Creates aDateTimeScrubber
for ISO-8601 date/times, like2019-02-25T12:34:56
,2019-02-25T12:34:56.123456789
,2019-02-25T12:34:56+02:00
, or2019-02-25T12:34:56.123456789+02:00[Europe/Berlin]
.- Parameters:
locale
- theLocale
to localize the date/time pattern (influences names for zones codes)- Returns:
- a
DateTimeScrubber
for ISO-8601 date/times - See Also:
-
isoDateTimes
Creates aDateTimeScrubber
for ISO-8601 date/times, like2019-02-25T12:34:56
,2019-02-25T12:34:56.123456789
,2019-02-25T12:34:56+02:00
, or2019-02-25T12:34:56.123456789+02:00[Europe/Berlin]
.- Returns:
- a
DateTimeScrubber
for ISO-8601 date/times - See Also:
-
isoOrdinalDates
- Returns:
- a
DateTimeScrubber
for ISO-8601 ordinal dates - See Also:
-
isoWeekDates
- Returns:
- a
DateTimeScrubber
for ISO-8601 week dates - See Also:
-
isoInstants
Creates aDateTimeScrubber
for ISO-8601 instants, like2019-02-25T12:34:56.123456789+02:00
, or2019-02-25T12:34:56.123456789Z
.- Returns:
- a
DateTimeScrubber
for ISO-8601 instants - See Also:
-
basicIsoDates
- Returns:
- a
DateTimeScrubber
for basic ISO-8601 dates - See Also:
-
rfc1123DateTimes
Creates aDateTimeScrubber
for RFC-1123 date/times, likeMon, 35 Feb 2019 12:34:56 GMT
. Note that this always uses theLocale.US
.- Returns:
- a
DateTimeScrubber
for RFC-1123 date/times - See Also:
-
uuids
Creates aRegexScrubber
for UUIDs.- Returns:
- a
RegexScrubber
that replaces all UUIDs
-