@Test
  public void testCollectProjects() throws Exception {

    // given
    RepositoryWrapper repo = mock(RepositoryWrapper.class);
    when(repo.getId()).thenReturn(123);
    when(repo.getName()).thenReturn("awesome");
    when(repo.getUrl()).thenReturn(new URL("http://a.com/b.html"));
    when(repo.getDescription()).thenReturn("cool");
    when(repo.getStarsCount()).thenReturn(11);
    when(repo.getForksCount()).thenReturn(22);
    when(repo.getLastPushed()).thenReturn(date);
    when(repo.getPrimaryLanguage()).thenReturn("Go");
    when(repo.listLanguages()).thenReturn(toMap("C", 30, "Go", 15, "Java", 4));
    when(repo.listCommits()).thenReturn(mockList(GHCommit.class, 2));
    when(repo.listContributors()).thenReturn(mockList(Contributor.class, 2));
    when(scorer.score(any(Project.class))).thenReturn(55);

    // when
    List<Project> projects = new ArrayList<>(task.collectProjects(org(singletonList(repo))));

    // then
    assertThat(projects, hasSize(1));
    Project project = projects.get(0);

    assertThat(project.getGitHubProjectId(), equalTo(123L));

    assertThat(
        project.getSnapshotDate().getTime(),
        equalTo(((Date) ReflectionTestUtils.getField(task, "snapshotDate")).getTime()));
    assertThat(project.getName(), equalTo("awesome"));
    assertThat(project.getUrl(), equalTo("http://a.com/b.html"));
    assertThat(project.getDescription(), equalTo("cool"));
    assertThat(project.getStarsCount(), equalTo(11));
    assertThat(project.getForksCount(), equalTo(22));
    assertThat(project.getLastPushed(), equalTo(date.toString()));
    assertThat(project.getPrimaryLanguage(), equalTo("Go"));
    assertThat(project.getLanguageList(), containsInAnyOrder("C", "Go", "Java"));
    assertThat(project.getCommitsCount(), equalTo(2));
    assertThat(project.getContributorsCount(), equalTo(2));
    assertThat(project.getScore(), equalTo(55));
  }