### Question:
BackupCopyService { void moveBackupLocation( Path oldLocation, Path newLocation ) throws IOException { try { File source = oldLocation.toFile(); File target = newLocation.toFile(); Iterator<FileMoveAction> moves = fileMoveProvider.traverseForMoving( source ).iterator(); while ( moves.hasNext() ) { moves.next().move( target ); } oldLocation.toFile().delete(); } catch ( IOException e ) { throw new IOException( "Failed to rename backup directory from " + oldLocation + " to " + newLocation, e ); } } BackupCopyService( FileSystemAbstraction fs, FileMoveProvider fileMoveProvider );   }### Answer:
@Test public void logicForMovingBackupsIsDelegatedToFileMovePropagator() throws IOException { Path parentDirectory = testDirectory.directory( "parent" ).toPath(); Path oldLocation = parentDirectory.resolve( "oldLocation" ); Files.createDirectories( oldLocation ); Path newLocation = parentDirectory.resolve( "newLocation" ); FileMoveAction fileOneMoveAction = mock( FileMoveAction.class ); FileMoveAction fileTwoMoveAction = mock( FileMoveAction.class ); when( fileMoveProvider.traverseForMoving( any() ) ).thenReturn( Stream.of( fileOneMoveAction, fileTwoMoveAction ) ); subject.moveBackupLocation( oldLocation, newLocation ); verify( fileMoveProvider ).traverseForMoving( oldLocation.toFile() ); verify( fileOneMoveAction ).move( newLocation.toFile() ); verify( fileTwoMoveAction ).move( newLocation.toFile() ); }