@Test
public void testFindUserCreationInfoByPatientId() throws Exception {

    // Arrange
    final Long patientId = 10L;
    final String verificationCode = "verificationCode";
    final int year = 2010;
    final int month = 2;
    final int day = 3;
    final Date birthDate = new Date(year, month, day);
    final Instant emailTokenExpiration = Instant.now();
    final PatientDto patientDto = mock(PatientDto.class);
    when(phrService.findPatientProfileById(patientId)).thenReturn(patientDto);
    when(patientDto.getBirthDate()).thenReturn(birthDate);
    final UserCreation userCreation = mock(UserCreation.class);
    when(userCreationRepository.findOneByPatientId(patientId)).thenReturn(Optional.of(userCreation));
    when(userCreation.getVerificationCode()).thenReturn(verificationCode);
    when(userCreation.getEmailTokenExpirationAsInstant()).thenReturn(emailTokenExpiration);
    final UserCreationResponseDto userCreationResponseDto = mock(UserCreationResponseDto.class);
    when(modelMapper.map(patientDto, UserCreationResponseDto.class)).thenReturn(userCreationResponseDto);
    // Act
    final UserCreationResponseDto response = sut.findUserCreationInfoByPatientId(patientId);
    // Assert
    assertEquals(userCreationResponseDto, response);
    verify(userCreationResponseDto, times(1)).setVerificationCode(verificationCode);
    verify(userCreationResponseDto, times(1)).setEmailTokenExpiration(emailTokenExpiration);
}