A common unit test scenario for Spring / Spring MVC applications is to verify behavior when logged in as a particular user. The new spring-security-test library available with Spring Security version 4 makes testing user access controls in Spring and Spring MVC applications far simpler.
Stuart 'Stevie' Leitch on Software Development, Java Technologies, Security and Testing