### Question:
Frame implements Function<V, Stream<String>> { private String fill(final Function<String, String> resolver) { final StringBuilder builder=new StringBuilder(model.length()); final Matcher matcher=PlaceholderPattern.matcher(model); int index=0; while ( matcher.find() ) { final String modifier=matcher.group("modifier"); final String name=matcher.group("name"); final String value=resolver.apply(name); try { builder.append(model, index, matcher.start()).append( "\\".equals(modifier) ? matcher.group().substring(1) : "%".equals(modifier) ? URLEncoder.encode(value, UTF_8.name()) : value != null ? value : "" ); } catch ( final UnsupportedEncodingException unexpected ) { throw new UncheckedIOException(unexpected); } index=matcher.end(); } builder.append(model.substring(index)); return builder.toString(); }  Frame<V> model(final String model); Frame<V> value(final String name); Frame<V> value(final String name, final Object value); Frame<V> value(final String name, final Function<V, String> expression); Frame<V> values(final String name, final Object... values); Frame<V> values(final String name, final Collection<Object> values); Frame<V> values(final String name, final Stream<Object> values); Frame<V> values(final String name, final Function<V, Stream<String>> expression); @Override Stream<String> apply(final V value);  }### Answer:
@Test void testPlainVariables() { assertThat(fill("head name:{name} tail", "name", "value")) .as("matched") .containsExactly("head name:value tail"); assertThat(fill("head name:{name} tail", "none", "value")) .as("unmatched") .containsExactly("head name: tail"); }
@Test void testMultipleVariables() { assertThat(fill("name:text", "name", "value")) .as("no variables") .containsExactly("name:text"); assertThat(fill("one:{one}, two:{two}", "one", "value")) .as("multiple variables") .containsExactly("one:value, two:"); }
@Test void testModifiers() { assertThat(fill("http: .as("encoded") .containsExactly("http: assertThat(fill("\\{name}={name}", "name", "value")) .as("escaped") .containsExactly("{name}=value"); }