Improved unit test for authenticationservice