SchemaOperationChainUtil { public static ValidationResult validate(final Schema schema, final OperationChain operationChain) { updateOperationChainViews(operationChain, schema); SchemaOperationChainValidator validator = new SchemaOperationChainValidator(new ViewValidator(), schema); return validator.validate(operationChain, null, null); } private  SchemaOperationChainUtil(); static ValidationResult validate(final Schema schema, final OperationChain operationChain);  }
@Test public void shouldValidateValidOperationChainAgainstSchema() { final ValidationResult validationResult = SchemaOperationChainUtil.validate(schema, validOperationChain); assertTrue(validationResult.isValid()); }
@Test public void shouldValidateInvalidOperationChainAgainstSchema() { final ValidationResult validationResult = SchemaOperationChainUtil.validate(schema, invalidOperationChain); assertFalse(validationResult.isValid()); assertTrue(validationResult.getErrorString().contains("elementGenerator is required for: AddElementsFromSocket")); assertTrue(validationResult.getErrorString().contains("hostname is required for: AddElementsFromSocket")); }