CustomValidationConfiguration implements IMessageValidationSpecification, Serializable { public void addValidator(final MessageValidatorConfiguration validator) { if (this.validatorConfigs == null) this.validatorConfigs = new ArrayList<>(); this.validatorConfigs.add(validator); } CustomValidationConfiguration();  CustomValidationConfiguration(final IMessageValidationSpecification source); @Override List<IMessageValidatorConfiguration> getValidators(); void setValidators(final List<MessageValidatorConfiguration> validators); void addValidator(final MessageValidatorConfiguration validator); @Override Boolean mustExecuteInOrder(); void setExecuteInOrder(final Boolean inOrder); @Override MessageValidationError.Severity getStopSeverity(); void setStopSeverity(final MessageValidationError.Severity stopSeverity); @Override MessageValidationError.Severity getRejectionSeverity(); void setRejectSeverity(final MessageValidationError.Severity rejectSeverity);  }
@Test public void writeMultipleValidators() { final CustomValidationConfiguration cvc = new CustomValidationConfiguration(); final MessageValidatorConfiguration validator = new MessageValidatorConfiguration(); validator.setId("validator-1"); validator.setFactory("org.holodeckb2b.test.NotReal"); cvc.addValidator(validator); final MessageValidatorConfiguration validator2 = new MessageValidatorConfiguration(); validator2.setId("validator-2"); validator2.setFactory("org.holodeckb2b.test.AlwaysGood"); cvc.addValidator(validator2); final String xml = createXML(cvc); assertFalse(Utils.isNullOrEmpty(xml)); assertTrue(countElements(xml, "Validator") == 2); }
@Test public void writeDefaults() { final CustomValidationConfiguration cvc = new CustomValidationConfiguration(); final MessageValidatorConfiguration validator = new MessageValidatorConfiguration(); validator.setId("validator-1"); validator.setFactory("org.holodeckb2b.test.NotReal"); cvc.addValidator(validator); final String xml = createXML(cvc); assertFalse(Utils.isNullOrEmpty(xml)); assertTrue(countElements(xml, "ExecuteInOrder") == 1); assertEquals("false", findElements(xml, "ExecuteInOrder").get(0).getTextContent()); assertTrue(countElements(xml, "StopValidationOn") == 0); assertTrue(countElements(xml, "RejectMessageOn") == 0); assertTrue(countElements(xml, "Validator") == 1); }