static Optional<RateLimitInfo> createRateLimitFromHeaders(Headers headers) {
        if (headers == null) {
            return Optional.empty();
        }

        Set<String> names = headers.names();
        if (!names.containsAll(
                Arrays.asList(NS_RATELIMIT_LIMIT, NS_RATELIMIT_REMAINING, NS_RATELIMIT_RESET))) {
            return Optional.empty();
        }

        return RateLimitInfo.createFromHeaders(
                headers.get(NS_RATELIMIT_LIMIT),
                headers.get(NS_RATELIMIT_REMAINING),
                headers.get(NS_RATELIMIT_RESET));
    }
@Test
    public void testParseHeader_FailureCases() {
        // Missing some of the required headers
        assertFalse(
                NodesmithHttpService.createRateLimitFromHeaders(
                                Headers.of(NodesmithHttpService.NS_RATELIMIT_LIMIT, "42"))
                        .isPresent());

        // Invalid number format
        assertFalse(
                NodesmithHttpService.createRateLimitFromHeaders(
                                Headers.of(
                                        NodesmithHttpService.NS_RATELIMIT_LIMIT, "42",
                                        NodesmithHttpService.NS_RATELIMIT_REMAINING, "xyz",
                                        NodesmithHttpService.NS_RATELIMIT_RESET, "1553385403"))
                        .isPresent());

        // Null headers
        assertFalse(NodesmithHttpService.createRateLimitFromHeaders(null).isPresent());
    }