@Test void testCreateTokenInactiveUser() { User user = mock(User.class); assertThrows( PasswordResetTokenCreationException.class, () -> passwordResetTokenRepositoryImpl.createToken(user)); }
@Transactional @Override public String createToken(User user) { if (!user.isActive()) { throw new PasswordResetTokenCreationException(); } deleteTokenIfExists(user); return addPasswordResetToken(user); }
PasswordResetTokenRepositoryImpl implements PasswordResetTokenRepository { @Transactional @Override public String createToken(User user) { if (!user.isActive()) { throw new PasswordResetTokenCreationException(); } deleteTokenIfExists(user); return addPasswordResetToken(user); } }
PasswordResetTokenRepositoryImpl implements PasswordResetTokenRepository { @Transactional @Override public String createToken(User user) { if (!user.isActive()) { throw new PasswordResetTokenCreationException(); } deleteTokenIfExists(user); return addPasswordResetToken(user); } PasswordResetTokenRepositoryImpl(
      PasswordResetTokenFactory passwordResetTokenFactory,
      PasswordEncoder passwordEncoder,
      DataService dataService); }
PasswordResetTokenRepositoryImpl implements PasswordResetTokenRepository { @Transactional @Override public String createToken(User user) { if (!user.isActive()) { throw new PasswordResetTokenCreationException(); } deleteTokenIfExists(user); return addPasswordResetToken(user); } PasswordResetTokenRepositoryImpl(
      PasswordResetTokenFactory passwordResetTokenFactory,
      PasswordEncoder passwordEncoder,
      DataService dataService); @Transactional @Override String createToken(User user); @Transactional(readOnly = true) @Override void validateToken(User user, String token); @Transactional @Override void deleteToken(User user, String token); }
PasswordResetTokenRepositoryImpl implements PasswordResetTokenRepository { @Transactional @Override public String createToken(User user) { if (!user.isActive()) { throw new PasswordResetTokenCreationException(); } deleteTokenIfExists(user); return addPasswordResetToken(user); } PasswordResetTokenRepositoryImpl(
      PasswordResetTokenFactory passwordResetTokenFactory,
      PasswordEncoder passwordEncoder,
      DataService dataService); @Transactional @Override String createToken(User user); @Transactional(readOnly = true) @Override void validateToken(User user, String token); @Transactional @Override void deleteToken(User user, String token);  }