@Override
  public ImportResult importItem(
      UUID jobId,
      IdempotentImportExecutor idempotentImportExecutor,
      TokensAndUrlAuthData authData,
      MusicContainerResource data)
      throws Exception {
    if (data == null) {
      // Nothing to do
      return ImportResult.OK;
    }

    // Update playlists
    for (MusicPlaylist playlist : data.getPlaylists()) {
      idempotentImportExecutor.executeAndSwallowIOExceptions(
          playlist.getId(),
          playlist.getTitle(),
          () -> importSinglePlaylist(jobId, authData, playlist));
    }

    // Create playlistItems
    importPlaylistItems(data.getPlaylistItems(), idempotentImportExecutor, jobId, authData);

    // TODO: create tracks

    // TODO: create releases

    return ImportResult.OK;
  }
@Test
  public void importPlaylist() throws Exception {
    // Set up
    MusicPlaylist playlist = new MusicPlaylist("p1_id", "p1_title", null, null, null);
    ImmutableList<MusicPlaylist> playlists = ImmutableList.of(playlist);
    MusicContainerResource data = new MusicContainerResource(playlists, null, null, null);

    GooglePlaylist responsePlaylist = new GooglePlaylist();
    responsePlaylist.setTitle("p1_title");
    when(googleMusicHttpApi.importPlaylist(any(GooglePlaylist.class), any(String.class)))
        .thenReturn(responsePlaylist);

    // Run test
    ImportResult importResult = googleMusicImporter.importItem(uuid, executor, null, data);

    // Check results
    ArgumentCaptor<GooglePlaylist> playlistArgumentCaptor =
        ArgumentCaptor.forClass(GooglePlaylist.class);
    ArgumentCaptor<String> playlistIdArgumentCaptor = ArgumentCaptor.forClass(String.class);
    verify(googleMusicHttpApi)
        .importPlaylist(playlistArgumentCaptor.capture(), playlistIdArgumentCaptor.capture());
    assertEquals("p1_title", playlistArgumentCaptor.getValue().getTitle());
    assertEquals("p1_id", playlistIdArgumentCaptor.getValue());
    assertTrue(executor.isKeyCached("p1_id"));
    assertEquals(importResult, ImportResult.OK);
  }