@Test
public void testGenerateEmailToken() throws Exception {

    // Arrange
    String value = "differentValueFirstTime";
    when(tokenGenerator.generateToken()).thenReturn(value);
    when(userCreationRepository.findOneByEmailToken(value)).thenReturn(Optional.empty());
    // Act
    final String emailToken = sut.generateEmailToken();
    // Assert
    assertEquals(value, emailToken);
    verify(tokenGenerator, times(1)).generateToken();
    verify(userCreationRepository, times(1)).findOneByEmailToken(value);
}