@Test
public void generateEmailToken() {
User user = generateTestUser();
when(userRepository.findByEmailAddress(user.getEmailAddress())).thenReturn(user);
when(userRepository.save(user)).thenReturn(user);
VerificationToken token = verificationTokenService.generateEmailVerificationToken(user.getEmailAddress());
assertThat(user.getVerificationTokens().size(), is(1));
assertThat(token, is(not(Matchers.<Object>nullValue())));
assertThat(tokens.size(), is(1));
String sentToken = tokens.get(0);
assertThat(sentToken, is(not(nullValue())));
UUID.fromString(sentToken);
assertThat(sentToken, is(token.getToken()));
}