@Test
  public void testTagSnapshot() throws DataProviderException {
    Snapshot snap =
        dataProvider.tagSnapshot(branchSnapshot, Optional.of("name"), Optional.of("message"));
    assertEquals(branchSnapshot, snap);
    verify(notifier, times(1)).snapshotTagged(snap);
    verify(notifier, only()).snapshotTagged(snap);
    Mockito.reset(notifier);

    snap = dataProvider.tagSnapshot(branchSnapshot, Optional.of("name2"), Optional.of("message"));
    assertEquals(branchSnapshot, snap);
    verify(notifier, times(1)).synchronised();
    verify(notifier, only()).synchronised();

    try {
      dataProvider.tagSnapshot(branchSnapshot, Optional.of("name4"), Optional.of("message"));
      fail("Exception should happen");
    } catch (DataProviderException e) {
      assertNotNull(e.getMessage());
    }
    verify(notifier, times(1)).synchronised();
    verify(notifier, only()).synchronised();

    Mockito.reset(notifier);
    snap = dataProvider.tagSnapshot(branchSnapshot, Optional.of("name3"), Optional.of("message"));
    assertNull(snap);
    verify(notifier, never()).synchronised();
  }
  @Test
  public void testSaveSnapshot() throws DataProviderException {
    VSnapshot snap = dataProvider.saveSnapshot(snapshot, "comment");
    assertTrue(snap.equalsExceptSnapshot(snapshot));
    verify(notifier, times(1)).snapshotSaved(snap);
    verify(notifier, only()).snapshotSaved(snap);
    Mockito.reset(notifier);

    snap = dataProvider.saveSnapshot(snapshot, "comment2");
    assertTrue(snap.equalsExceptSnapshot(snapshot));
    verify(notifier, times(1)).synchronised();
    verify(notifier, only()).synchronised();

    try {
      dataProvider.saveSnapshot(snapshot, "comment4");
      fail("Exception should happen");
    } catch (DataProviderException e) {
      assertNotNull(e.getMessage());
    }
    verify(notifier, times(1)).synchronised();
    verify(notifier, only()).synchronised();

    Mockito.reset(notifier);

    snap = dataProvider.saveSnapshot(snapshot, "comment3");
    assertNull(snap);
    verify(notifier, never()).synchronised();
  }
  @Test
  public void testDeleteSaveSet() throws DataProviderException {
    boolean b = dataProvider.deleteSaveSet(branchSaveSet, "comment");
    assertTrue(b);
    verify(notifier, times(1)).saveSetDeleted(branchSaveSet);
    verify(notifier, only()).saveSetDeleted(branchSaveSet);
    Mockito.reset(notifier);

    b = dataProvider.deleteSaveSet(branchSaveSet, "comment4");
    assertFalse(b);
    verify(notifier, never()).synchronised();
    Mockito.reset(notifier);

    b = dataProvider.deleteSaveSet(branchSaveSet, "comment2");
    assertTrue(b);
    verify(notifier, times(1)).synchronised();
    verify(notifier, only()).synchronised();

    try {
      dataProvider.deleteSaveSet(branchSaveSet, "comment3");
      fail("Exception should happen");
    } catch (DataProviderException e) {
      assertNotNull(e.getMessage());
    }
    verify(notifier, times(1)).synchronised();
    verify(notifier, only()).synchronised();
  }
  @Test
  public void testCreateNewBranch() throws DataProviderException {
    Branch newBranch = dataProvider.createNewBranch(branch, "someBranch");
    assertEquals(someBranch, newBranch);
    verify(notifier, times(1)).branchCreated(newBranch);
    verify(notifier, only()).branchCreated(newBranch);

    try {
      dataProvider.createNewBranch(branch, "bla");
      fail("Exception should happen");
    } catch (DataProviderException e) {
      assertNotNull(e.getMessage());
    }
    verify(notifier, times(1)).branchCreated(newBranch);
    verify(notifier, only()).branchCreated(newBranch);
  }
  @Test
  public void testSaveSaveSet() throws DataProviderException {
    SaveSetData data = dataProvider.saveSaveSet(bsd, "comment");
    assertEquals(bsd, data);
    verify(notifier, times(1)).saveSetSaved(data);
    verify(notifier, only()).saveSetSaved(data);
    Mockito.reset(notifier);

    data = dataProvider.saveSaveSet(bsd, "comment2");
    assertEquals(bsd, data);
    verify(notifier, times(1)).synchronised();
    verify(notifier, only()).synchronised();

    try {
      dataProvider.saveSaveSet(bsd, "comment3");
      fail("Exception should happen");
    } catch (DataProviderException e) {
      assertNotNull(e.getMessage());
    }
    verify(notifier, times(1)).synchronised();
    verify(notifier, only()).synchronised();
  }