GCSNotebookRepo implements NotebookRepo { @Override public void remove(String noteId, String notePath, AuthenticationInfo subject) throws IOException { Preconditions.checkArgument(!Strings.isNullOrEmpty(noteId)); BlobId blobId = makeBlobId(noteId, notePath); try { boolean deleted = storage.delete(blobId); if (!deleted) { throw new IOException("Tried to remove nonexistent blob " + blobId.toString()); } } catch (StorageException se) { throw new IOException("Could not remove " + blobId.toString() + ": " + se.getMessage(), se); } } GCSNotebookRepo(); @VisibleForTesting  GCSNotebookRepo(ZeppelinConfiguration zConf, Storage storage); @Override void init(ZeppelinConfiguration zConf); @Override Map<String, NoteInfo> list(AuthenticationInfo subject); @Override Note get(String noteId, String notePath, AuthenticationInfo subject); @Override void save(Note note, AuthenticationInfo subject); @Override void move(String noteId, String notePath, String newNotePath, AuthenticationInfo subject); @Override void move(String folderPath, String newFolderPath, AuthenticationInfo subject); @Override void remove(String noteId, String notePath, AuthenticationInfo subject); @Override void remove(String folderPath, AuthenticationInfo subject); @Override void close(); @Override List<NotebookRepoSettingsInfo> getSettings(AuthenticationInfo subject); @Override void updateSettings(Map<String, String> settings, AuthenticationInfo subject);  }
@Test public void testRemove_nonexistent() throws Exception { try { notebookRepo.remove("id", "/name", AUTH_INFO); fail(); } catch (IOException e) {} }
@Test public void testRemove() throws Exception { create(runningNote); notebookRepo.remove(runningNote.getId(), runningNote.getPath(), AUTH_INFO); assertThat(storage.get(makeBlobId(runningNote.getId(), runningNote.getPath()))).isNull(); }