### Question:
RoleActionManager { public final boolean addRoleActionPoint(User user, long currentTimeMillis, boolean sendBse, int count) { boolean success = false; int increasePerHour = GameDataManager.getInstance().getGameDataAsInt( GameDataKey.ROLE_ACTION_GAIN_HOURLY, 20); int roleAction = manager.getCurrentOpportunity(user, FIELD_ROLEACTION_KEY, user.getRoleTotalAction(), increasePerHour, currentTimeMillis); int totalRoleAction = user.getRoleTotalAction(); if ( roleAction > 0 ) { int diff = roleAction - count; if ( diff != 0 ) { success = manager.setDailyOpportunityCount(user, FIELD_ROLEACTION_KEY, currentTimeMillis, diff); if ( sendBse ) { GameContext.getInstance().writeResponse(user.getSessionKey(), user.toBseRoleInfo()); String message = Text.text("roleaction.add", totalRoleAction-diff); SysMessageManager.getInstance().sendClientInfoRawMessage(user.getSessionKey(), message, 3000); } } } else { String message = Text.text("roleaction.max"); SysMessageManager.getInstance().sendClientInfoRawMessage(user.getSessionKey(), message, 3000); success = false; } return success; } 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 testAddRoleActionPoint() { 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); Calendar cal = Calendar.getInstance(); int roleAction = manager.getRoleActionPoint(user, cal.getTimeInMillis()); assertEquals(0, roleAction); cal.add(Calendar.HOUR_OF_DAY, 3); int gain = GameDataManager.getInstance().getGameDataAsInt( GameDataKey.ROLE_ACTION_GAIN_HOURLY, 5); roleAction = manager.getRoleActionPoint(user, cal.getTimeInMillis()); assertEquals(0, roleAction); manager.consumeRoleActionPoint(user, 10, cal.getTimeInMillis()); }