### Question:
Snippets { static Snippet snippet(final String template, final Object... args) { return template == null || template.isEmpty() ? snippet(args) : (source, identifiers) -> { final Matcher matcher=VariablePattern.matcher(template); final Map<CharSequence, Object> variables=new HashMap<>(); final Iterator<Object> iterator=(args == null) ? emptyIterator() : stream(args).iterator(); int last=0; while ( matcher.find() ) { final int start=matcher.start(); final int end=matcher.end(); source.accept(template.subSequence(last, start)); generate(variables.computeIfAbsent( template.subSequence(start, end), name -> iterator.hasNext() ? iterator.next() : null ), source, identifiers); last=end; } source.accept(template.subSequence(last, template.length())); while ( iterator.hasNext() ) { generate(iterator.next(), source, identifiers); } }; } private  Snippets(); static String source(final String template, final Object... args); static String source(final Object... snippets); static Snippet list(final Stream<?> items, final Object separator); static Snippet id(final Object object); static Snippet id(final Object object, final Object... aliases);  }### Answer:
@Test void testSnippet() { assertThat(source(snippet((Object)null))).isEqualTo(""); assertThat(source(snippet(1, 2, 3))).isEqualTo("123"); assertThat(source(snippet(asList("an", " ", "iterable")))).isEqualTo("an iterable"); assertThat(source(snippet(Stream.of("a", " ", "stream")))).isEqualTo("a stream"); assertThat(source(snippet(123))).isEqualTo("123"); assertThat(source(snippet("string"))).isEqualTo("string"); }