arturobernalg commented on code in PR #453: URL: https://github.com/apache/httpcomponents-client/pull/453#discussion_r1225463198
########## httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/cache/HttpCacheEntryMatcher.java: ########## @@ -92,6 +91,41 @@ public boolean matches(final Object item) { return false; } + private static boolean instantEqual(final Instant expected, final Instant other) { + final Instant expectedMs = expected != null ? expected.truncatedTo(ChronoUnit.MILLIS) : null; + final Instant otherMs = other != null ? other.truncatedTo(ChronoUnit.MILLIS) : null; + return Objects.equals(expectedMs, otherMs); + } + + private static boolean headersEqual(final Iterator<Header> expected, final Iterator<Header> other) { + while (expected.hasNext()) { + final Header h1 = expected.next(); + if (!other.hasNext()) { + return false; + } + final Header h2 = other.next(); + if (!h1.getName().equals(h2.getName()) || !Objects.equals(h1.getValue(), h2.getValue())) { + return false; + } + } + if (other.hasNext()) { + return false; + } + return true; + } + + private static boolean mapEqual(final Map<?, ?> expected, final Map<?, ?> actual) { Review Comment: @ok2c I was saying something like this ``` private static boolean mapEqual(final Map<?, ?> expected, final Map<?, ?> actual) { if (expected.size() != actual.size()) { return false; } return expected.entrySet().stream() .allMatch(e -> Objects.equals(e.getValue(), actual.get(e.getKey()))); } ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: dev-unsubscr...@hc.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@hc.apache.org For additional commands, e-mail: dev-h...@hc.apache.org