Test-driven development is a pretty awesome design process. And while building your code, you may want to mimic the logged-in user. In Spring Security, the logged-in user principal is stored inside the Authentication object. This Authentication object can be accessed from any part of your application using SecurityContextHolder. The SecurityContextHolder is a singleton … [Read more...] about How To Mock SecurityContextHolder in Spring Security using Mockito?