public void testContextIsBound() throws Exception { assertTrue("Bound contexts should return true", boundOperationContext.isBound()); Map<WaveletName, RobotWaveletData> openWavelets = boundOperationContext.getOpenWavelets(); assertEquals("Bound wavelet should be open", openWavelets.get(WAVELET_NAME), wavelet); assertFalse("Unbound contexts should return false", operationContext.isBound()); }
public void testContextIsBound() throws Exception { assertTrue("Bound contexts should return true", boundOperationContext.isBound()); Map<WaveletName, RobotWaveletData> openWavelets = boundOperationContext.getOpenWavelets(); assertEquals("Bound wavelet should be open", openWavelets.get(WAVELET_NAME), wavelet); assertFalse("Unbound contexts should return false", operationContext.isBound()); }
public void testConstructErrorResponse() { operationContext.constructErrorResponse(request, ERROR_MESSAGE); JsonRpcResponse response = operationContext.getResponse(request.getId()); assertTrue("Expected error response", response.isError()); assertEquals("Expected provided error message", ERROR_MESSAGE, response.getErrorMessage()); assertEquals("Expected operation id not to change", OPERATION_ID, response.getId()); }
public void testConstructErrorResponse() { operationContext.constructErrorResponse(request, ERROR_MESSAGE); JsonRpcResponse response = operationContext.getResponse(request.getId()); assertTrue("Expected error response", response.isError()); assertEquals("Expected provided error message", ERROR_MESSAGE, response.getErrorMessage()); assertEquals("Expected operation id not to change", OPERATION_ID, response.getId()); }
public void testProcessErrorEvent() throws Exception { // A randomly selected non-error event Event event = new OperationErrorEvent(null, null, USERNAME, 0L, OPERATION_ID, ERROR_MESSAGE); operationContext.processEvent(request, event); JsonRpcResponse response = operationContext.getResponse(request.getId()); assertTrue("Expected error response", response.isError()); assertEquals("Expected provided error message", ERROR_MESSAGE, response.getErrorMessage()); assertEquals("Expected operation id not to change", OPERATION_ID, response.getId()); }
public void testProcessErrorEvent() throws Exception { // A randomly selected non-error event Event event = new OperationErrorEvent(null, null, USERNAME, 0L, OPERATION_ID, ERROR_MESSAGE); operationContext.processEvent(request, event); JsonRpcResponse response = operationContext.getResponse(request.getId()); assertTrue("Expected error response", response.isError()); assertEquals("Expected provided error message", ERROR_MESSAGE, response.getErrorMessage()); assertEquals("Expected operation id not to change", OPERATION_ID, response.getId()); }