cuspymd commented on a change in pull request #4092: URL: https://github.com/apache/zeppelin/pull/4092#discussion_r612500675
########## File path: zeppelin-server/src/test/java/org/apache/zeppelin/service/NotebookServiceTest.java ########## @@ -331,6 +333,26 @@ public void testNoteOperations() throws IOException { assertEquals(0, notesInfo.size()); } + @Test + public void testRenameNoteRejectsDuplicate() throws IOException { + Note note1 = notebookService.createNote("/folder/note1", "test", true, context, callback); + assertEquals("note1", note1.getName()); + verify(callback).onSuccess(note1, context); + + reset(callback); + Note note2 = notebookService.createNote("/folder/note2", "test", true, context, callback); + assertEquals("note2", note2.getName()); + verify(callback).onSuccess(note2, context); + + reset(callback); + ArgumentCaptor<NotePathAlreadyExistsException> exception = ArgumentCaptor.forClass(NotePathAlreadyExistsException.class); + notebookService.renameNote(note1.getId(), "/folder/note2", false, context, callback); + verify(callback).onFailure(exception.capture(), any(ServiceContext.class)); Review comment: It would have been better to check that the newly added `broadcastNote()` call part works properly when the error occurs through the `NotebookServer::onMessage()` method test, but the test for that part seems quite complicated. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org