@Test
public void testGenerateEmailToken_Throws_UniqueValueGeneratorException_When_Same_Value_Every_Time() throws Exception {

    // Arrange
    String value = "sameValueEveryTime";
    when(tokenGenerator.generateToken()).thenReturn(value);
    when(userCreationRepository.findOneByEmailToken(value)).thenReturn(Optional.of(mock(UserCreation.class)));
    thrown.expect(UniqueValueGeneratorException.class);
    // Act
    sut.generateEmailToken();
    // Assert
    verify(tokenGenerator, times(3)).generateToken();
    verify(userCreationRepository, times(3)).findOneByEmailToken(value);
}