### Question:
MongoUserManager extends UserManager { @Override public Bag queryUserBag(User user) { if ( user == null || user.get_id() == null ) { logger.warn("queryUserBag user or userId is null. {}", user); return null; } Bag bag = queryUserBag(user.get_id()); if ( bag != null ) { bag.setParentUser(user); user.setBag(bag); } return bag; } MongoUserManager();  MongoUserManager(String databaseName, String namespace, boolean isSafeWrite); @Override boolean saveUser(User user, boolean isNewUser); @Override boolean saveUserBag(User user, boolean isNewBag); @Override boolean saveUserRelation(Collection<Relation> relations); @Override Map<RelationType, Collection<People>> saveFriendWinOrLose(User user, User friend, boolean winning); @Override User queryUser(String userName); @Override User queryUserByRoleName(String roleName); @Override User queryUser(UserId userId); @Override String queryUserGuildId(UserId userId); @Override boolean checkUserNameExist(String userName); @Override boolean checkRoleNameExist(String roleName); @Override boolean checkEmailVerified(UserId userId); @Override UserLoginStatus checkUserLoginStatus(UserId userId); @Override BasicUser queryBasicUser(String userName); @Override BasicUser queryBasicUserByRoleName(String roleName); @Override ArrayList<BasicUser> queryBasicUserByRoleNameRegex(String roleName); @Override BasicUser queryBasicUser(UserId userId); @Override Bag queryUserBag(User user); @Override Bag queryUserBag(UserId userId); @Override User queryUserRelation(User user); @Override Collection<Unlock> queryUserUnlock(User user); @Override synchronized boolean addUserNewUnlock(User user, Unlock unlock); @Override void removeUser(UserId userId); @Override void removeUser(String userName); @Override void removeUserByRoleName(String roleName); @Override boolean removeUserGuildId(UserId userId); @Override String convertUserToString(User user); @Override String convertBagToString(Bag bag); @Override User convertStringToUser(String userStr); @Override Bag convertStringToBag(String bagStr); final User constructUserObject(DBObject userObj); static final String LOGIN_USERNAME; static final String LOGIN_ROLENAME; static final String LOGIN_STATUS; static final String EMAIL_VERIFIED; }### Answer:
@Test public void testQueryUserBag() throws Exception { User user = UserManager.getInstance().createDefaultUser(); user.set_id(new UserId("test001")); user.setUsername("test001"); user.setChannel("testSaveUser"); user.setBag(makeBag(user, 3)); user.getBag().addOtherPropDatas(makePropData(1000)); manager.removeUser("test001"); manager.saveUser(user, true); manager.saveUserBag(user, true); User actual = manager.queryUser("test001"); Bag actualBag = manager.queryUserBag(actual); assertNotNull(actualBag); assertEquals(60, actualBag.getMaxCount()); assertEquals(actual.getBag(), actualBag); }