@Test public void decrement() { ServerGroup group = serverGroup("group"); increment(group, 5); for (int i = 0; i < 2; i++) { repository.decrement(group); } Map<String, Integer> groupsOnline = repository.getGroupsOnline(); assertEquals(3, groupsOnline.get("group")); }
@Override public void decrement(ServerGroup group) { redisTransactions.runTransaction(jedis -> { jedis.hincrBy(HASH_TABLE, group.getName(), -1); }); }
RedisGlobalOnlineRepository implements GlobalOnlineRepository { @Override public void decrement(ServerGroup group) { redisTransactions.runTransaction(jedis -> { jedis.hincrBy(HASH_TABLE, group.getName(), -1); }); } }
RedisGlobalOnlineRepository implements GlobalOnlineRepository { @Override public void decrement(ServerGroup group) { redisTransactions.runTransaction(jedis -> { jedis.hincrBy(HASH_TABLE, group.getName(), -1); }); }  }
RedisGlobalOnlineRepository implements GlobalOnlineRepository { @Override public void decrement(ServerGroup group) { redisTransactions.runTransaction(jedis -> { jedis.hincrBy(HASH_TABLE, group.getName(), -1); }); }  @Override Map<String, Integer> getGroupsOnline(); @Override void increment(ServerGroup group); @Override int getGlobalOnline(); @Override void decrement(ServerGroup group); }
RedisGlobalOnlineRepository implements GlobalOnlineRepository { @Override public void decrement(ServerGroup group) { redisTransactions.runTransaction(jedis -> { jedis.hincrBy(HASH_TABLE, group.getName(), -1); }); }  @Override Map<String, Integer> getGroupsOnline(); @Override void increment(ServerGroup group); @Override int getGlobalOnline(); @Override void decrement(ServerGroup group);  }