@Test(expected = IllegalArgumentException.class) public void deleteOldestPasswordShouldThrowIAEWhenUserIdIsNull() { this.passwordChangeService.deleteOldestPassword(null); }
@Transactional @Override public void deleteOldestPassword(Long userId) { Assert.notNull(userId); PasswordHistoryEntity entity = passwordHistoryRepository.findTop1ByUserEntityIdOrderByChangeDate(userId); passwordHistoryRepository.delete(entity); }
PasswordChangeServiceImpl implements PasswordChangeService { @Transactional @Override public void deleteOldestPassword(Long userId) { Assert.notNull(userId); PasswordHistoryEntity entity = passwordHistoryRepository.findTop1ByUserEntityIdOrderByChangeDate(userId); passwordHistoryRepository.delete(entity); } }
PasswordChangeServiceImpl implements PasswordChangeService { @Transactional @Override public void deleteOldestPassword(Long userId) { Assert.notNull(userId); PasswordHistoryEntity entity = passwordHistoryRepository.findTop1ByUserEntityIdOrderByChangeDate(userId); passwordHistoryRepository.delete(entity); }  }
PasswordChangeServiceImpl implements PasswordChangeService { @Transactional @Override public void deleteOldestPassword(Long userId) { Assert.notNull(userId); PasswordHistoryEntity entity = passwordHistoryRepository.findTop1ByUserEntityIdOrderByChangeDate(userId); passwordHistoryRepository.delete(entity); }  @Transactional @Override Long saveOrUpdate(PasswordHistoryDTO passwordHistoryDTO); @Transactional(readOnly = true) @Override List<String> getOldPasswords(Long userId); @Transactional @Override void deleteOldestPassword(Long userId); }
PasswordChangeServiceImpl implements PasswordChangeService { @Transactional @Override public void deleteOldestPassword(Long userId) { Assert.notNull(userId); PasswordHistoryEntity entity = passwordHistoryRepository.findTop1ByUserEntityIdOrderByChangeDate(userId); passwordHistoryRepository.delete(entity); }  @Transactional @Override Long saveOrUpdate(PasswordHistoryDTO passwordHistoryDTO); @Transactional(readOnly = true) @Override List<String> getOldPasswords(Long userId); @Transactional @Override void deleteOldestPassword(Long userId);  }