Corrected matchers for cache unit tests
This commit is contained in:
parent
6faef71798
commit
f8eb716c11
|
@ -29,14 +29,13 @@ package org.apache.hc.client5.http.impl.cache;
|
|||
import java.util.Iterator;
|
||||
import java.util.Objects;
|
||||
|
||||
import org.apache.hc.client5.http.cache.HttpCacheEntry;
|
||||
import org.apache.hc.core5.http.Header;
|
||||
import org.apache.hc.core5.http.MessageHeaders;
|
||||
import org.hamcrest.BaseMatcher;
|
||||
import org.hamcrest.Description;
|
||||
import org.hamcrest.Matcher;
|
||||
|
||||
public class ContainsHeaderMatcher extends BaseMatcher<HttpCacheEntry> {
|
||||
public class ContainsHeaderMatcher extends BaseMatcher<MessageHeaders> {
|
||||
|
||||
private final String headerName;
|
||||
private final Object headerValue;
|
||||
|
@ -65,7 +64,7 @@ public class ContainsHeaderMatcher extends BaseMatcher<HttpCacheEntry> {
|
|||
description.appendText("contains header ").appendValue(headerValue).appendText(": ").appendValue(headerValue);
|
||||
}
|
||||
|
||||
public static Matcher<HttpCacheEntry> contains(final String headerName, final Object headerValue) {
|
||||
public static Matcher<MessageHeaders> contains(final String headerName, final Object headerValue) {
|
||||
return new ContainsHeaderMatcher(headerName, headerValue);
|
||||
}
|
||||
|
||||
|
|
|
@ -73,7 +73,7 @@ public class HttpCacheEntryMatcher extends BaseMatcher<HttpCacheEntry> {
|
|||
if (expectedValue.getStatus() != otherValue.getStatus()) {
|
||||
return false;
|
||||
}
|
||||
if (!headersEqual(expectedValue.requestHeaderIterator(), otherValue.requestHeaderIterator())) {
|
||||
if (!headersEqual(expectedValue.headerIterator(), otherValue.headerIterator())) {
|
||||
return false;
|
||||
}
|
||||
if (!instantEqual(expectedValue.getResponseInstant(), otherValue.getResponseInstant())) {
|
||||
|
|
Loading…
Reference in New Issue