when(db.retrieveUserById(anyString())).thenReturn(user);
am.setOrigin(OriginKeys.LDAP);
am.setUserDatabase(db);
definition.setStoreCustomAttributes(storeUserInfo);
UaaAuthentication authentication = (UaaAuthentication)am.authenticate(auth);
<BUG>UserInfo info = new UserInfo(authentication.getUserAttributes());
if (storeUserInfo) {</BUG>
verify(db, times(1)).storeUserInfo(anyString(), eq(info));
} else {
verify(db, never()).storeUserInfo(anyString(), eq(info));

when(db.retrieveUserById(anyString())).thenReturn(user);
am.setOrigin(OriginKeys.LDAP);
am.setUserDatabase(db);
definition.setStoreCustomAttributes(storeUserInfo);
UaaAuthentication authentication = (UaaAuthentication)am.authenticate(auth);
UserInfo info = new UserInfo()
.setUserAttributes(authentication.getUserAttributes())
.setRoles(emptyList());
if (storeUserInfo) {
verify(db, times(1)).storeUserInfo(anyString(), eq(info));
} else {
verify(db, never()).storeUserInfo(anyString(), eq(info));
