### Question:
AccountManager extends AbstractMongoManager { public Account convertUserToAccount(User user) { ServerPojo server = ServerListManager.getInstance().getServerById(ServerListManager.FIRST_SERVER_ID); if ( server != null && user != null ) { if ( !USER_CONVERTED_FLAG.equals(user.getAbtest()) ) { Account account = new Account(); account.set_id(StringUtil.concat(server.getId(), LoginManager.getInstance().getRandomUserName())); account.setEmail(user.getEmail()); account.setGender(user.getGender()); account.setPassword(user.getPassword()); account.setUserName(user.getRoleName()); ServerRoleList roleList = new ServerRoleList(); roleList.setServerId(server.getId()); String prefixedRoleName = ServerListManager.getInstance().addServerPrefix( user.getRoleName(), server.getId()); user.setRoleName(prefixedRoleName); user.setAbtest(USER_CONVERTED_FLAG); roleList.addUserId(user.get_id()); roleList.addRoleName(prefixedRoleName); account.addServerRole(roleList); return account; } else { logger.warn("The user {} is already converted:{}", user.getRoleName()); Account account = this.queryAccountByName(user.getUsername()); return account; } } else { logger.warn("The initial server id is not found in database "); } return null; } AccountManager(); static AccountManager getInstance(); boolean saveAccount(Account account); boolean updateAccount(Account account); boolean removeAccount(Account account); static final String getCurrentRoleName(Account account); Account queryAccountById(String accountId); Account queryAccountByName(String accountName); Account queryAccountByRoleName(String roleName); boolean checkUserNameExist(String accountName); boolean checkAccountExist(String accountId); DBObject checkForbiddenUUID(String uuid); Account convertUserToAccount(User user); boolean login(String accountName, String password, 
			int loginConfigVersion, int majorVersion, int minorVersion,
			IoSession session, BceLogin loginInfo, SessionKey sessionKey); final void cleanAccount(Account account); void logout(IoSession session, User user, 
			SessionKey oldSessionKey, String client, boolean loginMultiPrompt); void register(
			IoSession session, SessionKey sessionKey, String userName, 
			String roleName, String password, String email, int genderIndex,
			String client, String country, String channel, int locx, int locy, String clientVersion); boolean changeRoleName(User user, String roleName); void changeEmail(IoSession session, SessionKey sessionKey,
			String email, Account account, User user); void changePassword(User user, String password,
			Account account); boolean createGameRole(IoSession session, String userToken, 
			String roleName, int genderIndex, String serverId); boolean forbiddenAccount(String accountName, String message); boolean unforbiddenAccount(String accountName); void disableGameRole(final IoSession session, final User user, final String serverId); void deleteGameRole(final IoSession session, final User user); void selectRole(IoSession session, SessionKey sessionKey, 
			Account account, UserId userId, String serverId, String uuid, String screen,
			String deviceToken, String client, String lang, String channel); static final String IOSESSION_ACCOUNT; }### Answer:
@Test public void testConvertUserToAccount() { User user = UserManager.getInstance().createDefaultUser(); user.set_id(new UserId("test-001")); user.setUsername("1234567890"); user.setRoleName("test-001"); Account account = AccountManager.getInstance().convertUserToAccount(user); account.set_id("accountid"); System.out.println(account); assertEquals("s0001.test-001", user.getRoleName()); AccountManager.getInstance().removeAccount(account); AccountManager.getInstance().saveAccount(account); Account actual = AccountManager.getInstance().queryAccountById(account.get_id()); assertNotNull(actual); assertEquals(account.toString(), actual.toString()); }