public String cloneNote(String sourceNoteId, String newNotePath, AuthenticationInfo subject)
          throws IOException {
    return cloneNote(sourceNoteId, "", newNotePath, subject);
  }
@Test
  void testCloneNote() throws Exception {
    String noteId = notebook.createNote("note1", anonymous);
    notebook.processNote(noteId,
      note -> {
        final Paragraph p = note.addNewParagraph(AuthenticationInfo.ANONYMOUS);
        p.setText("hello world");
        try {
          note.runAll(anonymous, true, false, new HashMap<>());
        } catch (Exception e) {
          fail();
        }

        p.setStatus(Status.RUNNING);
        return null;
      });

    String cloneNoteId = notebook.cloneNote(noteId, "clone note", anonymous);
    notebook.processNote(noteId,
      note -> {
        Paragraph p = note.getParagraph(0);
        notebook.processNote(cloneNoteId,
          cloneNote -> {
            Paragraph cp = cloneNote.getParagraph(0);
            assertEquals(Status.READY, cp.getStatus());
            // Keep same ParagraphId
            assertEquals(cp.getId(), p.getId());
            assertEquals(cp.getText(), p.getText());
            assertEquals(cp.getReturn().message().get(0).getData(), p.getReturn().message().get(0).getData());
            return null;
          });
        return null;
      });


    // Verify clone note with subject
    AuthenticationInfo subject = new AuthenticationInfo("user1");
    String cloneNote2Id = notebook.cloneNote(noteId, "clone note2", subject);
    assertNotNull(authorizationService.getOwners(cloneNote2Id));
    assertEquals(1, authorizationService.getOwners(cloneNote2Id).size());
    Set<String> owners = new HashSet<>();
    owners.add("user1");
    assertEquals(owners, authorizationService.getOwners(cloneNote2Id));
    notebook.removeNote(noteId, anonymous);
    notebook.removeNote(cloneNoteId, anonymous);
    notebook.removeNote(cloneNote2Id, anonymous);
  }