### Question:
ExploreStatement implements Statement { @Override public boolean execute(String sql) throws SQLException { if (isClosed) { throw new SQLException("Can't execute after statement has been closed"); } if (resultSet != null) { resultSet.close(); resultSet = null; } futureResults = exploreClient.submit(namespace, sql); try { resultSet = new ExploreResultSet(futureResults.get(), this, maxRows); return true; } catch (InterruptedException e) { LOG.error("Caught exception", e); Thread.currentThread().interrupt(); return false; } catch (ExecutionException e) { Throwable t = Throwables.getRootCause(e); if (t instanceof HandleNotFoundException) { LOG.error("Error executing query", e); throw new SQLException("Unknown state"); } LOG.error("Caught exception", e); throw new SQLException(Throwables.getRootCause(e)); } catch (CancellationException e) { return false; } } ExploreStatement(Connection connection, ExploreClient exploreClient, String namespace); @Override ResultSet executeQuery(String sql); @Override boolean execute(String sql); @Override ResultSet getResultSet(); @Override int getMaxRows(); @Override void setMaxRows(int max); @Override int getUpdateCount(); @Override void setFetchSize(int i); @Override int getFetchSize(); @Override void close(); @Override boolean isClosed(); @Override void cancel(); @Override Connection getConnection(); @Override int executeUpdate(String sql); @Override int getMaxFieldSize(); @Override void setMaxFieldSize(int i); @Override void setEscapeProcessing(boolean b); @Override int getQueryTimeout(); @Override void setQueryTimeout(int i); @Override SQLWarning getWarnings(); @Override void clearWarnings(); @Override void setCursorName(String s); @Override boolean getMoreResults(); @Override void setFetchDirection(int i); @Override int getFetchDirection(); @Override int getResultSetConcurrency(); @Override int getResultSetType(); @Override void addBatch(String s); @Override void clearBatch(); @Override int[] executeBatch(); @Override boolean getMoreResults(int i); @Override ResultSet getGeneratedKeys(); @Override int executeUpdate(String s, int i); @Override int executeUpdate(String s, int[] ints); @Override int executeUpdate(String s, String[] strings); @Override boolean execute(String s, int i); @Override boolean execute(String s, int[] ints); @Override boolean execute(String s, String[] strings); @Override int getResultSetHoldability(); @Override void setPoolable(boolean b); @Override boolean isPoolable(); @Override T unwrap(Class<T> tClass); @Override boolean isWrapperFor(Class<?> aClass); @Override void closeOnCompletion(); @Override boolean isCloseOnCompletion();  }### Answer:
@Test public void executeTest() throws Exception { List<ColumnDesc> columnDescriptions = Lists.newArrayList(new ColumnDesc("column1", "STRING", 1, "")); List<QueryResult> queryResults = Lists.newArrayList(); ExploreClient exploreClient = new MockExploreClient( ImmutableMap.of( "mock_query_1", columnDescriptions, "mock_query_2", columnDescriptions, "mock_query_3", columnDescriptions, "mock_query_4", columnDescriptions ), ImmutableMap.of( "mock_query_1", queryResults, "mock_query_2", queryResults, "mock_query_3", queryResults, "mock_query_4", queryResults ) ); ExploreStatement statement = new ExploreStatement(null, exploreClient, "ns1"); Assert.assertTrue(statement.execute("mock_query_1")); ResultSet rs = statement.getResultSet(); Assert.assertNotNull(rs); Assert.assertFalse(rs.isClosed()); Assert.assertFalse(rs.next()); rs = statement.executeQuery("mock_query_2"); Assert.assertNotNull(rs); Assert.assertFalse(rs.isClosed()); Assert.assertFalse(rs.next()); ResultSet rs2 = statement.executeQuery("mock_query_3"); Assert.assertTrue(rs.isClosed()); Assert.assertNotNull(rs2); Assert.assertFalse(rs2.isClosed()); Assert.assertFalse(rs2.next()); Assert.assertTrue(statement.execute("mock_query_4")); Assert.assertTrue(rs2.isClosed()); }