KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I have a user class like such: class User { transient springSecurityService String displayName String password <snip> protected void encodePassword() { password = springSecurityService.encodePassword(password) } } And a UserController . I'm trying to write unit tests for the UserController however I'm getting this error for save, update and delete tests: java.lang.NullPointerException: Cannot invoke method encodePassword() on null object What do I have to set up in the way of mocking to get this to work? I have tried many combinations of mocking code such as the following, but I am at a loss. defineBeans { springSecurityService(SpringSecurityService) } Any advice would be greatly appreciated.
Tags (comma-separated)
Save Edits
Cancel