@Test public void testDeleteUser() { entityManager.getTransaction().begin(); int result = userResourceFacadeImp.deleteUser(user.getUserID()); entityManager.getTransaction().commit(); assertEquals(1, result); user = null; }
@Override public Integer deleteUser(Long id) { Users user = getById(id); if (user != null) { delete(user); em.flush(); return 1; } else { logger.error("User requested to be deleted does not exist! id = " + id); throw new RuntimeException("User requested to be deleted does not exist! id = " + id); } }
UsersResourceFacadeImp extends CoreDBServiceFacadeImp<Users, Long> implements UsersResourceFacade { @Override public Integer deleteUser(Long id) { Users user = getById(id); if (user != null) { delete(user); em.flush(); return 1; } else { logger.error("User requested to be deleted does not exist! id = " + id); throw new RuntimeException("User requested to be deleted does not exist! id = " + id); } } }
UsersResourceFacadeImp extends CoreDBServiceFacadeImp<Users, Long> implements UsersResourceFacade { @Override public Integer deleteUser(Long id) { Users user = getById(id); if (user != null) { delete(user); em.flush(); return 1; } else { logger.error("User requested to be deleted does not exist! id = " + id); throw new RuntimeException("User requested to be deleted does not exist! id = " + id); } } protected  UsersResourceFacadeImp(); }
UsersResourceFacadeImp extends CoreDBServiceFacadeImp<Users, Long> implements UsersResourceFacade { @Override public Integer deleteUser(Long id) { Users user = getById(id); if (user != null) { delete(user); em.flush(); return 1; } else { logger.error("User requested to be deleted does not exist! id = " + id); throw new RuntimeException("User requested to be deleted does not exist! id = " + id); } } protected  UsersResourceFacadeImp(); @Override UsersDTO getUserByName(String name); @Override UsersDTO getUserById(Long id); @Override List<UsersDTO> getAllUsersByName(String name); @Override List<CollectionDTO> findAllCrisisByUserID(Long id); @Override UsersDTO addUser(UsersDTO user); @Override Integer deleteUser(Long id); @Override List<UsersDTO> findByCriteria(String columnName, Object value); @Override List<UsersDTO> getAllUsers(); }
UsersResourceFacadeImp extends CoreDBServiceFacadeImp<Users, Long> implements UsersResourceFacade { @Override public Integer deleteUser(Long id) { Users user = getById(id); if (user != null) { delete(user); em.flush(); return 1; } else { logger.error("User requested to be deleted does not exist! id = " + id); throw new RuntimeException("User requested to be deleted does not exist! id = " + id); } } protected  UsersResourceFacadeImp(); @Override UsersDTO getUserByName(String name); @Override UsersDTO getUserById(Long id); @Override List<UsersDTO> getAllUsersByName(String name); @Override List<CollectionDTO> findAllCrisisByUserID(Long id); @Override UsersDTO addUser(UsersDTO user); @Override Integer deleteUser(Long id); @Override List<UsersDTO> findByCriteria(String columnName, Object value); @Override List<UsersDTO> getAllUsers();  }