Interface MockUnitString
-
- All Superinterfaces:
MockUnit<java.lang.String>
- All Known Implementing Classes:
Actors,Actresses,Addresses,Cars,Celebrities,Countries,Creatures,CreditCards,CSVs,CVVS,Departments,Domains,Emails,Formatter,Genders,IBANs,Industries,IPv4s,IPv6s,ISSNS,JazzArtists,Macs,Markovs,Mimes,Money,Names,NaughtyStrings,Passwords,Regex,RockStars,Space,SSCs,Strings,UKPrimeMinisters,URLs,Users,USPresidents,USStates,UUIDs,Words
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
@FunctionalInterface public interface MockUnitString extends MockUnit<java.lang.String>
-
-
Method Summary
All Methods Instance Methods Default Methods Modifier and Type Method Description default MockUnitStringaccumulate(int times, java.lang.String separator)Joins intermediary results by calling val() a number of times using the given separatordefault MockUnitStringappend(java.lang.String str)Creates a newMockUnitStringdefault MockUnit<java.lang.String[]>array(int size)Transforms an existingMockUnitStringinto aMockUnit<String[]>.default MockUnitStringbase64()default MockUnitStringescapeCsv()Creates a newMockUnitStringby CSV-escaping the generated value.default MockUnitStringescapeEcmaScript()Creates a newMockUnitStringby ECMA-escaping the generated value.default MockUnitStringescapeHtml()Creates a newMockUnitStringby HTML-escaping the generated value.default MockUnitStringescapeXml()Creates a newMockUnitStringby XML-escaping the generated value.default MockUnitStringformat(StringFormatType formatType)Formats the results obtained from theMockUnit<String>and creates a newMockUnitStringthat generates formatted results.default MockUnitStringmd2()default MockUnitStringmd5()default MockUnitStringnoSpecialChars()Creates a newMockUnitStringby stripping the result from special characters.default MockUnitStringprepend(java.lang.String str)Creates a newMockUnitStringby prepending a new String on the generated value.default MockUnitStringreplace(char oldCHar, char newChar)Creates a newMockUnitStringby replacing all the occurrences ofoldCharwithnewChardefault MockUnitStringreplace(java.lang.CharSequence target, java.lang.CharSequence replacement)Creates a newMockUnitStringby replacing all occurrences oftargetwithreplacement.default MockUnitStringreplaceAll(java.lang.String regex, java.lang.String replacement)Creates a newMockUnitStringby replacing all occurrences that matchregexwithreplacement.default MockUnitStringreplaceFirst(java.lang.String regex, java.lang.String replacement)Creates a newMockUnitStringby replacing the first occurrence that matchregexwithreplacement.default MockUnitStringsha1()default MockUnitStringsha256()default MockUnitStringsha384()default MockUnitStringsha512()default MockUnit<java.lang.String[]>split(java.lang.String regex)Creates a newMockUnit<String[]>by splitting the generated value.default MockUnit<java.lang.String[]>split(java.lang.String regex, int limit)Creates a newMockUnit<String[]>by splitting the generated value.default MockUnitStringsub(int endIndex)Creates a newMockUnitStringby applyingString.substring(0, endIndex)on the generated values.default MockUnitStringsub(int beginIndex, int endIndex)Creates a newMockUnitStringby applyingString.substring(beginIndex, endIndex)on the generated values.default MockUnitStringurlEncode()Creates a newMockUnitStringby applying an URL Encode on the result.default MockUnitStringurlEncode(java.lang.String encoding)Creates a newMockUnitStringby applying an URL Encode on the result.-
Methods inherited from interface net.andreinc.mockneat.abstraction.MockUnit
array, array, collection, collection, collection, collection, collection, collection, consume, consume, get, get, list, list, list, list, list, list, map, mapKeys, mapKeys, mapKeys, mapKeys, mapKeys, mapKeys, mapKeys, mapKeys, mapKeys, mapKeys, mapKeys, mapKeys, mapKeys, mapKeys, mapKeys, mapKeys, mapKeys, mapKeys, mapKeys, mapKeys, mapKeys, mapToDouble, mapToInt, mapToLocalDate, mapToLong, mapToString, mapToString, mapVals, mapVals, mapVals, mapVals, mapVals, mapVals, mapVals, mapVals, mapVals, mapVals, mapVals, mapVals, mapVals, mapVals, mapVals, mapVals, mapVals, mapVals, mapVals, mapVals, mapVals, serialize, set, set, set, set, set, set, stream, supplier, val, val, valStr, valStr
-
-
-
-
Method Detail
-
accumulate
default MockUnitString accumulate(int times, java.lang.String separator)
Joins intermediary results by calling val() a number of times using the given separator
- Parameters:
times- The number of times the value is joinedseparator- The string used as a separator- Returns:
- A new
MockUnitstring.
-
format
default MockUnitString format(StringFormatType formatType)
Formats the results obtained from the
Currently there are 3 supported formatting types:MockUnit<String>and creates a newMockUnitStringthat generates formatted results.StringFormatType.UPPER_CASEStringFormatType.LOWER_CASEStringFormatType.CAPITALIZED
- Parameters:
formatType- The format type that will be applied to the generated value.- Returns:
- A new
MockUnitString
-
sub
default MockUnitString sub(int endIndex)
Creates a new
MockUnitStringby applyingString.substring(0, endIndex)on the generated values.Note: If the initial generated value is
nullthe resulting value is alsonull.Note: The developer is responsible to supply correct indexes for the substring operation.
- Parameters:
endIndex- The end index.- Returns:
- A new
MockUnitString
-
sub
default MockUnitString sub(int beginIndex, int endIndex)
Creates a new
MockUnitStringby applyingString.substring(beginIndex, endIndex)on the generated values.Note: If the initial generated value is
nullthe resulting value is alsonull.Note: The developer is responsible to supply correct indexes for the substring operation.
- Parameters:
beginIndex- The begin index.endIndex- The end index.- Returns:
- A new
MockUnitString
-
append
default MockUnitString append(java.lang.String str)
Creates a new
by appending a new String on the generated value.MockUnitStringNote: If the initial generated value is
nullthe resulting value is alsonull.- Parameters:
str- The String to append.- Returns:
- A new
MockUnitString
-
prepend
default MockUnitString prepend(java.lang.String str)
Creates a new
MockUnitStringby prepending a new String on the generated value.Note: If the initial generated value is
nullthe resulting value is alsonull.- Parameters:
str- The String to prepend.- Returns:
- A new
MockUnitString
-
replace
default MockUnitString replace(char oldCHar, char newChar)
Creates a new
MockUnitStringby replacing all the occurrences ofoldCharwithnewCharNote: If the initial generated value is
nullthe resulting value is alsonull.- Parameters:
oldCHar- The char to be replaced.newChar- The new char replacingoldChar.- Returns:
- A new
MockUnitString
-
replace
default MockUnitString replace(java.lang.CharSequence target, java.lang.CharSequence replacement)
Creates a new
MockUnitStringby replacing all occurrences oftargetwithreplacement.Note: If the initial generated value is
nullthe resulting value is alsonull.- Parameters:
target- The substring to be replaced.replacement- The substring that replacestarget.- Returns:
- A new
MockUnitString
-
replaceAll
default MockUnitString replaceAll(java.lang.String regex, java.lang.String replacement)
Creates a new
MockUnitStringby replacing all occurrences that matchregexwithreplacement.Note: If the initial generated value is
nullthe resulting value is alsonull.- Parameters:
regex- The regular expression to be replaced.replacement- The replacement for the characters matchingregex.- Returns:
- A new
MockUnitString
-
replaceFirst
default MockUnitString replaceFirst(java.lang.String regex, java.lang.String replacement)
Creates a new
MockUnitStringby replacing the first occurrence that matchregexwithreplacement.Note: If the initial generated value is
nullthe resulting value is alsonull.- Parameters:
regex- The regular expression to be replaced.replacement- The replacement for the characters matchingregex.- Returns:
- A new
MockUnitString
-
split
default MockUnit<java.lang.String[]> split(java.lang.String regex, int limit)
Creates a new
MockUnit<String[]>by splitting the generated value.Note: If the initial generated value is
nullthe resulting value is alsonull.- Parameters:
regex- The seperator regex (where the splittings are performed).limit- Limits the number of split operations.- Returns:
- A new
MockUnit<String>
-
split
default MockUnit<java.lang.String[]> split(java.lang.String regex)
Creates a new
MockUnit<String[]>by splitting the generated value.Note: If the initial generated value is
nullthe resulting value is alsonull.- Parameters:
regex- The seperator regex (where the splittings are performed).- Returns:
- A new
MockUnit<String>
-
urlEncode
default MockUnitString urlEncode(java.lang.String encoding)
Creates a new
MockUnitStringby applying an URL Encode on the result.Note: If the initial generated value is
nullthe resulting value is alsonull.- Parameters:
encoding- Type of encoding.- Returns:
- A new
MockUnitString
-
urlEncode
default MockUnitString urlEncode()
Creates a new
MockUnitStringby applying an URL Encode on the result.Note: If the initial generated value is
nullthe resulting value is alsonull.- Returns:
- A new
MockUnitString
-
noSpecialChars
default MockUnitString noSpecialChars()
Creates a new
MockUnitStringby stripping the result from special characters. Everything that is not " ", number or letter will be removed from the resulting string.Note: If the initial generated value is
nullthe resulting value is alsonull.- Returns:
- A new
MockUnitString
-
escapeCsv
default MockUnitString escapeCsv()
Creates a new
MockUnitStringby CSV-escaping the generated value.- Returns:
- A new
MockUnitString
-
escapeEcmaScript
default MockUnitString escapeEcmaScript()
Creates a new
MockUnitStringby ECMA-escaping the generated value.- Returns:
- A new
MockUnitString
-
escapeHtml
default MockUnitString escapeHtml()
Creates a new
MockUnitStringby HTML-escaping the generated value.- Returns:
- A new
MockUnitString
-
escapeXml
default MockUnitString escapeXml()
Creates a new
MockUnitStringby XML-escaping the generated value.- Returns:
- A new
MockUnitString
-
md2
default MockUnitString md2()
-
md5
default MockUnitString md5()
-
sha1
default MockUnitString sha1()
-
sha256
default MockUnitString sha256()
-
sha384
default MockUnitString sha384()
-
sha512
default MockUnitString sha512()
-
base64
default MockUnitString base64()
-
array
default MockUnit<java.lang.String[]> array(int size)
Transforms an existing
MockUnitStringinto aMockUnit<String[]>.The array will contains values generated through the
MockUnitString.- Parameters:
size- The size of the array.- Returns:
- A new
MockUnit<String[]>
-
-