@Test public void saveAccount() { User acc = ServiceTestConfiguration.user(); when(repo.save(acc)).thenReturn(acc); assertEquals(service.saveUser(acc),acc.getId()); }
public Integer saveUser(User userRequest) { logger.debug("UserService.saveAccount:" + userRequest.toString()); if (userRequest.getLogincount() == null) { userRequest.setLogincount(0); } if (userRequest.getLogoutcount() == null) { userRequest.setLogoutcount(0); } User account = user.save(userRequest); logger.info("UserService.saveAccount: account saved: " + account); return account.getId(); }
UserService { public Integer saveUser(User userRequest) { logger.debug("UserService.saveAccount:" + userRequest.toString()); if (userRequest.getLogincount() == null) { userRequest.setLogincount(0); } if (userRequest.getLogoutcount() == null) { userRequest.setLogoutcount(0); } User account = user.save(userRequest); logger.info("UserService.saveAccount: account saved: " + account); return account.getId(); } }
UserService { public Integer saveUser(User userRequest) { logger.debug("UserService.saveAccount:" + userRequest.toString()); if (userRequest.getLogincount() == null) { userRequest.setLogincount(0); } if (userRequest.getLogoutcount() == null) { userRequest.setLogoutcount(0); } User account = user.save(userRequest); logger.info("UserService.saveAccount: account saved: " + account); return account.getId(); }  }
UserService { public Integer saveUser(User userRequest) { logger.debug("UserService.saveAccount:" + userRequest.toString()); if (userRequest.getLogincount() == null) { userRequest.setLogincount(0); } if (userRequest.getLogoutcount() == null) { userRequest.setLogoutcount(0); } User account = user.save(userRequest); logger.info("UserService.saveAccount: account saved: " + account); return account.getId(); }  User findUser(Integer id); User findUser(String username); @Cacheable(value = "authorizationCache") User findAccountprofileByAuthtoken(String token); Integer saveUser(User userRequest); Map<String, Object> login(String username, String password); User logout(String userId); }
UserService { public Integer saveUser(User userRequest) { logger.debug("UserService.saveAccount:" + userRequest.toString()); if (userRequest.getLogincount() == null) { userRequest.setLogincount(0); } if (userRequest.getLogoutcount() == null) { userRequest.setLogoutcount(0); } User account = user.save(userRequest); logger.info("UserService.saveAccount: account saved: " + account); return account.getId(); }  User findUser(Integer id); User findUser(String username); @Cacheable(value = "authorizationCache") User findAccountprofileByAuthtoken(String token); Integer saveUser(User userRequest); Map<String, Object> login(String username, String password); User logout(String userId);  }