public static int checkAsyncBackupCount(int currentBackupCount, int newAsyncBackupCount) {
        if (currentBackupCount < 0) {
            throw new IllegalArgumentException("backup-count can't be smaller than 0");
        }

        if (newAsyncBackupCount < 0) {
            throw new IllegalArgumentException("async-backup-count can't be smaller than 0");
        }

        if (newAsyncBackupCount > MAX_BACKUP_COUNT) {
            throw new IllegalArgumentException("async-backup-count can't be larger than than " + MAX_BACKUP_COUNT);
        }

        if (currentBackupCount + newAsyncBackupCount > MAX_BACKUP_COUNT) {
            throw new IllegalArgumentException("the sum of backup-count and async-backup-count can't be larger than than "
                    + MAX_BACKUP_COUNT);
        }

        return newAsyncBackupCount;
    }
@Test
    public void checkAsyncBackupCount() {
        checkAsyncBackupCount(-1, 0, false);
        checkAsyncBackupCount(-1, -1, false);
        checkAsyncBackupCount(0, -1, false);
        checkAsyncBackupCount(0, 0, true);
        checkAsyncBackupCount(0, 1, true);
        checkAsyncBackupCount(1, 1, true);
        checkAsyncBackupCount(2, 1, true);
        checkAsyncBackupCount(1, 2, true);
        checkAsyncBackupCount(MAX_BACKUP_COUNT, 0, true);
        checkAsyncBackupCount(0, MAX_BACKUP_COUNT, true);
        checkAsyncBackupCount(MAX_BACKUP_COUNT, 1, false);
        checkAsyncBackupCount(MAX_BACKUP_COUNT + 1, 0, false);
        checkAsyncBackupCount(0, MAX_BACKUP_COUNT + 1, false);
    }