@Test public void handlesEscapesAtSymbols() { EmitEachSelectorValidator.Config config = new EmitEachSelectorValidator.Config(); config.setSelector(Selector.parse("string")); config.setMessageTemplate("A@@@@B"); EmitEachSelectorValidator validator = new EmitEachSelectorValidator(config); Model model = Model.builder() .addShape(StringShape.builder().id(ShapeId.from("foo.bar#Baz")).build()) .build(); List<ValidationEvent> events = validator.validate(model); assertThat(events, hasSize(1)); assertThat(events.get(0).getMessage(), equalTo("A@@B")); }
@Override public List<ValidationEvent> validate(Model model) { if (config.bindToTrait != null && !model.getAppliedTraits().contains(config.getBindToTrait())) { return Collections.emptyList(); } else if (config.messageTemplate == null) { return validateWithSimpleMessages(model); } else { return validateWithTemplate(model); } }
EmitEachSelectorValidator extends AbstractValidator { @Override public List<ValidationEvent> validate(Model model) { if (config.bindToTrait != null && !model.getAppliedTraits().contains(config.getBindToTrait())) { return Collections.emptyList(); } else if (config.messageTemplate == null) { return validateWithSimpleMessages(model); } else { return validateWithTemplate(model); } } }
EmitEachSelectorValidator extends AbstractValidator { @Override public List<ValidationEvent> validate(Model model) { if (config.bindToTrait != null && !model.getAppliedTraits().contains(config.getBindToTrait())) { return Collections.emptyList(); } else if (config.messageTemplate == null) { return validateWithSimpleMessages(model); } else { return validateWithTemplate(model); } } EmitEachSelectorValidator(Config config); }
EmitEachSelectorValidator extends AbstractValidator { @Override public List<ValidationEvent> validate(Model model) { if (config.bindToTrait != null && !model.getAppliedTraits().contains(config.getBindToTrait())) { return Collections.emptyList(); } else if (config.messageTemplate == null) { return validateWithSimpleMessages(model); } else { return validateWithTemplate(model); } } EmitEachSelectorValidator(Config config); @Override List<ValidationEvent> validate(Model model); }
EmitEachSelectorValidator extends AbstractValidator { @Override public List<ValidationEvent> validate(Model model) { if (config.bindToTrait != null && !model.getAppliedTraits().contains(config.getBindToTrait())) { return Collections.emptyList(); } else if (config.messageTemplate == null) { return validateWithSimpleMessages(model); } else { return validateWithTemplate(model); } } EmitEachSelectorValidator(Config config); @Override List<ValidationEvent> validate(Model model);  }