@Test
/**
 * Tests the counting of external contributors
 */
public void testCountExternalContributors() throws Exception {

    GHRepository.Contributor internal1 = new TestGHContributor("internal1", 1);
    GHRepository.Contributor internal2 = new TestGHContributor("internal2", 2);
    List<GHUser> members = Lists.newArrayList(internal1, internal2);
    List<GHRepository.Contributor> contributors = Lists.newArrayList(internal1, internal2, new TestGHContributor("external", 3));
    RepositoryWrapper repo = mock(RepositoryWrapper.class);
    when(repo.listContributors()).thenReturn(contributors);
    // given
    OrganizationWrapper org = mock(OrganizationWrapper.class);
    when(org.listMembers()).thenReturn(members);
    when(org.listTeams()).thenReturn(mockList(GHTeam.class, 4));
    when(org.listRepositories()).thenReturn(Lists.newArrayList(repo));
    when(org.contributorIsMember(any(Contributor.class))).thenCallRealMethod();
    // when
    Statistics statistics = task.collectStatistics(org);
    assertThat(statistics.getExternalContributorsCount(), equalTo(1));
    assertThat(statistics.getAllContributorsCount(), equalTo(3));
}