I have a simple application that I have setup with spring security using a custom MySql Database. You can check out the complete app on
github. Now the problem is I'm writing
test cases for it and they seems to fail on login page and anything that works after the login. My question is how do I write test cases for it to check the successful login and the subsequent requests?
My Security Config:
My Custom Success Handler:
After some seraching I tried to write test cases like this but they don't seem to be working:
I searched on the net and there are links WithMockUser and UserDetails, but the problem is as you can see I'm setting a my primary key userId in the session in my custom success handler. So I would also need to get the session in my test. Please tell me the simplest way to write tests that will work, possibly with code since I'm new with security and all such.
I had this problem a while back but I haven't found any solutions. Now I'm having it again.