### Question:
RoleActionManager { public boolean updateRoleActionPointIfChanged(User user, long currentTimeMillis) { boolean changed = false; int oldRoleAction = user.getRoleAction(); int roleAction = getRoleActionPoint(user, currentTimeMillis); if ( roleAction != oldRoleAction ) { user.setRoleAction(roleAction); GameContext.getInstance().writeResponse(user.getSessionKey(), user.toBseRoleInfo()); changed = true; } return changed; } RoleActionManager(); static final RoleActionManager getInstance(); boolean isDisableRoleAction(); void setDisableRoleAction(boolean disableRoleAction); boolean setRoleActionBuyCount(User user, int buyCount, long currentTimeMillis); int[] queryRoleActionLimit(User user, long currentTimeMillis, boolean sendBse); boolean buyRoleActionPoint(User user, long currentTimeMillis); boolean consumeRoleActionPoint(User user, int gain, long currentTimeMillis); boolean consumeRoleActionPoint(User user, int gain, long currentTimeMillis, 
			boolean sendBse); boolean userLevelUpRoleActionGrow(User user, long currentTimeMillis, boolean sendBse); final boolean addRoleActionPoint(User user, long currentTimeMillis,
			boolean sendBse, int count); int getRoleActionPoint(User user, long currentTimeMillis); boolean updateRoleActionPointIfChanged(User user, long currentTimeMillis); final boolean checkUserHasRoleActionPoint(User user); final DailyLimitManager getDailyLimitManager();  }### Answer:
@Test public void testUpdateRoleActionPointIfChanged() { Jedis jedis = JedisFactory.getJedisDB(); RoleActionManager manager = RoleActionManager.getInstance(); String keyName = RoleActionManager.getInstance().getDailyLimitManager().getRedisLimitKeyName(roleName); jedis.del(keyName); User user = new User(); user.setUsername(roleName); user.setRoleName(roleName); user.setRoleTotalAction(100); user.setYuanbaoFreeSecure(100); Calendar cal = Calendar.getInstance(); boolean checked = manager.updateRoleActionPointIfChanged(user, cal.getTimeInMillis()); assertEquals(false, checked); boolean success = manager.consumeRoleActionPoint(user, 10, cal.getTimeInMillis()); assertTrue(success); cal.add(Calendar.HOUR_OF_DAY, 1); checked = manager.updateRoleActionPointIfChanged(user, cal.getTimeInMillis()); assertEquals(true, checked); }