@Test
public void testFindPatientEntries() {

	// Arrange
	final int pageNumber = 1;
	final int pageSize = 9;
	final Patient patient1 = mock(Patient.class);
	final Patient patient2 = mock(Patient.class);
	List<Patient> patientList = new ArrayList<Patient>();
	patientList.add(patient1);
	patientList.add(patient2);
	int numberOfPatients = patientList.size();
	Page<Patient> patientPage = mock(Page.class);
	when(patientPage.getContent()).thenReturn(patientList);
	ArgumentMatcher<PageRequest> pageRequestArgumentMatcher = new ArgumentMatcher<PageRequest>() {
		@Override
		public boolean matches(Object argument) {
			PageRequest pageRequest = (PageRequest) argument;
			if (pageRequest == null) {
				return false;
			}
			if (pageRequest.getPageSize() != pageSize) {
				return false;
			}
			if (pageRequest.getPageNumber() != pageNumber) {
				return false;
			}
			return true;
		}
	};
	when(patientRepository.findAll(argThat(pageRequestArgumentMatcher)))
			.thenReturn(patientPage);
	final PatientProfileDto expectedPatientProfileDto1 = mock(PatientProfileDto.class);
	when(modelMapper.map(patient1, PatientProfileDto.class)).thenReturn(
			expectedPatientProfileDto1);
	final PatientProfileDto expectedPatientProfileDto2 = mock(PatientProfileDto.class);
	when(modelMapper.map(patient2, PatientProfileDto.class)).thenReturn(
			expectedPatientProfileDto2);
	// Act
	List<PatientProfileDto> result = sut.findPatientEntries(pageNumber,
			pageSize);
	// Assert
	assertEquals(numberOfPatients, result.size());
	for (PatientProfileDto patientProfileDto : result) {
		assertTrue(patientProfileDto == expectedPatientProfileDto1
				|| patientProfileDto == expectedPatientProfileDto2);
	}
	assertTrue(result.get(0) != result.get(1));
}