Replace deprecated use of LangUtils#equals() with Objects.equals()
This commit is contained in:
parent
0ca5635898
commit
230a2caf67
|
@ -1,4 +1,19 @@
|
|||
Release 5.2
|
||||
Release 5.2.1
|
||||
------------------
|
||||
|
||||
This is the second GA release in the 5.2 release series.
|
||||
|
||||
Please note that 5.2 upgrades the minimal JRE level to version 8 (8u251 is required).
|
||||
|
||||
|
||||
Change Log
|
||||
-------------------
|
||||
|
||||
* Replace deprecated use of LangUtils#equals() with Objects.equals().
|
||||
Contributed by Gary Gregory <ggregory at apache.org>
|
||||
|
||||
|
||||
Release 5.2
|
||||
------------------
|
||||
|
||||
This is the first GA release in the 5.2 release series. This release finalizes the 5.2 APIs
|
||||
|
|
|
@ -27,11 +27,11 @@
|
|||
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.apache.hc.core5.util.LangUtils;
|
||||
import org.hamcrest.BaseMatcher;
|
||||
import org.hamcrest.Description;
|
||||
import org.hamcrest.Matcher;
|
||||
|
@ -52,7 +52,7 @@ public class ContainsHeaderMatcher extends BaseMatcher<HttpCacheEntry> {
|
|||
final MessageHeaders messageHeaders = (MessageHeaders) item;
|
||||
for (final Iterator<Header> it = messageHeaders.headerIterator(); it.hasNext(); ) {
|
||||
final Header header = it.next();
|
||||
if (headerName.equalsIgnoreCase(header.getName()) && LangUtils.equals(headerValue, header.getValue())) {
|
||||
if (headerName.equalsIgnoreCase(header.getName()) && Objects.equals(headerValue, header.getValue())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,12 +28,12 @@ package org.apache.hc.client5.http.impl.cache;
|
|||
|
||||
import java.time.Instant;
|
||||
import java.util.Arrays;
|
||||
import java.util.Objects;
|
||||
|
||||
import org.apache.hc.client5.http.cache.HttpCacheEntry;
|
||||
import org.apache.hc.client5.http.cache.Resource;
|
||||
import org.apache.hc.client5.http.cache.ResourceIOException;
|
||||
import org.apache.hc.core5.http.Header;
|
||||
import org.apache.hc.core5.util.LangUtils;
|
||||
import org.hamcrest.BaseMatcher;
|
||||
import org.hamcrest.Description;
|
||||
import org.hamcrest.Matcher;
|
||||
|
@ -59,12 +59,12 @@ public class HttpCacheEntryMatcher extends BaseMatcher<HttpCacheEntry> {
|
|||
}
|
||||
final Instant expectedRequestInstant = expectedValue.getRequestInstant();
|
||||
final Instant otherRequestInstant = otherValue.getRequestInstant();
|
||||
if (!LangUtils.equals(expectedRequestInstant, otherRequestInstant)) {
|
||||
if (!Objects.equals(expectedRequestInstant, otherRequestInstant)) {
|
||||
return false;
|
||||
}
|
||||
final Instant expectedResponseInstant = expectedValue.getResponseInstant();
|
||||
final Instant otherResponseInstant = otherValue.getResponseInstant();
|
||||
if (!LangUtils.equals(expectedResponseInstant, otherResponseInstant)) {
|
||||
if (!Objects.equals(expectedResponseInstant, otherResponseInstant)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -76,7 +76,7 @@ public class HttpCacheEntryMatcher extends BaseMatcher<HttpCacheEntry> {
|
|||
for (int i = 0; i < expectedHeaders.length; i++) {
|
||||
final Header h1 = expectedHeaders[i];
|
||||
final Header h2 = otherHeaders[i];
|
||||
if (!h1.getName().equals(h2.getName()) || !LangUtils.equals(h1.getValue(), h2.getValue())) {
|
||||
if (!h1.getName().equals(h2.getName()) || !Objects.equals(h1.getValue(), h2.getValue())) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,6 +32,7 @@ import java.time.Instant;
|
|||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Random;
|
||||
|
||||
import org.apache.hc.client5.http.cache.HttpCacheEntry;
|
||||
|
@ -55,7 +56,6 @@ import org.apache.hc.core5.http.message.BasicClassicHttpResponse;
|
|||
import org.apache.hc.core5.http.message.BasicHeader;
|
||||
import org.apache.hc.core5.http.message.MessageSupport;
|
||||
import org.apache.hc.core5.util.ByteArrayBuffer;
|
||||
import org.apache.hc.core5.util.LangUtils;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
|
||||
public class HttpTestUtils {
|
||||
|
@ -188,7 +188,7 @@ public class HttpTestUtils {
|
|||
if (!entitiesEquivalent) {
|
||||
return false;
|
||||
}
|
||||
final boolean statusLinesEquivalent = LangUtils.equals(r1.getReasonPhrase(), r2.getReasonPhrase())
|
||||
final boolean statusLinesEquivalent = Objects.equals(r1.getReasonPhrase(), r2.getReasonPhrase())
|
||||
&& r1.getCode() == r2.getCode();
|
||||
if (!statusLinesEquivalent) {
|
||||
return false;
|
||||
|
@ -198,14 +198,14 @@ public class HttpTestUtils {
|
|||
|
||||
/* Assertions.asserts that protocol versions equivalent. */
|
||||
public static boolean equivalent(final ProtocolVersion v1, final ProtocolVersion v2) {
|
||||
return LangUtils.equals(v1 != null ? v1 : HttpVersion.DEFAULT, v2 != null ? v2 : HttpVersion.DEFAULT );
|
||||
return Objects.equals(v1 != null ? v1 : HttpVersion.DEFAULT, v2 != null ? v2 : HttpVersion.DEFAULT );
|
||||
}
|
||||
|
||||
/* Assertions.asserts that two requests are morally equivalent. */
|
||||
public static boolean equivalent(final HttpRequest r1, final HttpRequest r2) {
|
||||
return equivalent(r1.getVersion(), r2.getVersion()) &&
|
||||
LangUtils.equals(r1.getMethod(), r2.getMethod()) &&
|
||||
LangUtils.equals(r1.getRequestUri(), r2.getRequestUri()) &&
|
||||
Objects.equals(r1.getMethod(), r2.getMethod()) &&
|
||||
Objects.equals(r1.getRequestUri(), r2.getRequestUri()) &&
|
||||
isEndToEndHeaderSubset(r1, r2);
|
||||
}
|
||||
|
||||
|
@ -213,7 +213,7 @@ public class HttpTestUtils {
|
|||
public static boolean equivalent(final HttpResponse r1, final HttpResponse r2) {
|
||||
return equivalent(r1.getVersion(), r2.getVersion()) &&
|
||||
r1.getCode() == r2.getCode() &&
|
||||
LangUtils.equals(r1.getReasonPhrase(), r2.getReasonPhrase()) &&
|
||||
Objects.equals(r1.getReasonPhrase(), r2.getReasonPhrase()) &&
|
||||
isEndToEndHeaderSubset(r1, r2);
|
||||
}
|
||||
|
||||
|
|
|
@ -33,6 +33,7 @@ import java.util.ArrayList;
|
|||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
import org.apache.hc.core5.annotation.Contract;
|
||||
import org.apache.hc.core5.annotation.ThreadingBehavior;
|
||||
|
@ -265,9 +266,9 @@ public final class HttpRoute implements RouteInfo, Cloneable {
|
|||
(this.secure == that.secure) &&
|
||||
(this.tunnelled == that.tunnelled) &&
|
||||
(this.layered == that.layered) &&
|
||||
LangUtils.equals(this.targetHost, that.targetHost) &&
|
||||
LangUtils.equals(this.localAddress, that.localAddress) &&
|
||||
LangUtils.equals(this.proxyChain, that.proxyChain);
|
||||
Objects.equals(this.targetHost, that.targetHost) &&
|
||||
Objects.equals(this.localAddress, that.localAddress) &&
|
||||
Objects.equals(this.proxyChain, that.proxyChain);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
package org.apache.hc.client5.http;
|
||||
|
||||
import java.net.InetAddress;
|
||||
import java.util.Objects;
|
||||
|
||||
import org.apache.hc.core5.http.HttpHost;
|
||||
import org.apache.hc.core5.util.Args;
|
||||
|
@ -294,9 +295,9 @@ public final class RouteTracker implements RouteInfo, Cloneable {
|
|||
(this.secure == that.secure) &&
|
||||
(this.tunnelled == that.tunnelled) &&
|
||||
(this.layered == that.layered) &&
|
||||
LangUtils.equals(this.targetHost, that.targetHost) &&
|
||||
LangUtils.equals(this.localAddress, that.localAddress) &&
|
||||
LangUtils.equals(this.proxyChain, that.proxyChain);
|
||||
Objects.equals(this.targetHost, that.targetHost) &&
|
||||
Objects.equals(this.localAddress, that.localAddress) &&
|
||||
Objects.equals(this.proxyChain, that.proxyChain);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
package org.apache.hc.client5.http.auth;
|
||||
|
||||
import java.util.Locale;
|
||||
import java.util.Objects;
|
||||
|
||||
import org.apache.hc.core5.annotation.Contract;
|
||||
import org.apache.hc.core5.annotation.ThreadingBehavior;
|
||||
|
@ -166,7 +167,7 @@ public class AuthScope {
|
|||
*/
|
||||
public int match(final AuthScope that) {
|
||||
int factor = 0;
|
||||
if (LangUtils.equals(toNullSafeLowerCase(this.schemeName),
|
||||
if (Objects.equals(toNullSafeLowerCase(this.schemeName),
|
||||
toNullSafeLowerCase(that.schemeName))) {
|
||||
factor += 1;
|
||||
} else {
|
||||
|
@ -174,7 +175,7 @@ public class AuthScope {
|
|||
return -1;
|
||||
}
|
||||
}
|
||||
if (LangUtils.equals(this.realm, that.realm)) {
|
||||
if (Objects.equals(this.realm, that.realm)) {
|
||||
factor += 2;
|
||||
} else {
|
||||
if (this.realm != null && that.realm != null) {
|
||||
|
@ -188,14 +189,14 @@ public class AuthScope {
|
|||
return -1;
|
||||
}
|
||||
}
|
||||
if (LangUtils.equals(this.protocol, that.protocol)) {
|
||||
if (Objects.equals(this.protocol, that.protocol)) {
|
||||
factor += 8;
|
||||
} else {
|
||||
if (this.protocol != null && that.protocol != null) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
if (LangUtils.equals(this.host, that.host)) {
|
||||
if (Objects.equals(this.host, that.host)) {
|
||||
factor += 16;
|
||||
} else {
|
||||
if (this.host != null && that.host != null) {
|
||||
|
@ -212,11 +213,11 @@ public class AuthScope {
|
|||
}
|
||||
if (obj instanceof AuthScope) {
|
||||
final AuthScope that = (AuthScope) obj;
|
||||
return LangUtils.equals(this.protocol, that.protocol)
|
||||
&& LangUtils.equals(this.host, that.host)
|
||||
return Objects.equals(this.protocol, that.protocol)
|
||||
&& Objects.equals(this.host, that.host)
|
||||
&& this.port == that.port
|
||||
&& LangUtils.equals(this.realm, that.realm)
|
||||
&& LangUtils.equals(toNullSafeLowerCase(this.schemeName),
|
||||
&& Objects.equals(this.realm, that.realm)
|
||||
&& Objects.equals(toNullSafeLowerCase(this.schemeName),
|
||||
toNullSafeLowerCase(that.schemeName));
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -28,6 +28,7 @@ package org.apache.hc.client5.http.auth;
|
|||
|
||||
import java.io.Serializable;
|
||||
import java.security.Principal;
|
||||
import java.util.Objects;
|
||||
|
||||
import org.apache.hc.core5.annotation.Contract;
|
||||
import org.apache.hc.core5.annotation.ThreadingBehavior;
|
||||
|
@ -71,7 +72,7 @@ public final class BasicUserPrincipal implements Principal, Serializable {
|
|||
}
|
||||
if (o instanceof BasicUserPrincipal) {
|
||||
final BasicUserPrincipal that = (BasicUserPrincipal) o;
|
||||
return LangUtils.equals(this.username, that.username);
|
||||
return Objects.equals(this.username, that.username);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -29,6 +29,7 @@ package org.apache.hc.client5.http.auth;
|
|||
import java.io.Serializable;
|
||||
import java.security.Principal;
|
||||
import java.util.Locale;
|
||||
import java.util.Objects;
|
||||
|
||||
import org.apache.hc.core5.annotation.Contract;
|
||||
import org.apache.hc.core5.annotation.ThreadingBehavior;
|
||||
|
@ -159,9 +160,9 @@ public class NTCredentials implements Credentials, Serializable {
|
|||
}
|
||||
if (o instanceof NTCredentials) {
|
||||
final NTCredentials that = (NTCredentials) o;
|
||||
return LangUtils.equals(this.principal, that.principal)
|
||||
&& LangUtils.equals(this.workstation, that.workstation)
|
||||
&& LangUtils.equals(this.netbiosDomain, that.netbiosDomain);
|
||||
return Objects.equals(this.principal, that.principal)
|
||||
&& Objects.equals(this.workstation, that.workstation)
|
||||
&& Objects.equals(this.netbiosDomain, that.netbiosDomain);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -29,6 +29,7 @@ package org.apache.hc.client5.http.auth;
|
|||
import java.io.Serializable;
|
||||
import java.security.Principal;
|
||||
import java.util.Locale;
|
||||
import java.util.Objects;
|
||||
|
||||
import org.apache.hc.core5.annotation.Contract;
|
||||
import org.apache.hc.core5.annotation.ThreadingBehavior;
|
||||
|
@ -99,8 +100,8 @@ public class NTUserPrincipal implements Principal, Serializable {
|
|||
}
|
||||
if (o instanceof NTUserPrincipal) {
|
||||
final NTUserPrincipal that = (NTUserPrincipal) o;
|
||||
return LangUtils.equals(this.username, that.username)
|
||||
&& LangUtils.equals(this.domain, that.domain);
|
||||
return Objects.equals(this.username, that.username)
|
||||
&& Objects.equals(this.domain, that.domain);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -28,11 +28,11 @@ package org.apache.hc.client5.http.auth;
|
|||
|
||||
import java.io.Serializable;
|
||||
import java.security.Principal;
|
||||
import java.util.Objects;
|
||||
|
||||
import org.apache.hc.core5.annotation.Contract;
|
||||
import org.apache.hc.core5.annotation.ThreadingBehavior;
|
||||
import org.apache.hc.core5.util.Args;
|
||||
import org.apache.hc.core5.util.LangUtils;
|
||||
|
||||
/**
|
||||
* Simple {@link Credentials} representation based on a user name / password
|
||||
|
@ -87,7 +87,7 @@ public class UsernamePasswordCredentials implements Credentials, Serializable {
|
|||
}
|
||||
if (o instanceof UsernamePasswordCredentials) {
|
||||
final UsernamePasswordCredentials that = (UsernamePasswordCredentials) o;
|
||||
return LangUtils.equals(this.principal, that.principal);
|
||||
return Objects.equals(this.principal, that.principal);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -28,6 +28,7 @@ package org.apache.hc.client5.http.impl.async;
|
|||
|
||||
import java.io.IOException;
|
||||
import java.net.URI;
|
||||
import java.util.Objects;
|
||||
|
||||
import org.apache.hc.client5.http.CircularRedirectException;
|
||||
import org.apache.hc.client5.http.HttpRoute;
|
||||
|
@ -56,7 +57,6 @@ import org.apache.hc.core5.http.ProtocolException;
|
|||
import org.apache.hc.core5.http.nio.AsyncDataConsumer;
|
||||
import org.apache.hc.core5.http.nio.AsyncEntityProducer;
|
||||
import org.apache.hc.core5.http.support.BasicRequestBuilder;
|
||||
import org.apache.hc.core5.util.LangUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
@ -169,9 +169,9 @@ public final class AsyncRedirectExec implements AsyncExecChainHandler {
|
|||
state.redirectURI = redirectUri;
|
||||
state.currentRequest = redirectBuilder.build();
|
||||
|
||||
if (!LangUtils.equals(currentRoute.getTargetHost(), newTarget)) {
|
||||
if (!Objects.equals(currentRoute.getTargetHost(), newTarget)) {
|
||||
final HttpRoute newRoute = routePlanner.determineRoute(newTarget, clientContext);
|
||||
if (!LangUtils.equals(currentRoute, newRoute)) {
|
||||
if (!Objects.equals(currentRoute, newRoute)) {
|
||||
state.reroute = true;
|
||||
final AuthExchange targetAuthExchange = clientContext.getAuthExchange(currentRoute.getTargetHost());
|
||||
if (LOG.isDebugEnabled()) {
|
||||
|
|
|
@ -34,6 +34,7 @@ import java.io.ObjectOutputStream;
|
|||
import java.io.Serializable;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import org.apache.hc.client5.http.SchemePortResolver;
|
||||
|
@ -90,7 +91,7 @@ public class BasicAuthCache implements AuthCache {
|
|||
return this.scheme.equals(that.scheme) &&
|
||||
this.host.equals(that.host) &&
|
||||
this.port == that.port &&
|
||||
LangUtils.equals(this.pathPrefix, that.pathPrefix);
|
||||
Objects.equals(this.pathPrefix, that.pathPrefix);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -29,6 +29,7 @@ package org.apache.hc.client5.http.impl.classic;
|
|||
|
||||
import java.io.IOException;
|
||||
import java.net.URI;
|
||||
import java.util.Objects;
|
||||
|
||||
import org.apache.hc.client5.http.CircularRedirectException;
|
||||
import org.apache.hc.client5.http.HttpRoute;
|
||||
|
@ -56,7 +57,6 @@ import org.apache.hc.core5.http.ProtocolException;
|
|||
import org.apache.hc.core5.http.io.entity.EntityUtils;
|
||||
import org.apache.hc.core5.http.io.support.ClassicRequestBuilder;
|
||||
import org.apache.hc.core5.util.Args;
|
||||
import org.apache.hc.core5.util.LangUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
@ -169,9 +169,9 @@ public final class RedirectExec implements ExecChainHandler {
|
|||
redirectBuilder.setUri(redirectUri);
|
||||
|
||||
final HttpRoute currentRoute = currentScope.route;
|
||||
if (!LangUtils.equals(currentRoute.getTargetHost(), newTarget)) {
|
||||
if (!Objects.equals(currentRoute.getTargetHost(), newTarget)) {
|
||||
final HttpRoute newRoute = this.routePlanner.determineRoute(newTarget, context);
|
||||
if (!LangUtils.equals(currentRoute, newRoute)) {
|
||||
if (!Objects.equals(currentRoute, newRoute)) {
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("{} new route required", exchangeId);
|
||||
}
|
||||
|
|
|
@ -29,6 +29,7 @@ package org.apache.hc.client5.http.impl.io;
|
|||
|
||||
import java.io.IOException;
|
||||
import java.time.Instant;
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.TimeoutException;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
@ -68,7 +69,6 @@ import org.apache.hc.core5.io.CloseMode;
|
|||
import org.apache.hc.core5.util.Args;
|
||||
import org.apache.hc.core5.util.Asserts;
|
||||
import org.apache.hc.core5.util.Deadline;
|
||||
import org.apache.hc.core5.util.LangUtils;
|
||||
import org.apache.hc.core5.util.TimeValue;
|
||||
import org.apache.hc.core5.util.Timeout;
|
||||
import org.slf4j.Logger;
|
||||
|
@ -304,7 +304,7 @@ public class BasicHttpClientConnectionManager implements HttpClientConnectionMan
|
|||
LOG.debug("{} Get connection for route {}", id, route);
|
||||
}
|
||||
Asserts.check(!this.leased, "Connection %s is still allocated", conn);
|
||||
if (!LangUtils.equals(this.route, route) || !LangUtils.equals(this.state, state)) {
|
||||
if (!Objects.equals(this.route, route) || !Objects.equals(this.state, state)) {
|
||||
closeConnection(CloseMode.GRACEFUL);
|
||||
}
|
||||
this.route = route;
|
||||
|
|
|
@ -26,8 +26,9 @@
|
|||
*/
|
||||
package org.apache.hc.client5.http;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
import org.apache.hc.core5.http.Header;
|
||||
import org.apache.hc.core5.util.LangUtils;
|
||||
import org.hamcrest.BaseMatcher;
|
||||
import org.hamcrest.Description;
|
||||
import org.hamcrest.Matcher;
|
||||
|
@ -46,7 +47,7 @@ public class HeaderMatcher extends BaseMatcher<Header> {
|
|||
public boolean matches(final Object item) {
|
||||
if (item instanceof Header) {
|
||||
final Header header = (Header) item;
|
||||
return headerName.equalsIgnoreCase(header.getName()) && LangUtils.equals(headerValue, header.getValue());
|
||||
return headerName.equalsIgnoreCase(header.getName()) && Objects.equals(headerValue, header.getValue());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -26,8 +26,9 @@
|
|||
*/
|
||||
package org.apache.hc.client5.http;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
import org.apache.hc.core5.http.Header;
|
||||
import org.apache.hc.core5.util.LangUtils;
|
||||
import org.hamcrest.BaseMatcher;
|
||||
import org.hamcrest.Description;
|
||||
import org.hamcrest.Matcher;
|
||||
|
@ -49,7 +50,7 @@ public class HeadersMatcher extends BaseMatcher<Header[]> {
|
|||
final Header h1 = headers[i];
|
||||
final Header h2 = expectedHeaders[i];
|
||||
if (!h1.getName().equalsIgnoreCase(h2.getName())
|
||||
|| !LangUtils.equals(h1.getValue(), h2.getValue())) {
|
||||
|| !Objects.equals(h1.getValue(), h2.getValue())) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,8 +26,9 @@
|
|||
*/
|
||||
package org.apache.hc.client5.http;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
import org.apache.hc.core5.http.NameValuePair;
|
||||
import org.apache.hc.core5.util.LangUtils;
|
||||
import org.hamcrest.BaseMatcher;
|
||||
import org.hamcrest.Description;
|
||||
import org.hamcrest.Matcher;
|
||||
|
@ -46,7 +47,7 @@ public class NameValuePairMatcher extends BaseMatcher<NameValuePair> {
|
|||
public boolean matches(final Object item) {
|
||||
if (item instanceof NameValuePair) {
|
||||
final NameValuePair nvp = (NameValuePair) item;
|
||||
return LangUtils.equals(nvp.getName(), name) && LangUtils.equals(nvp.getValue(), value);
|
||||
return Objects.equals(nvp.getName(), name) && Objects.equals(nvp.getValue(), value);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -30,9 +30,9 @@ import java.util.ArrayList;
|
|||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
import org.apache.hc.core5.http.NameValuePair;
|
||||
import org.apache.hc.core5.util.LangUtils;
|
||||
import org.hamcrest.BaseMatcher;
|
||||
import org.hamcrest.Description;
|
||||
import org.hamcrest.Matcher;
|
||||
|
@ -55,7 +55,7 @@ public class NameValuePairsMatcher extends BaseMatcher<Collection<? extends Name
|
|||
final NameValuePair nvp1 = (NameValuePair) obj;
|
||||
final NameValuePair nvp2 = expectedNameValuePairList.get(i);
|
||||
if (!nvp1.getName().equalsIgnoreCase(nvp2.getName())
|
||||
|| !LangUtils.equals(nvp1.getValue(), nvp2.getValue())) {
|
||||
|| !Objects.equals(nvp1.getValue(), nvp2.getValue())) {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
|
|
Loading…
Reference in New Issue