@Before
  public void setUp() throws Exception {
    GitAPIException exception =
        new GitAPIException("Problem") {
          private static final long serialVersionUID = 1L;
        };

    GitManager grm = mock(GitManager.class);
    notifier = mock(CompletionNotifier.class);
    dataProvider = new GitDataProvider(grm);
    dataProvider.addCompletionNotifier(notifier);
    Field field = GitDataProvider.class.getDeclaredField("initialized");
    field.setAccessible(true);
    field.set(dataProvider, Boolean.TRUE);

    when(grm.getBranches()).thenReturn(Arrays.asList(branch, demoBranch));
    when(grm.getBaseLevels(branch)).thenReturn(Arrays.asList(branchBase1, branchBase2));
    when(grm.getBaseLevels(demoBranch)).thenReturn(new ArrayList<>(0));
    when(grm.getSaveSets(Optional.of(branchBase1), branch))
        .thenReturn(Arrays.asList(branchSaveSet, branchSaveSet2));
    when(grm.getSnapshots(branchSaveSet, 0, Optional.empty()))
        .thenReturn(Arrays.asList(branchSnapshot, branchSnapshot2));
    when(grm.loadSaveSetData(branchSaveSet, Optional.empty())).thenReturn(bsd);
    when(grm.createBranch(branch, "someBranch")).thenReturn(someBranch);
    when(grm.createBranch(branch, "bla")).thenThrow(exception);
    when(grm.saveSaveSet(bsd, "comment")).thenReturn(new Result<SaveSetData>(bsd, ChangeType.SAVE));
    when(grm.saveSaveSet(bsd, "comment2"))
        .thenReturn(new Result<SaveSetData>(bsd, ChangeType.PULL));
    when(grm.saveSaveSet(bsd, "comment3")).thenThrow(exception);
    when(grm.deleteSaveSet(branchSaveSet, "comment"))
        .thenReturn(new Result<SaveSet>(branchSaveSet, ChangeType.SAVE));
    when(grm.deleteSaveSet(branchSaveSet, "comment2"))
        .thenReturn(new Result<SaveSet>(branchSaveSet, ChangeType.PULL));
    when(grm.deleteSaveSet(branchSaveSet, "comment4"))
        .thenReturn(new Result<SaveSet>(null, ChangeType.NONE));
    when(grm.deleteSaveSet(branchSaveSet, "comment3")).thenThrow(exception);
    when(grm.saveSnapshot(snapshot, "comment"))
        .thenReturn(new Result<VSnapshot>(snapshot, ChangeType.SAVE));
    when(grm.saveSnapshot(snapshot, "comment2"))
        .thenReturn(new Result<VSnapshot>(snapshot, ChangeType.PULL));
    when(grm.saveSnapshot(snapshot, "comment3"))
        .thenReturn(new Result<VSnapshot>(null, ChangeType.NONE));
    when(grm.saveSnapshot(snapshot, "comment4")).thenThrow(exception);
    when(grm.tagSnapshot(branchSnapshot, "name", "message"))
        .thenReturn(new Result<Snapshot>(branchSnapshot, ChangeType.SAVE));
    when(grm.tagSnapshot(branchSnapshot, "name2", "message"))
        .thenReturn(new Result<Snapshot>(branchSnapshot, ChangeType.PULL));
    when(grm.tagSnapshot(branchSnapshot, "name3", "message"))
        .thenReturn(new Result<Snapshot>(null, ChangeType.NONE));
    when(grm.tagSnapshot(branchSnapshot, "name4", "message")).thenThrow(exception);
    when(grm.loadSnapshotData(branchSnapshot)).thenReturn(snapshot);
    when(grm.findSnapshotsByCommentOrUser(
            "temp", branch, true, true, Optional.empty(), Optional.empty()))
        .thenReturn(Arrays.asList(branchSnapshot, branchSnapshot3));
    when(grm.findSnapshotsByCommentOrUser(
            "temp", branch, true, false, Optional.empty(), Optional.empty()))
        .thenReturn(Arrays.asList(branchSnapshot3));
    when(grm.findSnapshotsByCommentOrUser(
            "temp", branch, false, true, Optional.empty(), Optional.empty()))
        .thenReturn(Arrays.asList(branchSnapshot2));
    when(grm.findSnapshotsByTag("temp", branch, Optional.empty(), Optional.empty()))
        .thenReturn(Arrays.asList(branchSnapshot));
    when(grm.findSnapshotsByTagMessage("temp", branch, Optional.empty(), Optional.empty()))
        .thenReturn(Arrays.asList(branchSnapshot2));
    when(grm.findSnapshotsByTagName("temp", branch, Optional.empty(), Optional.empty()))
        .thenReturn(Arrays.asList(branchSnapshot3));
    when(grm.importData(branchSaveSet, someBranch, Optional.of(someBaseLevel), ImportType.SAVE_SET))
        .thenReturn(new Result<Boolean>(true, ChangeType.SAVE));
    when(grm.importData(
            branchSaveSet, someBranch, Optional.of(someBaseLevel), ImportType.ALL_SNAPSHOTS))
        .thenReturn(new Result<Boolean>(true, ChangeType.PULL));
    when(grm.importData(
            branchSaveSet, someBranch, Optional.of(someBaseLevel), ImportType.LAST_SNAPSHOT))
        .thenReturn(new Result<Boolean>(false, ChangeType.NONE));
    when(grm.synchronise(Optional.empty())).thenReturn(true);
  }