private void removeNote(Note note, AuthenticationInfo subject) throws IOException {
    LOGGER.info("Remove note: {}", note.getId());
    // Set Remove to true to cancel saving this note
    note.setRemoved(true);
    noteManager.removeNote(note.getId(), subject);
    authorizationService.removeNoteAuth(note.getId());
    fireNoteRemoveEvent(note, subject);
  }
@Test
  void testRemoveNote() throws IOException, InterruptedException {
    try {
      LOGGER.info("--------------- Test testRemoveNote ---------------");
      // create a note and a paragraph
      String noteId = notebook.createNote("note1", anonymous);
      int mock1ProcessNum = interpreterSettingManager.getByName("mock1").getAllInterpreterGroups().size();
      Paragraph p = notebook.processNote(noteId,
        note -> {
          return note.addNewParagraph(AuthenticationInfo.ANONYMOUS);
        });
      Map<String, Object> config = new HashMap<>();
      p.setConfig(config);
      p.setText("%mock1 sleep 100000");
      p.execute(false);
      // wait until it is running
      while (!p.isRunning()) {
        try {
          Thread.sleep(1000);
        } catch (InterruptedException e) {
          e.printStackTrace();
        }
      }
      assertEquals(mock1ProcessNum + 1, interpreterSettingManager.getByName("mock1").getAllInterpreterGroups().size());
      LOGGER.info("--------------- Finish Test testRemoveNote ---------------");
      notebook.removeNote(noteId, anonymous);
      // stop interpreter process is async, so we wait for 5 seconds here.
      Thread.sleep(5 * 1000);
      assertEquals(mock1ProcessNum, interpreterSettingManager.getByName("mock1").getAllInterpreterGroups().size());

      LOGGER.info("--------------- Finish Test testRemoveNote ---------------");
    } catch (Exception e) {
      e.printStackTrace();
    }
  }