/** * 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); }
@Test public void testProcessShouldReplacePlaceholder() { // Given: final Method method = Methods.anyMethod(); ReplacementData data = ReplacementData.of(method, 0, Arrays.<Object>asList(0)); // When: String result = underTest.process(data, "%cm"); // Then: assertThat(result).isEqualTo(method.toString()); } }
@Test public void testProcessShouldReplacePlaceholder() { // Given: final Method method = Methods.anyMethod(); ReplacementData data = ReplacementData.of(method, 0, Arrays.<Object>asList(0)); // When: String result = underTest.process(data, "%cm"); // Then: assertThat(result).isEqualTo(method.toString()); } }