@Override
  public synchronized void cleanupAll() {
    if (notificationList.size() > 0) {
      for (Notification notification : notificationList) {
        client.deleteNotification(bucket, notification.getNotificationId());
      }
    }

    if (managedTempDirs.size() > 0) {
      LOG.info("managed temp dir size : {}", managedTempDirs.size());
      for (String tempDir : managedTempDirs) {
        LOG.info("Cleaning up everything under '{}' under bucket '{}'", tempDir, bucket);
        Page<Blob> firstPage = getFirstPage(tempDir);
        consumePages(
            firstPage,
            blobs -> {
              // For testability, use the Iterable<BlobId> overload
              List<BlobId> blobIds = new ArrayList<>();
              for (Blob blob : blobs) {
                blobIds.add(blob.getBlobId());
              }
              if (blobIds.isEmpty()) {
                return;
              }

              List<Boolean> deleted = client.delete(blobIds);
              for (int i = 0; i < deleted.size(); ++i) {
                if (deleted.get(i)) {
                  LOG.debug("Blob '{}' was deleted", blobIds.get(i).getName());
                } else {
                  LOG.warn("Blob '{}' not deleted", blobIds.get(i).getName());
                }
              }
            });
      }
    }
    managedTempDirs.clear();
    notificationList.clear();
  }
@Test
  public void testDeleteArtifactsNoArtifacts() {
    TestBlobPage allPages = createPages(ImmutableList.of());
    when(client.list(anyString(), any(BlobListOption.class))).thenReturn(allPages);

    gcsClient.cleanupAll();

    verify(client, never()).delete(anyIterable());
  }