private boolean executeWasAllowed(Chain<Searcher> chain, String id, double quota, double cost, boolean dryRun) {
        Query query = new Query();
        query.properties().set("rate.id", id);
        query.properties().set("cost", cost); // converted to rate.cost by a searcher executing after rate limiting
        query.properties().set("rate.quota", quota);
        query.properties().set("rate.idDimension", "id");
        query.properties().set("rate.dryRun", dryRun);
        Result result = new Execution(chain, Execution.Context.createContextStub()).search(query);
        if (result.hits().getError() != null && result.hits().getError().getCode() == 429)
            return false;
        else
            return true;
    }
Try many requests and return how many was allowed.
This is to avoid testing the exact pattern of request/deny which does not matter
and is determined by floating point arithmetic details when capacity is close to zero.
container-search/src/test/java/com/yahoo/search/searchers/test/RateLimitingSearcherTestCase.java