### Question:
RoleActionManager { public boolean setRoleActionBuyCount(User user, int buyCount, long currentTimeMillis) { return manager.resetDailyBuyLimit(user, buyCount, currentTimeMillis); } 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 testSetRoleActionBuyCount() { 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.setYuanbaoSimple(100000); user.setIsvip(true); user.setViplevel(10); Calendar cal = Calendar.getInstance(); int roleAction = manager.getRoleActionPoint(user, cal.getTimeInMillis()); assertEquals(0, roleAction); boolean success = manager.buyRoleActionPoint(user, cal.getTimeInMillis()); assertTrue(success); while ( success ) { success = manager.buyRoleActionPoint(user, cal.getTimeInMillis()); } roleAction = StringUtil.toInt(jedis.hget(keyName, "roleaction"), -1); assertEquals(-4300, roleAction); manager.setRoleActionBuyCount(user, 100, cal.getTimeInMillis()); user.setYuanbaoSimple(100000); success = manager.buyRoleActionPoint(user, cal.getTimeInMillis()); assertTrue("Should allow to buy new", success); roleAction = manager.getRoleActionPoint(user, cal.getTimeInMillis()); assertEquals(-4400, roleAction); int[] ints = manager.queryRoleActionLimit(user, cal.getTimeInMillis(), true); }