public class ParameterPlaceholder
extends com.tngtech.junit.dataprovider.placeholder.ArgumentPlaceholder
String according to the
given index or range subscript (see DataProvider.format(). Furthermore the following parameter values are
treated specially:
| Parameter value | target String |
|---|---|
| null | <null> |
| "" (= empty string) | <empty string> |
| array (e.g. String[]) | "[" + formatPattern(array) + "]" |
| other | Object.toString() |
| Modifier and Type | Class and Description |
|---|---|
protected static class |
com.tngtech.junit.dataprovider.placeholder.AbstractArgumentPlaceholder.FromAndTo |
| Modifier and Type | Field and Description |
|---|---|
protected int |
idx |
protected java.lang.reflect.Method |
method |
protected java.lang.Object[] |
parameters |
| Constructor and Description |
|---|
ParameterPlaceholder() |
| Modifier and Type | Method and Description |
|---|---|
protected java.lang.String |
format(java.lang.Object param) |
protected java.lang.String |
formatAll(java.util.List<java.lang.Object> arguments) |
protected java.lang.String |
formatAll(java.lang.Object[] parameters)
Formats the given parameters by retrieving it's
String representation and separate it by comma (=
,). |
protected java.lang.String |
getReplacementFor(java.lang.String 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 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 java.lang.String getReplacementFor(java.lang.String placeholder)
protected java.lang.String formatAll(java.lang.Object[] parameters)
String representation and separate it by comma (=
,).
Note: For new and future-proof implementations, please use formatAll(java.util.List) instead.
parameters - to be formattedString representation of the given Object[]formatAll(java.util.List)protected java.lang.String formatAll(java.util.List<java.lang.Object> arguments)
formatAll in class com.tngtech.junit.dataprovider.placeholder.ArgumentPlaceholderprotected java.lang.String format(java.lang.Object param)