### Question:
OperationWrapper { public boolean isReady(ExecutorContext executorContext, Set<String> completedOperations) { if(completedOperations.containsAll(dependencies)) { if(updateReadiness(evaluateReferences(executorContext))) { return true; } else { throw new RuntimeException("All dependencies have been completed but there are still pending references."); } } return false; } OperationWrapper(Operation operation); OperationWrapper init(ExecutorContext executorContext, JsonContextReferenceParser jsonContextReferenceParser); boolean isReady(ExecutorContext executorContext, Set<String> completedOperations); String getInputPayload(); Operation getOperation(); String getOutputPayload(); void setOutputPayload(String outputPayload); Set<String> getDependencies(); Boolean getSuccess(); void setSuccess(Boolean success); List<DiagnosticEvent> getDiagnosticEvents(); void addDiagnosticEvent(DiagnosticEvent diagnosticEvent); BaseOperationExecutor getOperationExecutor(); OperationWrapper setOperationExecutor(BaseOperationExecutor operationExecutor); OperationProgress getPriorExecutionOperationProgress(); void setPriorExecutionOperationProgress(OperationProgress priorExecutionOperationProgress);  }### Answer:
@Test(expectedExceptions = RuntimeException.class) public void testIsReadyInvalidReferences() { ReferenceReplacementResult referenceReplacementResult = new ReferenceReplacementResult(); referenceReplacementResult.addInvalidReference("invalid"); doReturn(referenceReplacementResult).when(mockJsonContext).processReferences(any(), anyList()); operationWrapper.isReady(mockExecutorContext, new HashSet<>()); }
@Test public void testIsReady() { final String EXPECTED_RESULT = "expected"; ReferenceReplacementResult referenceReplacementResult = new ReferenceReplacementResult(); referenceReplacementResult.setResult(EXPECTED_RESULT); doReturn(referenceReplacementResult).when(mockJsonContext).processReferences(any(), anyList()); Assert.assertTrue(operationWrapper.isReady(mockExecutorContext, new HashSet<>())); Assert.assertEquals(operationWrapper.getInputPayload(), EXPECTED_RESULT); }