@Test
public void findProjectsBySnapshotDateSortByTest() 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(3)
			.commitsCount(2).contributorsCount(1).score(20).forksCount(0).create();
	Project p2 = new ProjectBuilder().gitHubProjectId(3).organizationName(ORGANIZATION1).starsCount(1)
			.commitsCount(3).contributorsCount(1).score(20).forksCount(0).create();
	List<Project> projects = new ArrayList<>();
	projects.add(p);
	projects.add(p1);
	projects.add(p2);
	when(projectRepository.findProjects(ORGANIZATION1, empty(), empty())).thenReturn(projects);
	// when
	List<Project> projectList = (List<Project>) projectService.findProjects(ORGANIZATION1, empty(), empty(),
			empty(), empty(), Optional.of("-commits"), empty(), empty());
	// then
	projects = new ArrayList<>();
	projects.add(p);
	projects.add(p2);
	projects.add(p1);
	assertThat(projectList, hasSize(3));
	assertThat(projectList, equalTo(projects));
	
	// when
	projectList = (List<Project>) projectService.findProjects(ORGANIZATION1, empty(), empty(),
			empty(), empty(), Optional.of("stars"), empty(), empty());
	// then
	projects = new ArrayList<>();
	projects.add(p2);
	projects.add(p1);
	projects.add(p);
	assertThat(projectList, hasSize(3));
	assertThat(projectList, equalTo(projects));
}