@Test
public void expandsMessageTemplates() {

    EmitEachSelectorValidator.Config config = new EmitEachSelectorValidator.Config();
    Model model = Model.builder()
            .addShape(StringShape.builder()
                    .id(ShapeId.from("foo.bar#Baz"))
                    .addTrait(new DocumentationTrait("hello"))
                    .build())
            .build();
    config.setSelector(Selector.parse("$foo(*)"));
    config.setMessageTemplate("before `@{trait|documentation}` after. ID: @{id}. Var: @{var|foo|id}.");
    EmitEachSelectorValidator validator = new EmitEachSelectorValidator(config);
    List<ValidationEvent> events = validator.validate(model);
    assertThat(events.get(0).getMessage(),
               equalTo("before `\"hello\"` after. ID: foo.bar#Baz. Var: [foo.bar#Baz]."));
}