### Question:
OAuthConsumerManager extends AbstractOAuthManager implements IOAuthConsumerManager { @Override public ConsumerRecordVO updateConsumer(ConsumerRecordVO consumer) throws ApsSystemException { try { return this.getConsumerDAO().updateConsumer(consumer); } catch (Throwable t) { logger.error("Error updating consumer", t); throw new ApsSystemException("Error updating consumer", t); } }  @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 public void updateConsumer() throws Exception { ConsumerRecordVO record = this.createMockConsumer("key_1", "secret", false); this.consumerManager.updateConsumer(record); Mockito.verify(consumerDAO, Mockito.times(1)).updateConsumer(Mockito.any(ConsumerRecordVO.class)); }
@Test(expected = ApsSystemException.class) public void failUpdateConsumer() throws Exception { ConsumerRecordVO record = this.createMockConsumer("key_2", "secret", false); Mockito.doThrow(RuntimeException.class).when(this.consumerDAO).updateConsumer(record); try { this.consumerManager.updateConsumer(record); } catch (ApsSystemException e) { throw e; } finally { Mockito.verify(consumerDAO, Mockito.times(1)).updateConsumer(Mockito.any(ConsumerRecordVO.class)); } }