@Test
 public void testUpdateUser() throws Exception {
   assertSame(user, db.retrieveUserById(user.getId()));
   UaaUser newUser =
       new UaaUser(
           user.getId(),
           user.getUsername(),
           user.getPassword(),
           user.getEmail(),
           user.getAuthorities(),
           user.getGivenName(),
           user.getFamilyName(),
           user.getCreated(),
           user.getModified(),
           user.getOrigin(),
           user.getExternalId(),
           false,
           user.getZoneId(),
           user.getSalt(),
           user.getPasswordLastModified());
   db.updateUser(user.getId(), newUser);
   assertSame(newUser, db.retrieveUserById(user.getId()));
 }
 @Test
 public void testRetrieveUserByName() throws Exception {
   assertSame(user, db.retrieveUserByName(user.getUsername(), user.getOrigin()));
 }
 @Test(expected = UsernameNotFoundException.class)
 public void testRetrieveUserByNameInvalidUsername() throws Exception {
   db.retrieveUserByName(user.getUsername() + "1", Origin.UAA);
 }
 @Before
 public void setUp() {
   Map<String, UaaUser> users = new HashMap<>();
   users.put(user.getUsername(), user);
   db = new InMemoryUaaUserDatabase(users);
 }