UserServiceImpl implements UserService { @Override @Transactional(rollbackFor = Throwable.class) public void deleteUserByUuid(String userUuid) throws UserNotFoundException { Preconditions.checkArgument(userUuid != null, "User uuid required"); Preconditions.checkArgument(StringUtils.hasText(userUuid), "User uuid must be provided"); boolean isDeletedSucceessfully = false; try { User userToDelete = userDao.findUserByUuid(userUuid); if (userToDelete != null) { isDeletedSucceessfully = userDao.deleteUser(userUuid); eventBus.post(EntityChangedEvent.removedObject(userToDelete)); } } catch (Throwable t) { String msg = String.format("Failed to delete user '%s'", userUuid); throw new UserServiceUnexpectedException(msg, t); } if (!isDeletedSucceessfully) { throw new UserNotFoundException(userUuid); } }  @Override @Transactional(rollbackFor = Throwable.class) User createUser(User userTemplate); @Override User getUserByUuid(String userUuid); @Override User getUserByEmail(String userEmail); @Override PaginatedList<User> findUsersByDisplayNamePartial(String displayNamePartial, PagerParams pagerParams); @Override @Transactional(rollbackFor = Throwable.class) void updateUser(User user); @Override @Transactional(rollbackFor = Throwable.class) void deleteUserByUuid(String userUuid); UserDao getUserDao(); void setUserDao(UserDao userDao); EventBus getEventBus(); @Required void setEventBus(EventBus eventBus); StringIdGenerator getStringIdGenerator(); @Autowired(required = false) void setStringIdGenerator(StringIdGenerator stringIdGenerator);  }
@Test(expected = IllegalArgumentException.class) public void testDeleteUserByUuid_shouldThrowIaeOnNull() throws Exception { UserServiceImpl fixture = UserServiceImplFactory.createUsersServiceImpl(); fixture.deleteUserByUuid(null); }
@Test(expected = IllegalArgumentException.class) public void testDeleteUserByUuid_shouldThrowIaeOnEmpty() throws Exception { UserServiceImpl fixture = UserServiceImplFactory.createUsersServiceImpl(); fixture.deleteUserByUuid(""); }