@Test public void getUserByUserName() throws Exception { User expectedUser = User.builder() .userName("system") .build(); when(userRepository.getUserByUserName("system","tenantId")).thenReturn(expectedUser); User user = userService.getUserByUserName("system","tenantId"); assertEquals(user.getUserName(),expectedUser.getUserName()); }
public User getUserByUserName(String userName, String tenantId){ return userRepository.getUserByUserName(userName,tenantId); }
UserService { public User getUserByUserName(String userName, String tenantId){ return userRepository.getUserByUserName(userName,tenantId); } }
UserService { public User getUserByUserName(String userName, String tenantId){ return userRepository.getUserByUserName(userName,tenantId); } UserService(UserRepository userRepository); }
UserService { public User getUserByUserName(String userName, String tenantId){ return userRepository.getUserByUserName(userName,tenantId); } UserService(UserRepository userRepository); User getUserByUserName(String userName, String tenantId); }
UserService { public User getUserByUserName(String userName, String tenantId){ return userRepository.getUserByUserName(userName,tenantId); } UserService(UserRepository userRepository); User getUserByUserName(String userName, String tenantId);  }