### Question:
CommonsQueryEngine implements IQueryEngine { @Override public final QueryResult execute(String queryId, LogicalWorkflow workflow) throws ConnectorException { QueryResult result = null; Long time = null; try { for (LogicalStep project : workflow.getInitialSteps()) { ClusterName clusterName = ((Project) project).getClusterName(); connectionHandler.startJob(clusterName.getName()); } if (logger.isDebugEnabled()) { logger.debug("Executing [" + workflow.toString() + "]"); } time = System.currentTimeMillis(); result = executeWorkFlow(workflow); if (logger.isDebugEnabled()) { logger.debug( "The query has finished. The result form the query [" + workflow.toString() + "] has returned " + "[" + result .getResultSet() .size() + "] rows"); } } finally { for (LogicalStep project : workflow.getInitialSteps()) { connectionHandler.endJob(((Project) project).getClusterName().getName()); } if (time != null) { logger.info("TIME - The execute time has been [" + (System.currentTimeMillis() - time) + "]"); } } return result; } protected  CommonsQueryEngine(ConnectionHandler connectionHandler); @Override final void asyncExecute(String queryId, LogicalWorkflow workflow, IResultHandler resultHandler); @Override final void pagedExecute(String queryId, LogicalWorkflow workflow, IResultHandler resultHandler,
                                   int pageSize); @Override final QueryResult execute(String queryId, LogicalWorkflow workflow);  }### Answer:
@Test public void testExecuteWorkflowLog() throws ConnectorException { LogicalWorkflow logicalworkFlow = mock(LogicalWorkflow.class); Logger logger = mock(Logger.class); Whitebox.setInternalState(commonsQueryEngineStub, "logger", logger); when(logger.isDebugEnabled()).thenReturn(true); QueryResult result = commonsQueryEngineStub.execute("", logicalworkFlow); verify(logger).debug("Executing [" + logicalworkFlow.toString() + "]"); verify(logger).debug("The query has finished. The result form the query [" + logicalworkFlow.toString() + "] has returned [" + result.getResultSet().size() + "] rows"); }