TemplateEvaluator { public String evaluate(Message message) { for (FragmentEvaluator e : fragmentEvaluators) { e.eval(builder, message); } final String result = builder.toString(); builder.delete(0, builder.length()); return result; } TemplateEvaluator(
      Descriptors.Descriptor descriptor, List<TemplateParser.TextFragment> fragments); String evaluate(Message message);  }
@Test public void exampleUsage() { Message originalMessage = SimpleMessage.newBuilder().setName("bob").build(); DynamicMessage message = dynamic(originalMessage); TemplateEvaluator evaluator = new TemplateEvaluator( originalMessage.getDescriptorForType(), fragments(staticFragment("foo.bar/"), dynamicFragment("$.name"))); assertThat(evaluator.evaluate(message), is("foo.bar/bob")); }