### Question:
UpdateAgendaResidentHandler extends BaseResidentHandler<UpdateAgendaHandlerInput, OperationProgressFactory> { @Override public String execute(UpdateAgendaHandlerInput handlerInput) { UpdateAgendaHandlerOutput updateAgendaHandlerOutput = new UpdateAgendaHandlerOutput(); updateAgendaHandlerOutput.setOperations(processOperations(handlerInput.getOperations())); updateAgendaHandlerOutput.setParams(handlerInput.getParams()); updatePersistedAgenda(handlerInput); getProgressReporter().reportProgress(getOperationProgressFactory().create(ProcessingState.COMPLETE, CompleteStateMessage.SUCCEEDED.toString())); return new JsonHelper().getJSONString(updateAgendaHandlerOutput); } UpdateAgendaResidentHandler(ExecutorContext executorContext); @Override String execute(UpdateAgendaHandlerInput handlerInput); @Override OperationProgressFactory getOperationProgressFactory(); @Override Class<UpdateAgendaHandlerInput> getPayloadClassType(); void setResourcePoolAgendaUpdater(ResourcePoolAgendaUpdater resourcePoolAgendaUpdater);  }### Answer:
@Test public void testSuccessfulUpdate() { doReturn(new UpdateAgendaResponse()).when(mockResourcePoolAgendaUpdater).update(any(), any()); handler.execute(updateAgendaHandlerInput); verify(mockResourcePoolAgendaUpdater, times(1)).update(any(), any()); verifyOperationsAdjusted(); }
@Test public void testSuccessfulUpdateNoResourcePoolClient() { doReturn(null).when(mockExecutorContext).getResourcePoolServiceClient(); handler.execute(updateAgendaHandlerInput); verify(mockResourcePoolAgendaUpdater, times(0)).update(any(), any()); verifyOperationsAdjusted(); }
@Test(expectedExceptions = RuntimeException.class, expectedExceptionsMessageRegExp = ".*Failed to persist Agenda with generated operations.*") public void testErrorReponse() { UpdateAgendaResponse expandAgendaResponse = new UpdateAgendaResponse(); expandAgendaResponse.setErrorResponse(new ErrorResponse()); doReturn(expandAgendaResponse).when(mockResourcePoolAgendaUpdater).update(any(), any()); handler.execute(updateAgendaHandlerInput); }
@Test(expectedExceptions = RuntimeException.class, expectedExceptionsMessageRegExp = ".*Failed to persist Agenda with generated operations.*") public void testNullResponse() { doReturn(null).when(mockResourcePoolAgendaUpdater).update(any(), any()); handler.execute(updateAgendaHandlerInput); }