AbstractOp implements Op { protected Object processObjResponse(Message msg, String opName) throws Exception { Part part = msg.getPart(0); final int msgType = msg.getMessageType(); if (msgType == MessageType.RESPONSE) { return part.getObject(); } else { if (msgType == MessageType.EXCEPTION) { String s = "While performing a remote " + opName; throw new ServerOperationException(s, (Throwable) part.getObject()); } else if (isErrorResponse(msgType)) { throw new ServerOperationException(part.getString()); } else { throw new InternalGemFireError("Unexpected message type " + MessageType.getString(msgType)); } } } protected  AbstractOp(int msgType, int msgParts); String getShortClassName(); @Override Object attempt(Connection connection); boolean isGatewaySenderOp();  }
@Test public void shouldBeMockable() throws Exception { AbstractOp mockAbstractOp = mock(AbstractOp.class); Object mockObject = mock(Object.class); when(mockAbstractOp.processObjResponse(any(), anyString())).thenReturn(mockObject); assertThat(mockAbstractOp.processObjResponse(mock(Message.class), "string")) .isEqualTo(mockObject); }