FinishBackupRequest extends CliLegacyMessage { @Override protected AdminResponse createResponse(DistributionManager dm) { HashSet<PersistentID> persistentIds; try { persistentIds = finishBackupFactory.createFinishBackup(dm.getCache()).run(); } catch (IOException e) { logger.error(String.format("Error processing request %s.", getClass()), e); return AdminFailureResponse.create(getSender(), e); } return finishBackupFactory.createBackupResponse(getSender(), persistentIds); } FinishBackupRequest();   FinishBackupRequest(InternalDistributedMember sender, Set<InternalDistributedMember> recipients,
      int processorId, FinishBackupFactory finishBackupFactory); @Override int getDSFID();  }
@Test public void usesFactoryToCreateFinishBackup() throws Exception { finishBackupRequest.createResponse(dm); verify(finishBackupFactory, times(1)).createFinishBackup(eq(cache)); }
@Test public void usesFactoryToCreateBackupResponse() throws Exception { finishBackupRequest.createResponse(dm); verify(finishBackupFactory, times(1)).createBackupResponse(eq(sender), eq(persistentIds)); }
@Test public void returnsBackupResponse() throws Exception { assertThat(finishBackupRequest.createResponse(dm)).isInstanceOf(BackupResponse.class); }
@Test public void returnsAdminFailureResponseWhenFinishBackupThrowsIOException() throws Exception { when(finishBackup.run()).thenThrow(new IOException()); assertThat(finishBackupRequest.createResponse(dm)).isInstanceOf(AdminFailureResponse.class); }