@Test
public void findProjectsBySnapshotDatePagination() throws Exception {

	// given
	Project p = new ProjectBuilder().gitHubProjectId(1).organizationName(ORGANIZATION1).starsCount(4)
			.commitsCount(6).contributorsCount(2).score(20).forksCount(0).create();
	Project p1 = new ProjectBuilder().gitHubProjectId(2).organizationName(ORGANIZATION1).starsCount(1)
			.commitsCount(2).contributorsCount(1).score(50).forksCount(0).create();
	Project p2 = new ProjectBuilder().gitHubProjectId(3).organizationName(ORGANIZATION1).starsCount(1)
			.commitsCount(3).contributorsCount(1).score(15).forksCount(0).create();
	Project p3 = new ProjectBuilder().gitHubProjectId(4).organizationName(ORGANIZATION1).starsCount(1)
			.commitsCount(3).contributorsCount(1).score(30).forksCount(0).create();
	Project p4 = new ProjectBuilder().gitHubProjectId(5).organizationName(ORGANIZATION1).starsCount(1)
			.commitsCount(3).contributorsCount(1).score(39).forksCount(0).create();
	List<Project> projects = new ArrayList<>();
	projects.add(p);
	projects.add(p1);
	projects.add(p2);
	projects.add(p3);
	projects.add(p4);
	when(projectRepository.findProjects(ORGANIZATION1, empty(), empty())).thenReturn(projects);
	// when
	List<Project> projectList = (List<Project>) projectService.findProjects(ORGANIZATION1, Optional.of(2),
			empty(), empty(), empty(), empty(), empty(), empty());
	// then
	projects = new ArrayList<>();
	projects.add(p1);
	projects.add(p4);
	assertThat(projectList, hasSize(2));
	assertThat(projectList, equalTo(projects));
	// when
	projectList = (List<Project>) projectService.findProjects(ORGANIZATION1, Optional.of(3),
			Optional.of(1), empty(), empty(), empty(), empty(), empty());
	// then
	projects = new ArrayList<>();
	projects.add(p4);
	projects.add(p3);
	projects.add(p);
	assertThat(projectList, hasSize(3));
	assertThat(projectList, equalTo(projects));
}