}
@Test
public void testSynchronizeMainCharacter_TwoCharacters_NotExistingMainCharacter() {
Key<User> userKey = new Key<User>(User.class, 1);
User user = new User();
CharacterInfo characterInfo = new CharacterInfo();
characterInfo.setId(3L);
characterInfo.setCharacterID(3L);
user.setMainCharacterInfo(characterInfo);
List<Character> characters = new ArrayList<Character>();
Character character1 = new Character();
character1.setId(1L);
character1.setCharacterID(1L);
Character character2 = new Character();
character2.setId(2L);
character2.setCharacterID(2L);
characters.add(character1);
characters.add(character2);
when(userDao.get(userKey)).thenReturn(user);
when(characterDao.getAll(userKey)).thenReturn(characters);
when(characterDao.get(new Key<Character>(Character.class, 1))).thenReturn(character1);
userSynchronizationService.synchronizeMainCharacter(userKey);
verify(userDao, times(1)).put(userCaptor.capture());
User capturedUser = userCaptor.getValue();
assertEquals(Long.valueOf(1), capturedUser.getMainCharacterInfo().getCharacterID());
assertEquals(2, capturedUser.getCharacterInfos().size());
}