While doing unit tests on each method of the service layer, I have encountered the below scenario, that I couldn’t figure out how to test:
public class UserServiceImpl{
@Autowired
UserRepository userRepository;
public void abc(){
xyz(obj);
}
private void xyz(){
userRepository.save(obj);
}
}
What I want to test is the abc() method. Within that method, it invokes xyz() which is a PRIVATE method that uses the userRepository dependency. So, when I create a unit test for the abc() method, do I need to be concerned about the xyz() method since it is using a dependency? And if yes, what are the steps that I need to follow?