@Test(dependsOnMethods = "testFindImagesAndFix")
public void testModifyOnGithubRecursive() throws Exception {

    gitHubUtil = mock(GitHubUtil.class);
    GHRepository repo = mock(GHRepository.class);
    List<GHContent> tree = mock(List.class);
    Iterator<GHContent> treeIterator = mock(Iterator.class);
    GHContent content = mock(GHContent.class);
    when(content.isFile()).thenReturn(false, true);
    when(content.getDownloadUrl()).thenReturn(null,  " ");
    when(content.isDirectory()).thenReturn(true, false);
    when(content.getPath()).thenReturn("path");
    when(content.read()).thenReturn(new InputStream() {
        @Override
        public int read() throws IOException {
            return -1;
        }
    });
    when(treeIterator.hasNext()).thenReturn(true, true, true, true, true, false);
    when(treeIterator.next()).thenReturn(content);
    when(tree.iterator()).thenReturn(treeIterator);
    String branch = "branch";
    String img = "img";
    String tag = "tag";
    when(repo.getDirectoryContent("path", branch)).thenReturn(tree);
    dockerfileGitHubUtil = new DockerfileGitHubUtil(gitHubUtil);
    dockerfileGitHubUtil.modifyOnGithubRecursive(repo, content, branch, img, tag);
    verify(content, times(6)).isFile();
    verify(content, times(2)).isDirectory();
    verify(content, times(5)).getDownloadUrl();
}