@Test
public void testGenerateEmailToken_Throws_UniqueValueGeneratorException_When_Non_Unique_Different_Value() throws Exception {

    // Arrange
    String value1 = "differentValueEveryTime1";
    String value2 = "differentValueEveryTime2";
    String value3 = "differentValueEveryTime3";
    when(tokenGenerator.generateToken()).thenReturn(value1).thenReturn(value2).thenReturn(value3);
    when(userCreationRepository.findOneByEmailToken(value1)).thenReturn(Optional.of(mock(UserCreation.class)));
    when(userCreationRepository.findOneByEmailToken(value2)).thenReturn(Optional.of(mock(UserCreation.class)));
    when(userCreationRepository.findOneByEmailToken(value3)).thenReturn(Optional.of(mock(UserCreation.class)));
    thrown.expect(UniqueValueGeneratorException.class);
    // Act
    sut.generateEmailToken();
    // Assert
    verify(tokenGenerator, times(3)).generateToken();
    verify(userCreationRepository, times(1)).findOneByEmailToken(value1);
    verify(userCreationRepository, times(1)).findOneByEmailToken(value2);
    verify(userCreationRepository, times(1)).findOneByEmailToken(value3);
}