public abstract class BasePlaceholder
extends java.lang.Object
getReplacementFor(String)
. Afterwards add the new placeholder to the other
placeholders by using Placeholders.all()
(for details see Placeholders
).DataProvider.format()
,
Placeholders
Modifier and Type | Field and Description |
---|---|
protected int |
idx |
protected java.lang.reflect.Method |
method |
protected java.lang.Object[] |
parameters |
Constructor and Description |
---|
BasePlaceholder(java.lang.String placeholderRegex) |
Modifier and Type | Method and Description |
---|---|
protected abstract java.lang.String |
getReplacementFor(java.lang.String placeholder)
Generate and returns the replacement for the found and given placeholder.
|
java.lang.String |
process(java.lang.String formatPattern)
Executes this placeholder for the given
String by searching all occurrences of the regular expression
supplied in the constructor and replaces them with the retrieved replacement from
getReplacementFor(String) . |
void |
setContext(java.lang.reflect.Method method,
int idx,
java.lang.Object[] parameters)
Sets the given arguments as context for processing or replacement generation, respectively.
|
protected java.lang.reflect.Method method
protected int idx
protected java.lang.Object[] parameters
public BasePlaceholder(java.lang.String placeholderRegex)
placeholderRegex
- - regular expression to match the placeholder in the DataProvider.format()
.public void setContext(java.lang.reflect.Method method, int idx, java.lang.Object[] parameters)
method
- - test methodidx
- - index of the dataprovider rowparameters
- of the current dataprovider test to be executedpublic java.lang.String process(java.lang.String formatPattern)
String
by searching all occurrences of the regular expression
supplied in the constructor and replaces them with the retrieved replacement from
getReplacementFor(String)
. If the regular expression does not match, an exact copy of the given
String
is returned.formatPattern
- to be processedformatPattern
containing the generated replacements instead of matching patternsprotected abstract java.lang.String getReplacementFor(java.lang.String placeholder)
placeholder
- for which the replacement String
should be returnedplaceholder
(not null
)