### Question:
OAuthConsumerManager extends AbstractOAuthManager implements IOAuthConsumerManager { @Override public List<String> getConsumerKeys(FieldSearchFilter<?>[] filters) throws ApsSystemException { List<String> consumerKeys = null; try { consumerKeys = this.getConsumerDAO().getConsumerKeys(filters); } catch (Throwable t) { logger.error("Error extracting consumer keys", t); throw new ApsSystemException("Error extracting consumer keys", t); } return consumerKeys; }  @Override void init(); @Override ClientDetails loadClientByClientId(String clientId); @Override ConsumerRecordVO getConsumerRecord(String consumerKey); @Override ConsumerRecordVO addConsumer(ConsumerRecordVO consumer); @Override ConsumerRecordVO updateConsumer(ConsumerRecordVO consumer); @Override void deleteConsumer(String clientId); @Override List<String> getConsumerKeys(FieldSearchFilter<?>[] filters); void setConsumerDAO(IOAuthConsumerDAO consumerDAO); @Override List<ConsumerRecordVO> getConsumers(FieldSearchFilter<?>[] filters);  }### Answer:
@Test(expected = ApsSystemException.class) public void failGetConsumerKeys_2() throws Exception { Mockito.doThrow(RuntimeException.class).when(this.consumerDAO).getConsumerKeys(Mockito.any(FieldSearchFilter[].class)); try { List<String> keys = this.consumerManager.getConsumerKeys(new FieldSearchFilter[]{}); } catch (ApsSystemException e) { throw e; } finally { Mockito.verify(consumerDAO, Mockito.times(1)).getConsumerKeys(Mockito.any(FieldSearchFilter[].class)); } }
@Test public void getConsumerKeys() throws Exception { List<String> mockKeys = new ArrayList<>(); mockKeys.add("key_1"); when(this.consumerDAO.getConsumerKeys(Mockito.any(FieldSearchFilter[].class))).thenReturn(mockKeys); List<String> keys = this.consumerManager.getConsumerKeys(new FieldSearchFilter[]{}); Assert.assertNotNull(keys); Assert.assertEquals(1, keys.size()); Mockito.verify(consumerDAO, Mockito.times(1)).getConsumerKeys(Mockito.any(FieldSearchFilter[].class)); }