@Override
    public boolean apply(Collection<Member> members) {
        if (members.size() < minimumClusterSize) {
            return false;
        }

        int count = 0;
        long now = currentTimeMillis();
        for (Member member : members) {
            if (!isAlivePerIcmp(member)) {
                continue;
            }

            if (member.localMember()) {
                count++;
                continue;
            }

            // apply and onHeartbeat are never executed concurrently
            Long latestTimestamp = latestHeartbeatPerMember.get(member);
            if (latestTimestamp == null) {
                continue;
            }

            if ((now - latestTimestamp) < heartbeatToleranceMillis) {
                count++;
            }
        }
        return count >= minimumClusterSize;
    }
@Test
    public void testRecentlyActiveSplitBrainProtectionFunction_splitBrainProtectionPresent_whenFewerThanSplitBrainProtectionLive() {
        splitBrainProtectionFunction = new RecentlyActiveSplitBrainProtectionFunction(splitBrainProtectionSize, 10000);
        // heartbeat each second for all members for 5 seconds
        heartbeat(5, 1000);
        // cluster membership manager considers splitBrainProtectionSize-1 members alive
        assertFalse(splitBrainProtectionFunction.apply(subsetOfMembers(splitBrainProtectionSize - 1)));
    }