public void blameCurrentCommit() { when(commitApi.blame(EXPECTED_PATH)).thenReturn(blameModel); when(blameModel.getBlameBlock(anyInt())).thenReturn(blameBlock); when(blameBlock.getFromCommitId()).thenReturn(COMMIT_ID); when(blameBlock.getFromFilePath()).thenReturn(EXPECTED_PATH); when(blameBlock.getFromLineNumber(any())) .thenAnswer(invocation -> invocation.getArguments()[0]); }
@Before public void initializeMocks() { when(commit.getCommitId()).thenReturn(COMMIT_ID); when(commit.getRepository()).thenReturn(groupRepository); when(group.getRepository()).thenReturn(groupRepository); when(groupRepository.getRepositoryName()).thenReturn(""); when(commits.ensureExists(any(), any())).thenReturn(commit); when(repositories.getRepository(anyString())).thenReturn(repository); when(repository.getCommit(COMMIT_ID)).thenReturn(commitApi); when(commitApi.get()).thenReturn(repoCommit); blameCurrentCommit(); }