JdbcEndpointAdapterController implements JdbcController, EndpointAdapter { @Override public DataSet executeQuery(String query) throws JdbcServerException { log.info("Received execute query request: " + query); Message response = handleMessageAndCheckResponse(JdbcMessage.execute(query)); return dataSetCreator.createDataSet(response, getMessageType(response)); } JdbcEndpointAdapterController(
            JdbcEndpointConfiguration endpointConfiguration,
            EndpointAdapter delegate);   JdbcEndpointAdapterController(
            JdbcEndpointConfiguration endpointConfiguration,
            EndpointAdapter delegate,
            DataSetCreator dataSetCreator); @Override Message handleMessage(Message request); @Override void openConnection(Map<String, String> properties); @Override void closeConnection(); @Override void createPreparedStatement(String stmt); @Override void createStatement(); @Override DataSet executeQuery(String query); @Override DataSet executeStatement(String stmt); @Override int executeUpdate(String updateSql); @Override void closeStatement(); @Override void setTransactionState(boolean transactionState); @Override boolean getTransactionState(); @Override void commitStatements(); @Override void rollbackStatements(); @Override void createCallableStatement(String sql); @Override Endpoint getEndpoint(); @Override EndpointConfiguration getEndpointConfiguration();  }
@Test public void testExecuteQuery(){ final DataSet expectedDataSet = mock(DataSet.class); final DataSetCreator dataSetCreator = mock(DataSetCreator.class); when(dataSetCreator.createDataSet(any(), any())).thenReturn(expectedDataSet); final JdbcEndpointAdapterController jdbcEndpointAdapterController = spy(new JdbcEndpointAdapterController(jdbcEndpointConfiguration, endpointAdapter, dataSetCreator)); final Message messageToMarshal = mock(Message.class); when(messageToMarshal.getType()).thenReturn(MessageType.JSON.toString()); doReturn(messageToMarshal).when(jdbcEndpointAdapterController).handleMessage(any()); final String query = "some query"; final DataSet dataSet = jdbcEndpointAdapterController.executeQuery(query); verify(jdbcEndpointAdapterController).handleMessage(any()); verify(dataSetCreator).createDataSet(messageToMarshal, MessageType.JSON); assertEquals(dataSet, expectedDataSet); }