### Question:
OAuthConsumerDAO extends AbstractSearcherDAO implements IOAuthConsumerDAO { @Override public ConsumerRecordVO getConsumer(String clientId) { Connection conn = null; ConsumerRecordVO consumer = null; PreparedStatement stat = null; ResultSet res = null; try { conn = this.getConnection(); String query = SELECT_CONSUMER; stat = conn.prepareStatement(query); stat.setString(1, clientId); res = stat.executeQuery(); if (res.next()) { consumer = consumerFromResultSet(res); } } catch (SQLException | ApsSystemException t) { logger.error("Error while loading consumer by clientid {}", clientId, t); throw new RuntimeException("Error while loading consumer by key " + clientId, t); } finally { closeDaoResources(res, stat, conn); } return consumer; }  @Override List<String> getConsumerKeys(FieldSearchFilter<?>[] filters); @Override ConsumerRecordVO getConsumer(String clientId); @Override List<ConsumerRecordVO> getConsumers(FieldSearchFilter<?>[] filters); @Override ConsumerRecordVO addConsumer(ConsumerRecordVO consumer); @Override ConsumerRecordVO updateConsumer(ConsumerRecordVO consumer); @Override void deleteConsumer(String clientId);  }### Answer:
@Test public void getConsumer() throws Exception { when(this.stat.executeQuery()).thenReturn(res); Mockito.when(res.next()).thenReturn(true).thenReturn(false); Mockito.when(res.getString("consumerkey")).thenReturn("client_id"); Mockito.when(res.getString("consumersecret")).thenReturn("secret"); ConsumerRecordVO consumer = this.consumerDAO.getConsumer("client_id"); Assert.assertNotNull(consumer); Assert.assertEquals("client_id", consumer.getKey()); Assert.assertEquals("secret", consumer.getSecret()); this.executeFinalCheck(true); }