@Test
  public void testSyncOnCreate() throws IOException {
    /* check that both storage systems are empty */
    assertTrue(notebookRepoSync.getRepoCount() > 1);
    assertEquals(0, notebookRepoSync.list(0).size());
    assertEquals(0, notebookRepoSync.list(1).size());

    /* create note */
    Note note = notebookSync.createNote();

    // check that automatically saved on both storages
    assertEquals(1, notebookRepoSync.list(0).size());
    assertEquals(1, notebookRepoSync.list(1).size());
    assertEquals(notebookRepoSync.list(0).get(0).getId(), notebookRepoSync.list(1).get(0).getId());
  }
  @Test
  public void testSyncOnReloadedList() throws IOException {
    /* check that both storage repos are empty */
    assertTrue(notebookRepoSync.getRepoCount() > 1);
    assertEquals(0, notebookRepoSync.list(0).size());
    assertEquals(0, notebookRepoSync.list(1).size());

    File srcDir = new File("src/test/resources/2A94M5J1Z");
    File destDir = new File(secNotebookDir + "/2A94M5J1Z");

    /* copy manually new notebook into secondary storage repo and check repos */
    try {
      FileUtils.copyDirectory(srcDir, destDir);
    } catch (IOException e) {
      LOG.error(e.toString(), e);
    }
    assertEquals(0, notebookRepoSync.list(0).size());
    assertEquals(1, notebookRepoSync.list(1).size());

    // After reloading notebooks repos should be synchronized
    notebookSync.reloadAllNotes();
    assertEquals(1, notebookRepoSync.list(0).size());
    assertEquals(1, notebookRepoSync.list(1).size());
  }
  @Test
  public void testSyncOnDelete() throws IOException {
    /* create note */
    assertTrue(notebookRepoSync.getRepoCount() > 1);
    assertEquals(0, notebookRepoSync.list(0).size());
    assertEquals(0, notebookRepoSync.list(1).size());

    Note note = notebookSync.createNote();

    /* check that created in both storage systems */
    assertEquals(1, notebookRepoSync.list(0).size());
    assertEquals(1, notebookRepoSync.list(1).size());
    assertEquals(notebookRepoSync.list(0).get(0).getId(), notebookRepoSync.list(1).get(0).getId());

    /* remove Note */
    notebookSync.removeNote(notebookRepoSync.list(0).get(0).getId());

    /* check that deleted in both storages */
    assertEquals(0, notebookRepoSync.list(0).size());
    assertEquals(0, notebookRepoSync.list(1).size());
  }
  @Test
  public void testSyncUpdateMain() throws IOException {

    /* create note */
    Note note = notebookSync.createNote();
    Paragraph p1 = note.addParagraph();
    Map config = p1.getConfig();
    config.put("enabled", true);
    p1.setConfig(config);
    p1.setText("hello world");

    /* new paragraph exists in note instance */
    assertEquals(1, note.getParagraphs().size());

    /* new paragraph not yet saved into storages */
    assertEquals(
        0, notebookRepoSync.get(0, notebookRepoSync.list(0).get(0).getId()).getParagraphs().size());
    assertEquals(
        0, notebookRepoSync.get(1, notebookRepoSync.list(1).get(0).getId()).getParagraphs().size());

    /* save to storage under index 0 (first storage) */
    notebookRepoSync.save(0, note);

    /* check paragraph saved to first storage */
    assertEquals(
        1, notebookRepoSync.get(0, notebookRepoSync.list(0).get(0).getId()).getParagraphs().size());
    /* check paragraph isn't saved to second storage */
    assertEquals(
        0, notebookRepoSync.get(1, notebookRepoSync.list(1).get(0).getId()).getParagraphs().size());
    /* apply sync */
    notebookRepoSync.sync();
    /* check whether added to second storage */
    assertEquals(
        1, notebookRepoSync.get(1, notebookRepoSync.list(1).get(0).getId()).getParagraphs().size());
    /* check whether same paragraph id */
    assertEquals(
        p1.getId(),
        notebookRepoSync
            .get(0, notebookRepoSync.list(0).get(0).getId())
            .getLastParagraph()
            .getId());
    assertEquals(
        p1.getId(),
        notebookRepoSync
            .get(1, notebookRepoSync.list(1).get(0).getId())
            .getLastParagraph()
            .getId());
  }
 @Test
 public void testRepoCount() throws IOException {
   assertTrue(notebookRepoSync.getMaxRepoNum() >= notebookRepoSync.getRepoCount());
 }