OperationChainValidator { public ValidationResult validate(final OperationChain<?> operationChain, final User user, final Store store) { final ValidationResult validationResult = new ValidationResult(); if (operationChain.getOperations().isEmpty()) { validationResult.addError("Operation chain contains no operations"); } else { Class<? extends Output> output = null; for (final Operation op : operationChain.getOperations()) { output = validate(op, user, store, validationResult, output); } } return validationResult; } OperationChainValidator(final ViewValidator viewValidator); ValidationResult validate(final OperationChain<?> operationChain, final User user, final Store store);  }
@Test public void shouldNotValidateInvalidOperationChain() { Operation operation = Mockito.mock(Operation.class); given(operation.validate()).willReturn(new ValidationResult("SparkContext is required")); OperationChain opChain = new OperationChain(operation); validateOperationChain(opChain, false); verify(operation).validate(); }