@Override public String format(Method testMethod, int invocationIndex, List<Object> arguments) { ReplacementData data = ReplacementData.of(testMethod, invocationIndex, arguments); String result = format; for (BasePlaceholder placeHolder : placeholders) { result = placeHolder.process(data, result); } return result; } }
@Override protected String format(Object param) { return super.format(param); } }
/** * Creates {@link ReplacementData} for the given values. * * @param testMethod to be executed * @param testIndex the index (row) of the test / used dataprovider * @param arguments used for invoking this test testMethod * @return {@link ReplacementData} containing the given values * @throws NullPointerException if and only if a given value is {@code null} */ public static ReplacementData of(Method testMethod, int testIndex, List<Object> arguments) { return new ReplacementData(testMethod, testIndex, arguments); }
@Override protected String getReplacementFor(String placeholder, ReplacementData data) { FromAndTo fromAndTo = calcFromAndToForSubscriptAndArguments(placeholder, 4, data.getArguments().size()); return formatAll(getSubArrayOfMethodParameters(data.getTestMethod(), fromAndTo), data.getArguments().subList(fromAndTo.from, fromAndTo.to)); }
/** * Executes this placeholder for the given {@link String} by searching all occurrences of the regular expression * supplied in the constructor and replaces them with the retrieved replacement from * {@link #getReplacementFor(String)}. If the regular expression does not match, an exact copy of the given * {@link String} is returned. * * @param formatPattern to be processed * @return the given {@code formatPattern} containing the generated replacements instead of matching patterns */ public String process(String formatPattern) { ReplacementData data = ReplacementData.of(method, idx, Arrays.asList(parameters)); return super.process(data, formatPattern); }
/** * Executes this placeholder for the given {@link String} by searching all occurrences of the regular expression * supplied in the constructor and replaces them with the retrieved replacement from * {@link #getReplacementFor(String)}. If the regular expression does not match, an exact copy of the given * {@link String} is returned. * * @param formatPattern to be processed * @return the given {@code formatPattern} containing the generated replacements instead of matching patterns */ public String process(String formatPattern) { ReplacementData data = ReplacementData.of(method, idx, Arrays.asList(parameters)); return super.process(data, formatPattern); }
@Override protected String getReplacementFor(String placeholder, ReplacementData data) { FromAndTo fromAndTo = calcFromAndToForSubscriptAndArguments(placeholder, 3, data.getArguments().size()); return formatAll(data.getArguments().subList(fromAndTo.from, fromAndTo.to)); }
protected String getReplacementFor(String placeholder) { ReplacementData data = ReplacementData.of(method, idx, Arrays.asList(parameters)); return super.getReplacementFor(placeholder, data); } }
protected String getReplacementFor(String placeholder) { ReplacementData data = ReplacementData.of(method, idx, Arrays.asList(parameters)); return super.getReplacementFor(placeholder, data); } }
protected String getReplacementFor(String placeholder) { ReplacementData data = ReplacementData.of(method, idx, Arrays.asList(parameters)); return super.getReplacementFor(placeholder, data); } }
protected String getReplacementFor(String placeholder) { ReplacementData data = ReplacementData.of(method, idx, Arrays.asList(parameters)); return super.getReplacementFor(placeholder, data); } }
protected String getReplacementFor(String placeholder) { ReplacementData data = ReplacementData.of(method, idx, Arrays.asList(parameters)); return super.getReplacementFor(placeholder, data); } }
/** * @return the list of placeholders used to create the display name for each dataprovider test case */ protected List<? extends BasePlaceholder> getDefaultPlaceholders() { List<BasePlaceholder> result = new ArrayList<>(); result.add(new ArgumentPlaceholder()); result.add(new CanonicalClassNamePlaceholder()); // must be before SimpleClassNamePlaceholder result.add(new CompleteMethodSignaturePlaceholder()); // must be before SimpleClassNamePlaceholder result.add(new IndexPlaceholder()); result.add(new NamedArgumentPlaceholder()); result.add(new SimpleClassNamePlaceholder()); result.add(new SimpleMethodNamePlaceholder()); return result; }
@Test void testProcessShouldReplaceSingleValueRangeSubscriptArgumentPlaceholderUsingOnlyNegativeIndices() { // Given: final List<Object> arguments = list('a', 1, 2l, 3.3, "four", 'f', 6, 7l, 8.8, 9.99f); ReplacementData data = ReplacementData.of(tenParamMethod, 0, arguments); // When: String result = underTest.process(data, "%na[-3..-3]"); // Then: assertThat(result).isEqualTo("l7=7"); }
protected String getReplacementFor(String placeholder) { ReplacementData data = ReplacementData.of(method, idx, Arrays.asList(parameters)); return super.getReplacementFor(placeholder, data); } }
protected String getReplacementFor(String placeholder) { ReplacementData data = ReplacementData.of(method, idx, Arrays.asList(parameters)); return super.getReplacementFor(placeholder, data); } }
protected String getReplacementFor(String placeholder) { ReplacementData data = ReplacementData.of(method, idx, Arrays.asList(parameters)); return super.getReplacementFor(placeholder, data); } }
protected String getReplacementFor(String placeholder) { ReplacementData data = ReplacementData.of(method, idx, Arrays.asList(parameters)); return super.getReplacementFor(placeholder, data); } }
protected String getReplacementFor(String placeholder) { ReplacementData data = ReplacementData.of(method, idx, Arrays.asList(parameters)); return super.getReplacementFor(placeholder, data); } }
@Override protected String format(Object param) { return super.format(param); } }