I’m trying to unit test my use of the Okta Java SDK to (1) retrieve User and Group information and (2) map the Okta Java SDK classes/instances to our own User and Group classes.
However, I’m having a hard time figuring out the best way to create dummy/mock test instances of Client, User, Group, List, and List for my unit tests.
I’d love to be able to just instantiate test Users and Groups, set their properties, and then use them in my unit tests. But I’m running into difficulties pulling this off.
Specifically, if I want to create a mock User (and a mock list of Users) for a test, how do I give UserBuilder the Client that it needs to .buildAndCreate(client)? Do I give it a real Client that’s configured with the information for, say, my Okta Developer account? Or can I just give it a mock Client? I’d like to avoid making actual HTTP requests to Okta APIs in my unit tests, if possible.
I’ve read @bdemers answer to a similar question from @hernan_plascencia here: Spring Boot Okta sdk user creation unit test But, being a relatively new developer, I could still use a bit more help with this.