### Question:
GoogleVideosImporter implements Importer<TokensAndUrlAuthData, VideosContainerResource> { long importVideoBatch( List<VideoObject> batchedVideos, PhotosLibraryClient client, IdempotentImportExecutor executor) throws Exception { final ArrayList<NewMediaItem> mediaItems = new ArrayList<>(); final HashMap<String, VideoObject> uploadTokenToDataId = new HashMap<>(); final HashMap<String, Long> uploadTokenToLength = new HashMap<>(); try { for (VideoObject video : batchedVideos) { try { Pair<String, Long> pair = uploadMediaItem(video, client); final String uploadToken = pair.getLeft(); mediaItems.add(buildMediaItem(video, uploadToken)); uploadTokenToDataId.put(uploadToken, video); uploadTokenToLength.put(uploadToken, pair.getRight()); } catch (IOException e) { if (e instanceof FileNotFoundException) { monitor.info( () -> String.format("Video resource was missing for id: %s", video.getDataId()), e); continue; } executor.executeAndSwallowIOExceptions( video.getDataId(), video.getName(), () -> { throw e; }); } } if (mediaItems.isEmpty()) { return 0L; } BatchCreateMediaItemsResponse response = client.batchCreateMediaItems(mediaItems); final List<NewMediaItemResult> resultsList = response.getNewMediaItemResultsList(); long bytes = 0L; for (NewMediaItemResult result : resultsList) { String uploadToken = result.getUploadToken(); Status status = result.getStatus(); final VideoObject video = uploadTokenToDataId.get(uploadToken); Preconditions.checkNotNull(video); final int code = status.getCode(); if (code == Code.OK_VALUE) { executor.executeAndSwallowIOExceptions( video.getDataId(), video.getName(), () -> result.getMediaItem().getId()); Long length = uploadTokenToLength.get(uploadToken); if (length != null) { bytes += length; } } else { executor.executeAndSwallowIOExceptions( video.getDataId(), video.getName(), () -> { throw new IOException( String.format( "Video item could not be created. Code: %d Message: %s", code, result.getStatus().getMessage())); }); } uploadTokenToDataId.remove(uploadToken); } if (!uploadTokenToDataId.isEmpty()) { for (VideoObject video : uploadTokenToDataId.values()) { executor.executeAndSwallowIOExceptions( video.getDataId(), video.getName(), () -> { throw new IOException("Video item was missing from results list."); }); } } return bytes; } catch (InvalidArgumentException e) { if (e.getMessage().contains("The remaining storage in the user's account is not enough")) { throw new DestinationMemoryFullException("Google destination storage full", e); } else { throw e; } } } GoogleVideosImporter(
      AppCredentials appCredentials, TemporaryPerJobDataStore dataStore, Monitor monitor);   GoogleVideosImporter(
      AppCredentials appCredentials,
      TemporaryPerJobDataStore dataStore,
      Monitor monitor,
      ImageStreamProvider videoStreamProvider); @Override ImportResult importItem(
      UUID jobId,
      IdempotentImportExecutor executor,
      TokensAndUrlAuthData authData,
      VideosContainerResource data);  }### Answer:
@Test public void skipNotFoundVideo() throws Exception { PhotosLibraryClient photosLibraryClient = mock(PhotosLibraryClient.class); HttpURLConnection httpURLConnection = mock(HttpURLConnection.class); when(httpURLConnection.getInputStream()).thenThrow(new FileNotFoundException()); when(streamProvider.getConnection(any())).thenReturn(httpURLConnection); InMemoryIdempotentImportExecutor executor = new InMemoryIdempotentImportExecutor(mock(Monitor.class)); long length = googleVideosImporter.importVideoBatch( Lists.newArrayList( new VideoObject( VIDEO_TITLE, VIDEO_URI, VIDEO_DESCRIPTION, MP4_MEDIA_TYPE, VIDEO_ID, null, false)), photosLibraryClient, executor); assertEquals("Expected the number of bytes to be 0L.", 0L, length); assertEquals("Expected executor to have no errors.", 0, executor.getErrors().size()); }