ok2c commented on code in PR #453: URL: https://github.com/apache/httpcomponents-client/pull/453#discussion_r1225286200
########## 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: > You can first check if the sizes of the maps are equal. @arturobernalg Makes sense. > Then I would use allMatch function I am not sure I know what you mean. Is this a matcher? -- 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